From dc914fd71acd46a51e8693329ce7b6976d84d55d Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Tue, 17 Aug 2021 17:12:11 +0300 Subject: [PATCH 1/5] Move get-go-versions from Azure DevOps --- .github/workflows/get-go-versions.yml | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/get-go-versions.yml diff --git a/.github/workflows/get-go-versions.yml b/.github/workflows/get-go-versions.yml new file mode 100644 index 0000000..cebf1f1 --- /dev/null +++ b/.github/workflows/get-go-versions.yml @@ -0,0 +1,72 @@ +name: Get Go versions +on: + schedule: + - cron: '0 3,15 * * *' + workflow_dispatch: + +env: + TOOL_NAME: "Go" +defaults: + run: + shell: pwsh + +jobs: + find_new_versions: + name: Find new versions + runs-on: ubuntu-18.04 + outputs: + versions_output: ${{ steps.Get_new_versions.outputs.version_number }} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - id: Get_new_versions + name: Get new versions + run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.TOOL_NAME }} + + check_new_versions: + name: Check new versions + runs-on: ubuntu-18.04 + needs: find_new_versions + env: + TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Check Versions + if: success() && env.TOOL_VERSIONS == '' + run: | + Write-Host "No new versions were found" + Import-Module "./helpers/github/github-api.psm1" + $gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" ` + -AccessToken "${{ secrets.PERSONAL_TOKEN }}" + $gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID") + Start-Sleep -Seconds 60 + - name: Send Slack notification + run: | + $PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" + ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` + -ToolName "${{ env.TOOL_NAME }}" ` + -ToolVersion "${{ env.TOOL_VERSIONS }}" ` + -PipelineUrl "$PipelineUrl" ` + -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" + trigger_builds: + name: Trigger builds + runs-on: ubuntu-18.04 + needs: [find_new_versions, check_new_versions] + env: + TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} + environment: Get Available Tools Versions - Publishing Approval + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Trigger "Build go packages" workflow + run: + ./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" ` + -AccessToken "${{ secrets.PERSONAL_TOKEN }}" ` + -WorkflowFileName "build-go-packages.yml" ` + -WorkflowDispatchRef "main" ` + -ToolVersions "${{ env.TOOL_VERSIONS }}" ` + -PublishReleases "true" From c8892db08081da98395b609c62dd4284edacd257 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Thu, 19 Aug 2021 16:16:05 +0300 Subject: [PATCH 2/5] Add the job to check build for failures in get-go-versions.yml --- .github/workflows/get-go-versions.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/get-go-versions.yml b/.github/workflows/get-go-versions.yml index cebf1f1..f91a3c9 100644 --- a/.github/workflows/get-go-versions.yml +++ b/.github/workflows/get-go-versions.yml @@ -51,6 +51,7 @@ jobs: -ToolVersion "${{ env.TOOL_VERSIONS }}" ` -PipelineUrl "$PipelineUrl" ` -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" + trigger_builds: name: Trigger builds runs-on: ubuntu-18.04 @@ -70,3 +71,23 @@ jobs: -WorkflowDispatchRef "main" ` -ToolVersions "${{ env.TOOL_VERSIONS }}" ` -PublishReleases "true" + + check_build: + name: Check build for failures + runs-on: ubuntu-18.04 + needs: [find_new_versions, check_new_versions, trigger_builds] + if: failure() + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Send Slack notification if build fails + run: | + $PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" + $Message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $PipelineUrl" + ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` + -ToolName "${{ env.TOOL_NAME }}" ` + -Text "$Message" ` + -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" + From d0f2864c566fbde736744d4ddc16faee4338b19a Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Fri, 20 Aug 2021 17:33:06 +0300 Subject: [PATCH 3/5] Update get-go-versions forkflow --- .github/workflows/get-go-versions.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/get-go-versions.yml b/.github/workflows/get-go-versions.yml index f91a3c9..57dc565 100644 --- a/.github/workflows/get-go-versions.yml +++ b/.github/workflows/get-go-versions.yml @@ -13,20 +13,21 @@ defaults: jobs: find_new_versions: name: Find new versions - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest outputs: - versions_output: ${{ steps.Get_new_versions.outputs.version_number }} + versions_output: ${{ steps.Get_new_versions.outputs.TOOL_VERSIONS }} steps: - uses: actions/checkout@v2 with: submodules: true + - id: Get_new_versions name: Get new versions run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.TOOL_NAME }} check_new_versions: name: Check new versions - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: find_new_versions env: TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} @@ -34,27 +35,30 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Check Versions - if: success() && env.TOOL_VERSIONS == '' + if: env.TOOL_VERSIONS == '' run: | Write-Host "No new versions were found" Import-Module "./helpers/github/github-api.psm1" $gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" ` -AccessToken "${{ secrets.PERSONAL_TOKEN }}" + $gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID") Start-Sleep -Seconds 60 + - name: Send Slack notification run: | - $PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" + $pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` -ToolName "${{ env.TOOL_NAME }}" ` -ToolVersion "${{ env.TOOL_VERSIONS }}" ` - -PipelineUrl "$PipelineUrl" ` + -PipelineUrl "$pipelineUrl" ` -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" trigger_builds: name: Trigger builds - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [find_new_versions, check_new_versions] env: TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} @@ -63,6 +67,7 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Trigger "Build go packages" workflow run: ./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" ` @@ -74,7 +79,7 @@ jobs: check_build: name: Check build for failures - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [find_new_versions, check_new_versions, trigger_builds] if: failure() steps: @@ -84,10 +89,9 @@ jobs: - name: Send Slack notification if build fails run: | - $PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" - $Message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $PipelineUrl" + $pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" + $Message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl" ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` -ToolName "${{ env.TOOL_NAME }}" ` -Text "$Message" ` -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" - From b895c36713d01ce35dde3226a1cb8d9b0cad85b8 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Wed, 25 Aug 2021 15:29:09 +0300 Subject: [PATCH 4/5] Update Send Slack notification step to send a custom message --- .github/workflows/get-go-versions.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/get-go-versions.yml b/.github/workflows/get-go-versions.yml index 57dc565..bd14f8e 100644 --- a/.github/workflows/get-go-versions.yml +++ b/.github/workflows/get-go-versions.yml @@ -50,12 +50,11 @@ jobs: - name: Send Slack notification run: | $pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" + $message = "The following versions of '${{ env.TOOL_NAME }}' are available to upload: ${{ env.TOOL_VERSIONS }}\nLink to the pipeline: $pipelineUrl" ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` -ToolName "${{ env.TOOL_NAME }}" ` - -ToolVersion "${{ env.TOOL_VERSIONS }}" ` - -PipelineUrl "$pipelineUrl" ` - -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" - + -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" ` + -Text "$message" trigger_builds: name: Trigger builds runs-on: ubuntu-latest @@ -90,8 +89,8 @@ jobs: - name: Send Slack notification if build fails run: | $pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" - $Message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl" + $message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl" ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` -ToolName "${{ env.TOOL_NAME }}" ` - -Text "$Message" ` + -Text "$message" ` -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" From df37e8bf8f58b2d61e0f9e8a9559d50bc31200da Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Thu, 26 Aug 2021 12:20:41 +0300 Subject: [PATCH 5/5] Update helpers --- helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers b/helpers index 4b0fa42..1eaa091 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit 4b0fa42d9972d1f51dd26ca96e03987d374a1d7a +Subproject commit 1eaa091b6531cad000ee0c4585bfa97d3476b028