From c808608b9a3c44b2ef0e060f8d3f3d2269582a1c Mon Sep 17 00:00:00 2001 From: Tit Petric Date: Mon, 30 Sep 2024 15:03:05 +0200 Subject: [PATCH] [TT-13136] Adjust concurrency group to CI tests, extend to all workflows (#6560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### **User description**
TT-13136
Summary If a PR is rebased, or new commits are added, cancel previous runs
Type Task Task
Status In Dev
Points N/A
Labels -
--- https://tyktech.atlassian.net/browse/TT-13136 ___ ### **PR Type** enhancement, configuration changes ___ ### **Description** - Added concurrency group settings to multiple workflows to manage job execution and cancellation. - Introduced a new CI lint workflow with concurrency settings and job definitions for godoc and jira. - Removed outdated workflows for API changes, JIRA lint, and OAS documentation updates. - Updated Go version to stable in the Swagger lint workflow. ___ ### **Changes walkthrough** 📝
Relevant files
Enhancement
ci-tests.yml
Update concurrency settings in CI tests workflow                 

.github/workflows/ci-tests.yml
  • Updated concurrency group settings for CI tests.
  • Changed the method to cancel in-progress jobs based on event type.
  • +2/-6     
    codeql-analysis.yml
    Add concurrency settings to CodeQL analysis workflow         

    .github/workflows/codeql-analysis.yml
  • Added concurrency group settings.
  • Enabled cancellation of in-progress jobs for pull requests.
  • +4/-0     
    lint-swagger.yml
    Add concurrency and update Go version in Swagger lint workflow

    .github/workflows/lint-swagger.yml
  • Added concurrency group settings.
  • Enabled cancellation of in-progress jobs for pull requests.
  • Changed Go version to stable.
  • +5/-1     
    lint.yml
    Introduce new CI lint workflow with concurrency settings 

    .github/workflows/lint.yml
  • Added new CI lint workflow.
  • Included concurrency settings and job definitions for godoc and jira.
  • +33/-0   
    plugin-compiler-build.yml
    Add concurrency settings to plugin compiler build workflow

    .github/workflows/plugin-compiler-build.yml
  • Added concurrency group settings.
  • Enabled cancellation of in-progress jobs for pull requests.
  • +4/-0     
    release.yml
    Add concurrency settings to release workflow                         

    .github/workflows/release.yml
  • Added concurrency group settings.
  • Enabled cancellation of in-progress jobs for pull requests.
  • +5/-0     
    ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Tit Petric --- .github/workflows/api-changes.yml | 15 ---------- .github/workflows/ci-tests.yml | 8 ++--- .github/workflows/codeql-analysis.yml | 4 +++ .github/workflows/jira-lint.yml | 20 ------------- .github/workflows/lint-swagger.yml | 6 +++- .github/workflows/lint.yml | 33 +++++++++++++++++++++ .github/workflows/plugin-compiler-build.yml | 4 +++ .github/workflows/release.yml | 9 +++++- .github/workflows/update-oas-docs.yml | 22 -------------- 9 files changed, 56 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/api-changes.yml delete mode 100644 .github/workflows/jira-lint.yml create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/update-oas-docs.yml diff --git a/.github/workflows/api-changes.yml b/.github/workflows/api-changes.yml deleted file mode 100644 index 667b179712b..00000000000 --- a/.github/workflows/api-changes.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: API Changes - -on: - pull_request: - branches: - - master - - release-** - -jobs: - godoc: - uses: TykTechnologies/github-actions/.github/workflows/godoc.yml@main - secrets: - ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }} - with: - go-version: 1.22 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 95acfe3cc6a..2c75a44df2e 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -17,13 +17,9 @@ on: - master - release-** -# Only have one runner per PR, and per merged commit. -# -# - As a PR gets new commits, any old run jobs get cancelled (PR number) -# - As a commit gets merged, it doesn't cancel previous running PR's (github.sha) concurrency: - group: ${{ github.event.pull_request.number || github.sha }}-ci-tests - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: PYTHON_VERSION: "3.11" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 14bccb15d6f..5f20f9cf614 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,6 +11,10 @@ on: schedule: - cron: '0 18 * * 4' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: analyze: name: Analyze diff --git a/.github/workflows/jira-lint.yml b/.github/workflows/jira-lint.yml deleted file mode 100644 index 23d95f04b16..00000000000 --- a/.github/workflows/jira-lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: JIRA lint - -on: - pull_request: - branches: - - master - - release-** - types: - - opened - - reopened - - synchronize - - ready_for_review - -jobs: - jira-lint: - if: ${{ !github.event.pull_request.draft }} - uses: TykTechnologies/github-actions/.github/workflows/jira-lint.yaml@main - secrets: - JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} - ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }} diff --git a/.github/workflows/lint-swagger.yml b/.github/workflows/lint-swagger.yml index efdacc3d415..638f25f6476 100644 --- a/.github/workflows/lint-swagger.yml +++ b/.github/workflows/lint-swagger.yml @@ -7,6 +7,10 @@ on: paths: - 'swagger.yml' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: redocly_validator: runs-on: ubuntu-latest @@ -41,7 +45,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: '1.22.x' + go-version: stable - name: Install dyff binary run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..de061ee1d73 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +# yamllint disable rule:truthy +--- +name: CI lint + +on: + pull_request: + branches: + - master + - release-** + push: + branches: + - master + - release-** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + godoc: + if: ${{ !github.event.pull_request.draft }} + uses: TykTechnologies/github-actions/.github/workflows/godoc.yml@main + secrets: + ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }} + with: + go-version: stable + + jira: + if: ${{ !github.event.pull_request.draft }} + uses: TykTechnologies/github-actions/.github/workflows/jira-lint.yaml@main + secrets: + JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} + ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }} diff --git a/.github/workflows/plugin-compiler-build.yml b/.github/workflows/plugin-compiler-build.yml index 53984e0b88a..ba32e321106 100644 --- a/.github/workflows/plugin-compiler-build.yml +++ b/.github/workflows/plugin-compiler-build.yml @@ -13,6 +13,10 @@ on: env: GOLANG_CROSS: 1.22-bullseye +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: docker-build: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87b1bcafc33..d6e025b1865 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,7 @@ +# yamllint disable rule:line-length rule:truthy +--- +name: Release + # Generated by: gromit policy # Distribution channels covered by this workflow @@ -7,7 +11,10 @@ # - devenv ECR # - Cloudsmith -name: Release +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + on: # Trigger release every monday at midnight for master CI images schedule: diff --git a/.github/workflows/update-oas-docs.yml b/.github/workflows/update-oas-docs.yml deleted file mode 100644 index 03c9a552cca..00000000000 --- a/.github/workflows/update-oas-docs.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Keep the docs on tyk-docs in sync with this branch's docs - -name: Update OAS docs - -on: - push: - branches: - - temporarily-suspended - paths: - - apidef/oas/schema/x-tyk-gateway.md - -jobs: - sync: - name: tyk-oas-docs - runs-on: ubuntu-latest - steps: - - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.ORG_GH_TOKEN }} - repository: TykTechnologies/tyk-docs - event-type: tyk-oas-docs - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'