From 6eded679bc1222e04d285e17febbcb22847e2bce Mon Sep 17 00:00:00 2001 From: Michael Li Date: Fri, 17 May 2024 13:01:54 -0400 Subject: [PATCH] chore: Update to use Node20 version of Actions (#4787) * chore: Update to use Node20 version of Actions * CR: Add additional triggers to milestone checker * CR: Remove use of third-party action --- .github/configs/milestone-check.json | 9 ---- .github/workflows/actionlint.yml | 2 +- .github/workflows/build.yml | 22 +++------- .github/workflows/enos-run.yml | 4 +- .github/workflows/jira.yml | 57 ++++++++++++++++--------- .github/workflows/milestone-checker.yml | 22 ++-------- 6 files changed, 50 insertions(+), 66 deletions(-) delete mode 100644 .github/configs/milestone-check.json diff --git a/.github/configs/milestone-check.json b/.github/configs/milestone-check.json deleted file mode 100644 index cb37b6116e..0000000000 --- a/.github/configs/milestone-check.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - { - "type": "check-milestone", - "title": "Milestone Check", - "success": "Milestone set", - "failure": "Milestone not set" - } -] - diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 5f056a0849..c68f87e7b8 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -13,6 +13,6 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Check workflow files - uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint@sha256:3f24bf9d72ca67af6f9f8f3cc63b0e24621b57bf421cecfc452c3312e32b68cc # 1.6.24 + uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint@sha256:5acca218639222e4afbc82fc6e9ef56cbe646ade3b07f3f5ec364b638258a244 with: args: -color -ignore SC2129 -ignore "'property \"download-path\" is not defined in object type'" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 805fd40192..f20c354f2d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Set Product version id: set-product-version - uses: hashicorp/actions-set-product-version@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed + uses: hashicorp/actions-set-product-version@v2 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed product-metadata: needs: set-product-version @@ -175,7 +175,7 @@ jobs: CGO_ENABLED: "0" PRERELEASE_PRODUCT_VERSION: ${{ needs.set-product-version.outputs.prerelease-product-version }} METADATA_PRODUCT_VERSION: ${{ needs.product-metadata.outputs.product-edition }} - uses: hashicorp/actions-go-build@v0.1.9 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed + uses: hashicorp/actions-go-build@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed with: product_name: ${{ env.PKG_NAME }} product_version: ${{ needs.set-product-version. outputs.product-version }} @@ -185,10 +185,6 @@ jobs: reproducible: report instructions: |- make build - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - with: - name: ${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip - path: out/${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip build-linux: needs: @@ -247,7 +243,7 @@ jobs: CGO_ENABLED: "0" PRERELEASE_PRODUCT_VERSION: ${{ needs.set-product-version.outputs.prerelease-product-version }} METADATA_PRODUCT_VERSION: ${{ needs.product-metadata.outputs.product-edition }} - uses: hashicorp/actions-go-build@v0.1.9 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed + uses: hashicorp/actions-go-build@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed with: product_name: ${{ env.PKG_NAME }} product_version: ${{ needs.set-product-version. outputs.product-version }} @@ -257,10 +253,6 @@ jobs: reproducible: report instructions: |- make build - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - with: - name: ${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip - path: out/${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip - name: Copy license file to config_dir env: LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.PKG_NAME }}" @@ -351,7 +343,7 @@ jobs: CGO_ENABLED: "0" PRERELEASE_PRODUCT_VERSION: ${{ needs.set-product-version.outputs.prerelease-product-version }} METADATA_PRODUCT_VERSION: ${{ needs.product-metadata.outputs.product-edition }} - uses: hashicorp/actions-go-build@v0.1.9 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed + uses: hashicorp/actions-go-build@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed with: product_name: ${{ env.PKG_NAME }} product_version: ${{ needs.set-product-version. outputs.product-version }} @@ -361,10 +353,6 @@ jobs: reproducible: report instructions: |- make build - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - with: - name: ${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip - path: out/${{ env.PKG_NAME }}_${{ needs.set-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip build-docker: name: Docker ${{ matrix.arch }} build @@ -385,7 +373,7 @@ jobs: steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Docker Build (Action) - uses: hashicorp/actions-docker-build@v1 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed + uses: hashicorp/actions-docker-build@v2 # TSCCR: loading action configs: failed to query HEAD reference: failed to get advertised references: authorization failed with: version: ${{ env.version }} target: default diff --git a/.github/workflows/enos-run.yml b/.github/workflows/enos-run.yml index 9c18449405..9a88355ee7 100644 --- a/.github/workflows/enos-run.yml +++ b/.github/workflows/enos-run.yml @@ -199,7 +199,7 @@ jobs: ssh -V - name: Download Boundary Linux AMD64 bundle id: download - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: ${{ inputs.artifact-name }} path: ./enos/support/downloads @@ -209,7 +209,7 @@ jobs: mv ${{steps.download.outputs.download-path}}/*.zip enos/support/boundary.zip - name: Download Boundary Linux AMD64 docker image if: contains(matrix.filter, 'e2e_docker') - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 id: download-docker with: name: ${{ inputs.docker-image-file }} diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml index e1eb001cf4..6978edf96d 100644 --- a/.github/workflows/jira.yml +++ b/.github/workflows/jira.yml @@ -32,13 +32,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.JIRA_SYNC_GITHUB_TOKEN }} - - name: Login - uses: atlassian/gajira-login@45fd029b9f1d6d8926c6f04175aa80c0e42c9026 # v3.0.1 - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - name: Set ticket type if: github.event.action == 'opened' && !steps.boundary-team-role.outputs.role id: set-ticket-type @@ -52,6 +45,10 @@ jobs: - name: Create ticket if: github.event.action == 'opened' && !steps.boundary-team-role.outputs.role uses: tomhjp/gh-action-jira-create@3ed1789cad3521292e591a7cfa703215ec1348bf # v0.2.1 + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} with: project: ICU issuetype: "GH Issue" @@ -64,6 +61,10 @@ jobs: if: github.event.action != 'opened' id: search uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2 + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} with: # cf[10089] is Issue Link custom field jql: 'issuetype = "GH Issue" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' @@ -71,20 +72,38 @@ jobs: - name: Sync comment if: github.event.action == 'created' && steps.search.outputs.issue uses: tomhjp/gh-action-jira-comment@6eb6b9ead70221916b6badd118c24535ed220bd9 # v0.2.0 + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} with: issue: ${{ steps.search.outputs.issue }} comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" - - name: Close ticket - if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue - uses: atlassian/gajira-transition@38fc9cd61b03d6a53dd35fcccda172fe04b36de3 # v3.0.1 - with: - issue: ${{ steps.search.outputs.issue }} - transition: Done + - name: Transitions + id: transitions + if: steps.search.outputs.issue + run: | + if [[ "${{ github.event.action }}" == "closed" || "${{ github.event.action }}" == "deleted" ]]; then + echo "Closing ticket" + echo "name=Done" >> "$GITHUB_OUTPUT" + elif [[ "${{ github.event.action }}" == "reopened" ]]; then + echo "Reopening ticket" + echo "name='Reopen'" >> "$GITHUB_OUTPUT" + fi - - name: Reopen ticket - if: github.event.action == 'reopened' && steps.search.outputs.issue - uses: atlassian/gajira-transition@38fc9cd61b03d6a53dd35fcccda172fe04b36de3 # v3.0.1 - with: - issue: ${{ steps.search.outputs.issue }} - transition: "To Do" + # Transition issue API reference: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post + - name: Transition ticket + if: steps.transitions.outputs.name + run: | + transitions="$(curl --silent \ + --url "${{ secrets.JIRA_BASE_URL }}rest/api/3/issue/${{ steps.search.outputs.issue }}/transitions" \ + --user "${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}" \ + --header "Accept: application/json")" + id="$(echo "${transitions}" | jq -r '.transitions[] | select(.name == "${{ steps.transitions.outputs.name }}") | .id')" + curl --silent \ + --url "${{ secrets.JIRA_BASE_URL }}rest/api/3/issue/${{ steps.search.outputs.issue }}/transitions" \ + --user "${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }}" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" \ + --data "$(printf '{"transition": {"id": "%s"}}' "${id}")" diff --git a/.github/workflows/milestone-checker.yml b/.github/workflows/milestone-checker.yml index dfa55519d4..db7310640d 100644 --- a/.github/workflows/milestone-checker.yml +++ b/.github/workflows/milestone-checker.yml @@ -5,7 +5,8 @@ name: Check Milestone on: pull_request: - types: [opened, synchronize, labeled, unlabeled] + # milestoned and demilestoned are supported even if IDE is complaining + types: [opened, synchronize, labeled, unlabeled, milestoned, demilestoned ] # Runs on PRs to main and release branches branches: - main @@ -22,20 +23,5 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'pr/no-milestone') != true runs-on: ${{ fromJSON(vars.RUNNER) }} steps: - - name: Checkout Actions - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - with: - repository: "grafana/grafana-github-actions" - path: ./actions - ref: be89ad434792280ebaa4d982ac72ba548b6f7095 - - name: Set up Node.js - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: '16.x' - - name: Install Actions - run: npm install --production --prefix ./actions - - name: Run PR Checks - uses: ./actions/pr-checks - with: - token: ${{ secrets.GITHUB_TOKEN }} - configPath: configs/milestone-check + - name: Check milestone + run: ${{ github.event.pull_request.milestone != null }}