diff --git a/.github/workflows/auto-add-issues-to-project.yml b/.github/workflows/auto-add-issues-to-project.yml deleted file mode 100644 index 1fac6f4ad41..00000000000 --- a/.github/workflows/auto-add-issues-to-project.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Automatically add new issue to backlog -on: - issues: - types: - - opened - -permissions: - contents: read - -jobs: - track_issue: - runs-on: ubuntu-slim - steps: - - name: Get project data - env: - GITHUB_TOKEN: ${{ secrets.GH_AUTOMATION_PAT }} - ORGANIZATION: kedacore - # This refers to our backlog project: https://github.com/orgs/kedacore/projects/2/views/1 - PROJECT_NUMBER: 2 - run: | - gh api graphql -f query=' - query($org: String!, $number: Int!) { - organization(login: $org){ - projectV2(number: $number) { - id - fields(first:20) { - nodes { - ... on ProjectV2Field { - id - name - } - } - } - } - } - }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json - - echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV - - name: Add issue to project - env: - GITHUB_TOKEN: ${{ secrets.GH_AUTOMATION_PAT }} - ISSUE_ID: ${{ github.event.issue.node_id }} - run: | - item_id="$( gh api graphql -f query=' - mutation($project:ID!, $issue:ID!) { - addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) { - item { - id - } - } - }' -f project=$PROJECT_ID -f issue=$ISSUE_ID --jq '.data.addProjectV2ItemById.item.id')" diff --git a/.github/workflows/custom-build-image.yml b/.github/workflows/custom-build-image.yml new file mode 100644 index 00000000000..0d0e34d08cf --- /dev/null +++ b/.github/workflows/custom-build-image.yml @@ -0,0 +1,33 @@ +name: Build Custom KEDA Image + +on: + push: + branches: + - feature/temporal-scaler-composite-metric + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: $GITHUB_ACTOR + password: ${{ secrets.ORG_PAT_GITHUB }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/atlanhq/keda:2.18.3-temporal-composite-${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml deleted file mode 100644 index ff3ec88f87a..00000000000 --- a/.github/workflows/fossa.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: FOSSA - -on: - push: - branches: [main] - pull_request: - branches: [main] - -permissions: - contents: read - -env: - fossa-key: 9e722f2c8904586d61f97f0bf05a99e4 # This is a public key only for pushing, it's safe here - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version-file: "go.mod" - - run: go version - - name: Get branch name - id: branch-name - uses: tj-actions/branch-names@5250492686b253f06fa55861556d1027b067aeb5 # v9.0.2 - - uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 - name: Scanning with FOSSA - with: - api-key: ${{ env.fossa-key }} - branch: ${{ steps.branch-name.outputs.current_branch }} - - uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 - name: Executing tests with FOSSA - with: - api-key: ${{ env.fossa-key }} - run-tests: true diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml deleted file mode 100644 index 2fc21de5e94..00000000000 --- a/.github/workflows/main-build.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: main-build -on: - push: - branches: - - main -permissions: - contents: read - -jobs: - build: - name: build - runs-on: ARM64 - permissions: - contents: read - packages: write - id-token: write # needed for signing the images with GitHub OIDC Token **not production ready** - - # keda-tools is built from github.com/test-tools/tools/Dockerfile - container: ghcr.io/kedacore/keda-tools:1.25.5 - steps: - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - id: go-paths - run: | - echo "mod_cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - echo "build_cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT - - - name: Go modules cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ steps.go-paths.outputs.mod_cache }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - - name: Go build cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ steps.go-paths.outputs.build_cache }} - key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - - name: Go modules sync - run: go mod tidy -compat=1.25 - - - name: Test - run: make test - - # https://github.com/sigstore/cosign-installer - - name: Install Cosign - uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 - - - name: Check Cosign install! - run: cosign version - - - name: Login to GitHub Container Registry - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GH_AUTOMATION_PAT }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - - - name: Publish main on GitHub Container Registry - run: make publish-multiarch - - - name: Sign KEDA images published on GitHub Container Registry - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: make sign-images - - - name: Publish sha on GitHub Container Registry - run: make publish-multiarch - env: - VERSION: ${{ github.sha }} - - - name: Sign KEDA images published on GitHub Container Registry - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: make sign-images - env: - VERSION: ${{ github.sha }} - - validate: - needs: build - uses: kedacore/keda/.github/workflows/template-main-e2e-test.yml@main - secrets: inherit - - validate-arm64: - needs: build - uses: kedacore/keda/.github/workflows/template-arm64-smoke-tests.yml@main - - validate-s390x: - needs: build - uses: kedacore/keda/.github/workflows/template-s390x-smoke-tests.yml@main - - validate-k8s-versions: - needs: build - uses: kedacore/keda/.github/workflows/template-versions-smoke-tests.yml@main - - trivy-scan: - needs: build - permissions: - contents: read - security-events: write - uses: kedacore/keda/.github/workflows/template-trivy-scan.yml@main - with: - runs-on: ubuntu-latest - scan-type: "fs" - format: "sarif" - exit-code: 0 - publish: true - - trivy-scan-metrics-server: - needs: build - permissions: - contents: read - security-events: write - strategy: - matrix: - runner: [ARM64, ubuntu-latest] - uses: kedacore/keda/.github/workflows/template-trivy-scan.yml@main - with: - runs-on: ${{ matrix.runner }} - scan-type: "image" - image-ref: ghcr.io/kedacore/keda-metrics-apiserver:main - format: "sarif" - exit-code: 0 - publish: true - - trivy-scan-keda: - needs: build - permissions: - contents: read - security-events: write - strategy: - matrix: - runner: [ARM64, ubuntu-latest] - uses: kedacore/keda/.github/workflows/template-trivy-scan.yml@main - with: - runs-on: ${{ matrix.runner }} - scan-type: "image" - image-ref: ghcr.io/kedacore/keda:main - format: "sarif" - exit-code: 0 - publish: true diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml deleted file mode 100644 index e8186589bd3..00000000000 --- a/.github/workflows/nightly-e2e.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: nightly-e2e-test -on: - schedule: - - cron: "0 0 * * *" - -permissions: - contents: read - -jobs: - validate: - uses: kedacore/keda/.github/workflows/template-main-e2e-test.yml@main - secrets: inherit - - validate-arm64: - uses: kedacore/keda/.github/workflows/template-arm64-smoke-tests.yml@main - - validate-s390x: - uses: kedacore/keda/.github/workflows/template-s390x-smoke-tests.yml@main - - validate-k8s-versions: - uses: kedacore/keda/.github/workflows/template-versions-smoke-tests.yml@main diff --git a/.github/workflows/pr-bot-welcome.yml b/.github/workflows/pr-bot-welcome.yml deleted file mode 100644 index 9131320e1a5..00000000000 --- a/.github/workflows/pr-bot-welcome.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: PR Welcome Bot - -on: - pull_request_target: - types: [opened] - branches: - - 'main' - -permissions: - issues: write - pull-requests: write - -jobs: - pr_bot: - name: PR Bot - runs-on: ubuntu-slim - steps: - - name: 'Comment on PR' - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ github.event.number }}, - body: 'Thank you for your contribution! 🙏\n\nPlease understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.\n\nWhile you are waiting, make sure to:\n\n- Add an entry in our changelog in alphabetical order and link related issue\n- Update the documentation, if needed\n- Add unit & e2e tests for your changes\n- GitHub checks are passing\n- Is the DCO check failing? Here is how you can [fix DCO issues](https://github.com/kedacore/keda/blob/main/CONTRIBUTING.md#i-didnt-sign-my-commit-now-what)\n\nOnce the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.\n\nLearn more about our [contribution guide](https://github.com/kedacore/keda-docs/blob/main/CONTRIBUTING.md).' - }); diff --git a/.github/workflows/pr-e2e-checker.yml b/.github/workflows/pr-e2e-checker.yml deleted file mode 100644 index d2fb7cabfe3..00000000000 --- a/.github/workflows/pr-e2e-checker.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: E2E Test Checker -on: - pull_request_target: - types: - - labeled - - unlabeled - -env: - SKIP_E2E_TAG: skip-e2e - E2E_CHECK_NAME: e2e tests - ARM_SMOKE_CHECK_NAME: ARM smoke tests - S390X_SMOKE_CHECK_NAME: S390x smoke tests - - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - e2e-checker: - name: label checker - runs-on: ubuntu-slim - if: github.event.label.name == 'skip-e2e' - steps: - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.E2E_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create-arm - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create-arm.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create-s390x - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create-s390x.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} diff --git a/.github/workflows/pr-e2e-creator.yml b/.github/workflows/pr-e2e-creator.yml deleted file mode 100644 index c11cf1619e2..00000000000 --- a/.github/workflows/pr-e2e-creator.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: E2E Test Creator -on: - pull_request_target: - types: - - opened - - synchronize - -env: - SKIP_E2E_TAG: skip-e2e - E2E_CHECK_NAME: e2e tests - ARM_SMOKE_CHECK_NAME: ARM smoke tests - S390X_SMOKE_CHECK_NAME: S390x smoke tests - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - check-creator: - name: check-creator - runs-on: ubuntu-slim - steps: - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.E2E_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create-arm - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create-arm.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Enqueue e2e - id: create-s390x - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - status: queued - - - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - name: Skip e2e - if: ${{ contains(github.event.pull_request.labels.*.name, env.SKIP_E2E_TAG )}} - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ github.event.pull_request.head.sha }} - check_id: ${{ steps.create-s390x.outputs.check_id }} - conclusion: success - output: | - {"summary": "skipped by maintainer"} diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml deleted file mode 100644 index a6ad331865c..00000000000 --- a/.github/workflows/pr-e2e.yml +++ /dev/null @@ -1,499 +0,0 @@ -name: pr-e2e-tests -on: - issue_comment: - types: [created] - -env: - E2E_CHECK_NAME: e2e tests - ARM_SMOKE_CHECK_NAME: ARM smoke tests - S390X_SMOKE_CHECK_NAME: S390x smoke tests - -jobs: - triage: - runs-on: ubuntu-latest - name: Comment evaluate - container: ghcr.io/kedacore/keda-tools:1.25.5 - outputs: - run-e2e: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} - pr_num: ${{ steps.parser.outputs.pr_num }} - image_tag: "pr-${{ steps.parser.outputs.pr_num }}-${{ steps.parser.outputs.commit_sha }}" - commit_sha: ${{ steps.parser.outputs.commit_sha }} - steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - - uses: tspascoal/get-user-teams-membership@57e9f42acd78f4d0f496b3be4368fc5f62696662 # v3.0.0 - id: checkUserMember - with: - username: ${{ github.actor }} - team: "keda-e2e-test-executors" - GITHUB_TOKEN: ${{ secrets.GH_CHECKING_USER_AUTH }} - - - name: Update comment with the execution url - if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4 - with: - comment-id: ${{ github.event.comment.id }} - body: | - **Update:** You can check the progress [here](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) - reactions: rocket - - - name: Add label to skip e2e test - if: ${{ startsWith(github.event.comment.body,'/skip-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - github-token: ${{ secrets.GH_AUTOMATION_PAT }} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ["skip-e2e"] - }) - - - name: Parse git info - if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }} - id: parser - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Get PR number - PR_URL="${{ github.event.issue.pull_request.url }}" - PR_NUM=${PR_URL##*/} - echo "Checking out from PR #$PR_NUM based on URL: $PR_URL" - echo "pr_num=$PR_NUM" >> $GITHUB_OUTPUT - # Get commit SHA - git config --global --add safe.directory "$GITHUB_WORKSPACE" - gh pr checkout $PR_NUM - SHA=$(git log -n 1 --pretty=format:"%H") - echo "commit_sha=$SHA" >> $GITHUB_OUTPUT - - build-test-images: - needs: triage - runs-on: ARM64 - name: Build images - container: ghcr.io/kedacore/keda-tools:1.25.5 - if: needs.triage.outputs.run-e2e == 'true' - steps: - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.E2E_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Checkout Pull Request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: checkout - run: | - gh pr checkout ${{ needs.triage.outputs.pr_num }} - git checkout ${{ needs.triage.outputs.commit_sha }} - - - name: Run regex checks - id: regex-validation - continue-on-error: true - env: - COMMENT_BODY: ${{ github.event.comment.body }} - run: | - MESSAGE="$COMMENT_BODY" - REGEX='/run-e2e (.+)' - if [[ "$MESSAGE" =~ $REGEX ]] - then - export E2E_TEST_REGEX="$(echo ${BASH_REMATCH[1]} | head -1)" - fi - make e2e-regex-check - - - name: React to comment with failure - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.regex-validation.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "-1" - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.regex-validation.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.E2E_CHECK_NAME }} - conclusion: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.regex-validation.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - status: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.regex-validation.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - status: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Exit on failure - if: steps.regex-validation.outcome != 'success' - run: exit 1 - - - name: Login to GitHub Container Registry - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GH_AUTOMATION_PAT }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - - - name: Publish on GitHub Container Registry - run: make publish-multiarch - env: - VERSION: ${{ needs.triage.outputs.image_tag }} - SUFFIX: "-test" - - run-e2e-test: - needs: [triage, build-test-images] - runs-on: e2e - name: Execute e2e tests - container: ghcr.io/kedacore/keda-tools:1.25.5 - if: needs.triage.outputs.run-e2e == 'true' - steps: - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.E2E_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Checkout Pull Request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: checkout - run: | - gh pr checkout ${{ needs.triage.outputs.pr_num }} - git checkout ${{ needs.triage.outputs.commit_sha }} - - - uses: oNaiPs/secrets-to-env-action@ec46a22bfc9b37e014b627b3208b07eb8909ea0f # v1.5 - with: - secrets: ${{ toJSON(secrets) }} - - - name: Scale cluster - run: make scale-node-pool - env: - NODE_POOL_SIZE: 3 - TEST_CLUSTER_NAME: keda-e2e-cluster-pr - - - name: Run end to end tests - continue-on-error: true - id: test - env: - AWS_RUN_IDENTITY_TESTS: true - AZURE_RUN_WORKLOAD_IDENTITY_TESTS: true - GCP_RUN_IDENTITY_TESTS: true - ENABLE_OPENTELEMETRY: true - VERSION: ${{ needs.triage.outputs.image_tag }} - SUFFIX: "-test" - TEST_CLUSTER_NAME: keda-e2e-cluster-pr - COMMENT_BODY: ${{ github.event.comment.body }} - run: | - MESSAGE="$COMMENT_BODY" - REGEX='/run-e2e (.+)' - if [[ "$MESSAGE" =~ $REGEX ]] - then - export E2E_TEST_REGEX="$(echo ${BASH_REMATCH[1]} | head -1)" - fi - echo "${{ needs.triage.outputs.pr_num }}" - make e2e-test - - - name: Delete all e2e related namespaces - if: ${{ always() }} - run: make e2e-test-clean - env: - TEST_CLUSTER_NAME: keda-e2e-cluster-pr - - - name: Scale cluster - if: ${{ always() }} - run: make scale-node-pool - env: - NODE_POOL_SIZE: 1 - TEST_CLUSTER_NAME: keda-e2e-cluster-pr - - - name: React to comment with success - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "+1" - - - name: Set status success - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.E2E_CHECK_NAME }} - conclusion: success - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: React to comment with failure - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "-1" - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.E2E_CHECK_NAME }} - conclusion: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Upload test logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: e2e-test-logs - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore - - run-arm-smoke-test: - needs: [triage, build-test-images] - runs-on: ARM64 - name: Execute ARM smoke tests - if: needs.triage.outputs.run-e2e == 'true' - steps: - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Setup Go - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version-file: "go.mod" - - - name: Install prerequisites - run: | - sudo apt update - sudo apt install curl make ca-certificates gcc libc-dev wget -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Create k8s ${{ inputs.kubernetesVersion }} Kind Cluster - uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0 - with: - node_image: kindest/node:v1.32.0@sha256:c48c62eac5da28cdadcf560d1d8616cfa6783b58f0d94cf63ad1bf49600cb027 - cluster_name: ${{ runner.name }} - - - name: Run smoke test - continue-on-error: true - run: make smoke-test - id: test - env: - VERSION: ${{ needs.triage.outputs.image_tag }} - SUFFIX: "-test" - - - name: React to comment with success - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "+1" - - - name: Set status success - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - conclusion: success - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: React to comment with failure - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "-1" - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.ARM_SMOKE_CHECK_NAME }} - conclusion: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Upload test logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: arm-smoke-test-logs - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore - - run-s390x-smoke-test: - needs: [triage, build-test-images] - runs-on: s390x - name: Execute s390x smoke tests - if: needs.triage.outputs.run-e2e == 'true' - steps: - - name: Set status in-progress - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - status: in_progress - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Setup Go - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version-file: "go.mod" - - - name: Install prerequisites - run: | - apt update - apt install curl make ca-certificates gcc libc-dev wget -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Install Kubernetes - run: | - go install sigs.k8s.io/kind@v0.29.0 - kind create cluster --name ${{ runner.name }} --image vishnubijukumar/kindest-node-s390x:v0.29.0 - kubectl -n kube-system set image daemonset/kindnet kindnet-cni=docker.io/vishnubijukumar/kindnetd:v20250512-s390x - kubectl -n local-path-storage set image deployment/local-path-provisioner local-path-provisioner=docker.io/vishnubijukumar/local-path-provisioner:v1 - - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/s390x/kubectl" - chmod +x kubectl - mkdir -p ~/.local/bin - mv ./kubectl ~/.local/bin/kubectl - kubectl version - - - name: Run smoke test - continue-on-error: true - run: make smoke-test - id: test - env: - VERSION: ${{ needs.triage.outputs.image_tag }} - SUFFIX: "-test" - - - name: React to comment with success - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "+1" - - - name: Set status success - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome == 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - conclusion: success - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: React to comment with failure - uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - commentId: ${{ github.event.comment.id }} - reaction: "-1" - - - name: Set status failure - uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2 - if: steps.test.outcome != 'success' - with: - token: ${{ secrets.GITHUB_TOKEN }} - sha: ${{ needs.triage.outputs.commit_sha }} - name: ${{ env.S390X_SMOKE_CHECK_NAME }} - conclusion: failure - details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/${{job.check_run_id}} - - - name: Remove Kubernetes - run: | - kind delete cluster --name ${{ runner.name }} - if: ${{ always() }} - env: - DEBIAN_FRONTEND: noninteractive - - - name: Upload test logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: s390x-smoke-test-logs - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore diff --git a/.github/workflows/pr-notify.yml b/.github/workflows/pr-notify.yml deleted file mode 100644 index d2e08e19a4c..00000000000 --- a/.github/workflows/pr-notify.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Auto Assign -on: - - pull_request_target - -jobs: - assign_reviewer: - runs-on: ubuntu-slim - steps: - - uses: shufo/auto-assign-reviewer-by-files@0a7fae44d02e841755d0caaac2ef05ad12a3bbc9 # v1.2.1 - with: - config: ".github/reviewers.yml" - token: ${{ secrets.GH_AUTOMATION_PAT }} diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml deleted file mode 100644 index d4e86a75d3c..00000000000 --- a/.github/workflows/release-build.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: release-build -on: - push: - tags: - - "v*" - -permissions: - contents: read - -jobs: - build: - name: Push Release - runs-on: ARM64 - permissions: - contents: write - packages: write - id-token: write # needed for signing the images with GitHub OIDC Token **not production ready** - - # keda-tools is built from github.com/test-tools/tools/Dockerfile - container: ghcr.io/kedacore/keda-tools:1.25.5 - steps: - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - id: go-paths - run: | - echo "mod_cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - echo "build_cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT - - - name: Go modules cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ steps.go-paths.outputs.mod_cache }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - - name: Go build cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ${{ steps.go-paths.outputs.build_cache }} - key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - - name: Go modules sync - run: go mod tidy -compat=1.25 - - - name: Login to GitHub Container Registry - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GH_AUTOMATION_PAT }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Get the version - id: get_version - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - - - name: Release Deployment YAML file - run: make release - env: - VERSION: ${{ steps.get_version.outputs.VERSION }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 - - - name: Publish KEDA images on GitHub Container Registry - run: make publish-multiarch - env: - VERSION: ${{ steps.get_version.outputs.VERSION }} - - # https://github.com/sigstore/cosign-installer - - name: Install Cosign - uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 - - - name: Check Cosign install! - run: cosign version - - - name: Sign KEDA images published on GitHub Container Registry - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: make sign-images - env: - VERSION: ${{ steps.get_version.outputs.VERSION }} - - # Add artifacts the release - - name: Upload Release artifacts - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 - with: - upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-${{ steps.get_version.outputs.VERSION }}.yaml - asset_path: keda-${{ steps.get_version.outputs.VERSION }}.yaml - asset_name: keda-${{ steps.get_version.outputs.VERSION }}.yaml - asset_content_type: application/x-yaml - - # Upload core deployment YAML file to GitHub release (TO BE DELETED FOR v2.12) - - name: Upload Deployment YAML file - id: upload-core-deployment-yaml - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-${{ steps.get_version.outputs.VERSION }}-core.yaml - asset_path: keda-${{ steps.get_version.outputs.VERSION }}-core.yaml - asset_name: keda-${{ steps.get_version.outputs.VERSION }}-core.yaml - asset_content_type: application/x-yaml - - # Upload CRD deployment YAML file to GitHub release - - name: Upload Deployment YAML file - id: upload-crd-deployment-yaml - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml - asset_path: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml - asset_name: keda-${{ steps.get_version.outputs.VERSION }}-crds.yaml - asset_content_type: application/x-yaml - - # Upload scalers schema YAML file to GitHub release - - name: Upload scalers schema YAML file - id: upload-scalers-schema-yaml - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-scalers-schema-${{ steps.get_version.outputs.VERSION }}.yaml - asset_path: schema/generated/scalers-metadata-schema-${{ steps.get_version.outputs.VERSION }}.yaml - asset_name: keda-scalers-schema-${{ steps.get_version.outputs.VERSION }}.yaml - asset_content_type: application/x-yaml - - # Upload scalers schema JSON file to GitHub release - - name: Upload scalers schema JSON file - id: upload-scalers-schema-json - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/kedacore/keda/releases/${{ steps.get-release-info.outputs.id }}/assets?name=keda-scalers-schema-${{ steps.get_version.outputs.VERSION }}.json - asset_path: schema/generated/scalers-metadata-schema-${{ steps.get_version.outputs.VERSION }}.json - asset_name: keda-scalers-schema-${{ steps.get_version.outputs.VERSION }}.json - asset_content_type: application/json diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml deleted file mode 100644 index 443e19d3f7b..00000000000 --- a/.github/workflows/scorecards.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: "38 12 * * 4" - push: - branches: ["main"] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read - - steps: - - name: "Checkout code" - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecard on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: true - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.pre.node20 - with: - name: SARIF file - path: results.sarif - retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard (optional). - # Commenting out will disable upload of results to your repo's Code Scanning dashboard - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - with: - sarif_file: results.sarif diff --git a/.github/workflows/static-analysis-codeql.yml b/.github/workflows/static-analysis-codeql.yml deleted file mode 100644 index 4bdf6ce4382..00000000000 --- a/.github/workflows/static-analysis-codeql.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: ["main"] - pull_request: {} - -permissions: - contents: read - security-events: write - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - codeQl: - name: Analyze CodeQL Go - runs-on: ubuntu-latest - container: ghcr.io/kedacore/keda-tools:1.25.5 - if: (github.actor != 'dependabot[bot]') - steps: - - name: Checkout repository - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Initialize CodeQL - uses: github/codeql-action/init@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - with: - languages: go - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - queries: +security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - with: - category: "/language:go" diff --git a/.github/workflows/static-analysis-semgrep.yml b/.github/workflows/static-analysis-semgrep.yml deleted file mode 100644 index 0d9a1a504da..00000000000 --- a/.github/workflows/static-analysis-semgrep.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "Semgrep" - -on: - push: - branches: ["main"] - pull_request_target: {} - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: read - security-events: write - -jobs: - semgrep: - name: Analyze Semgrep - runs-on: ubuntu-latest - container: returntocorp/semgrep - if: (github.actor != 'dependabot[bot]') - steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - name: Register workspace path - if: ${{ github.event.number > 0 }} - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Checkout Pull Request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: checkout - if: ${{ github.event.number > 0 }} - run: | - apk add github-cli - gh pr checkout ${{ github.event.number }} - - - run: semgrep ci --exclude=test --exclude=test --sarif --output=semgrep.sarif - env: - SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} - - - name: Upload SARIF file for GitHub Advanced Security Dashboard - uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - with: - sarif_file: semgrep.sarif - if: ${{ github.event.number == '' && !cancelled() }} diff --git a/.github/workflows/template-arm64-smoke-tests.yml b/.github/workflows/template-arm64-smoke-tests.yml deleted file mode 100644 index 3a39e929f3e..00000000000 --- a/.github/workflows/template-arm64-smoke-tests.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Reusable workflow to run smoke tests on ARM64 - -on: - workflow_call: - -jobs: - smoke-tests-ARM64: - name: ARM64 - concurrency: arm-smoke-tests - uses: kedacore/keda/.github/workflows/template-smoke-tests.yml@main - with: - runs-on: ARM64 - kubernetesVersion: v1.33 - kindImage: kindest/node:v1.33.1@sha256:050072256b9a903bd914c0b2866828150cb229cea0efe5892e2b644d5dd3b34f diff --git a/.github/workflows/template-main-e2e-test.yml b/.github/workflows/template-main-e2e-test.yml deleted file mode 100644 index 659723a7335..00000000000 --- a/.github/workflows/template-main-e2e-test.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Reusable workflow to run e2e tests on main branch - -on: - workflow_call: - -jobs: - e2e-tests: - name: Run e2e test - runs-on: ARM64 - # keda-tools is built from github.com/test-tools/tools/Dockerfile - container: ghcr.io/kedacore/keda-tools:1.25.5 - concurrency: e2e-tests - steps: - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Register workspace path - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - uses: oNaiPs/secrets-to-env-action@ec46a22bfc9b37e014b627b3208b07eb8909ea0f # v1.5 - with: - secrets: ${{ toJSON(secrets) }} - - - name: Scale cluster - run: make scale-node-pool - env: - NODE_POOL_SIZE: 3 - - - name: Run end to end tests - env: - AWS_RUN_IDENTITY_TESTS: true - AZURE_RUN_WORKLOAD_IDENTITY_TESTS: true - GCP_RUN_IDENTITY_TESTS: true - ENABLE_OPENTELEMETRY: true - run: make e2e-test - - - name: Delete all e2e related namespaces - if: ${{ always() }} - run: make e2e-test-clean - - - name: Scale cluster - if: ${{ always() }} - run: make scale-node-pool - env: - NODE_POOL_SIZE: 1 - - - name: Upload test logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - if: ${{ always() }} - with: - name: e2e-test-logs - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore diff --git a/.github/workflows/template-s390x-smoke-tests.yml b/.github/workflows/template-s390x-smoke-tests.yml deleted file mode 100644 index 60b10f3d8a0..00000000000 --- a/.github/workflows/template-s390x-smoke-tests.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Reusable workflow to run smoke tests on s390x - -on: - workflow_call: - -jobs: - smoke-tests-s390x: - name: Validate k8s - runs-on: s390x - steps: - - name: Setup Go - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version-file: "go.mod" - - - name: Install prerequisites - run: | - apt update - apt install curl make ca-certificates gcc libc-dev wget -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Install Kubernetes - run: | - go install sigs.k8s.io/kind@v0.29.0 - kind create cluster --name ${{ runner.name }} --image vishnubijukumar/kindest-node-s390x:v0.29.0 - kubectl -n kube-system set image daemonset/kindnet kindnet-cni=docker.io/vishnubijukumar/kindnetd:v20250512-s390x - kubectl -n local-path-storage set image deployment/local-path-provisioner local-path-provisioner=docker.io/vishnubijukumar/local-path-provisioner:v1 - - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/s390x/kubectl" - chmod +x kubectl - mkdir -p ~/.local/bin - mv ./kubectl ~/.local/bin/kubectl - kubectl version - - - name: Run smoke test - run: make smoke-test - - - name: Upload test logs - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4 - if: ${{ always() }} - with: - name: smoke-test-logs ${{ inputs.runs-on }}-${{ inputs.kubernetesVersion }} - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore - - - name: Remove Kubernetes - run: | - kind delete cluster --name ${{ runner.name }} - if: ${{ always() }} - env: - DEBIAN_FRONTEND: noninteractive diff --git a/.github/workflows/template-smoke-tests.yml b/.github/workflows/template-smoke-tests.yml deleted file mode 100644 index 565de92a26f..00000000000 --- a/.github/workflows/template-smoke-tests.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Reusable workflow to run smoke tests - -on: - workflow_call: - inputs: - runs-on: - required: true - type: string - kubernetesVersion: - required: true - type: string - kindImage: - required: true - type: string - -jobs: - smoke-tests: - name: Validate k8s-${{ inputs.kubernetesVersion }} - runs-on: ${{ inputs.runs-on }} - steps: - - name: Setup Go - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version-file: "go.mod" - - - name: Install prerequisites - run: | - sudo apt update - sudo apt install curl make ca-certificates gcc libc-dev wget -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Create k8s ${{ inputs.kubernetesVersion }} Kind Cluster - uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0 - with: - node_image: ${{ inputs.kindImage }} - cluster_name: smoke-tests-cluster-${{ inputs.kubernetesVersion }} - - - name: Run smoke test - run: make smoke-test - - - name: Upload test logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - if: ${{ always() }} - with: - name: smoke-test-logs ${{ inputs.runs-on }}-${{ inputs.kubernetesVersion }} - path: "${{ github.workspace }}/**/*.log" - if-no-files-found: ignore diff --git a/.github/workflows/template-trivy-scan.yml b/.github/workflows/template-trivy-scan.yml deleted file mode 100644 index 60b5ce79ea8..00000000000 --- a/.github/workflows/template-trivy-scan.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Reusable workflow to run trivy scan - -on: - workflow_call: - inputs: - runs-on: - required: true - type: string - scan-type: - required: true - type: string - format: - required: true - type: string - output: - required: false - type: string - default: trivy.sarif - image-ref: - required: false - type: string - default: "" - severity: - required: false - type: string - default: "CRITICAL,HIGH" - exit-code: - required: true - type: number - publish: - required: true - type: boolean - -jobs: - trivy-scan: - name: Trivy - ${{ inputs.runs-on }} - ${{ inputs.scan-type }} ${{ inputs.image-ref }} - runs-on: ${{ inputs.runs-on }} - steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - - name: Run Trivy - uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 - env: - TRIVY_DB_REPOSITORY: ghcr.io/kedacore/trivy-db - with: - scan-type: ${{ inputs.scan-type }} - image-ref: ${{ inputs.image-ref }} - ignore-unfixed: false - format: ${{ inputs.format }} - output: ${{ inputs.output }} - exit-code: ${{ inputs.exit-code }} - severity: ${{ inputs.severity }} - trivy-config: trivy.yml - - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - if: ${{ inputs.publish }} - with: - sarif_file: ${{ inputs.output }} diff --git a/.github/workflows/template-versions-smoke-tests.yml b/.github/workflows/template-versions-smoke-tests.yml deleted file mode 100644 index 684288572eb..00000000000 --- a/.github/workflows/template-versions-smoke-tests.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Reusable workflow to run smoke tests on different k8s versions - -on: - workflow_call: - -jobs: - smoke-tests: - name: ubuntu-latest - strategy: - fail-fast: false - matrix: - kubernetesVersion: [v1.33, v1.32, v1.31] - include: - - kubernetesVersion: v1.33 - kindImage: kindest/node:v1.33.1@sha256:050072256b9a903bd914c0b2866828150cb229cea0efe5892e2b644d5dd3b34f - - kubernetesVersion: v1.32 - kindImage: kindest/node:v1.32.5@sha256:e3b2327e3a5ab8c76f5ece68936e4cafaa82edf58486b769727ab0b3b97a5b0d - - kubernetesVersion: v1.31 - kindImage: kindest/node:v1.31.9@sha256:b94a3a6c06198d17f59cca8c6f486236fa05e2fb359cbd75dabbfc348a10b211 - uses: kedacore/keda/.github/workflows/template-smoke-tests.yml@main - with: - runs-on: ubuntu-latest - kubernetesVersion: ${{ matrix.kubernetesVersion }} - kindImage: ${{ matrix.kindImage }} diff --git a/.github/workflows/v1-build.yml b/.github/workflows/v1-build.yml deleted file mode 100644 index 89c1c88d5a7..00000000000 --- a/.github/workflows/v1-build.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: v1-build -on: - push: - branches: - - v1 - -permissions: - contents: read - -jobs: - validate: - name: Validate - runs-on: ubuntu-latest - container: kedacore/build-tools:v1 - steps: - - name: Check out code - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 1 - - - name: Go modules cache - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: /go/pkg - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Test - run: make test - - - name: Login to Docker Hub - env: - DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} - run: echo $DOCKER_HUB_ACCESS_TOKEN | docker login -u $DOCKER_HUB_USERNAME --password-stdin - - - name: Publish - run: make publish - - - name: Run end to end tests - env: - TF_AZURE_SUBSCRIPTION: ${{ secrets.TF_AZURE_SUBSCRIPTION }} - TF_AZURE_RESOURCE_GROUP: ${{ secrets.TF_AZURE_RESOURCE_GROUP }} - TF_AZURE_SP_APP_ID: ${{ secrets.TF_AZURE_SP_APP_ID }} - AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} - TF_AZURE_SP_TENANT: ${{ secrets.TF_AZURE_SP_TENANT }} - TF_AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.TF_AZURE_STORAGE_CONNECTION_STRING }} - TF_AZURE_LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.TF_AZURE_LOG_ANALYTICS_WORKSPACE_ID }} - run: make e2e-test diff --git a/pkg/scalers/temporal_scaler.go b/pkg/scalers/temporal_scaler.go index 689cc97964e..99426c29d7b 100644 --- a/pkg/scalers/temporal_scaler.go +++ b/pkg/scalers/temporal_scaler.go @@ -5,9 +5,11 @@ import ( "crypto/tls" "fmt" "log/slog" + "strings" "time" "github.com/go-logr/logr" + workflowservice "go.temporal.io/api/workflowservice/v1" sdk "go.temporal.io/sdk/client" sdklog "go.temporal.io/sdk/log" "google.golang.org/grpc" @@ -35,17 +37,19 @@ type temporalScaler struct { } type temporalMetadata struct { - Endpoint string `keda:"name=endpoint, order=triggerMetadata;resolvedEnv"` - Namespace string `keda:"name=namespace, order=triggerMetadata;resolvedEnv, default=default"` - ActivationTargetQueueSize int64 `keda:"name=activationTargetQueueSize, order=triggerMetadata, default=0"` - TargetQueueSize int64 `keda:"name=targetQueueSize, order=triggerMetadata, default=5"` - TaskQueue string `keda:"name=taskQueue, order=triggerMetadata;resolvedEnv"` - QueueTypes []string `keda:"name=queueTypes, order=triggerMetadata, optional"` - BuildID string `keda:"name=buildId, order=triggerMetadata;resolvedEnv, optional"` - AllActive bool `keda:"name=selectAllActive, order=triggerMetadata, default=false"` - Unversioned bool `keda:"name=selectUnversioned, order=triggerMetadata, default=false"` - APIKey string `keda:"name=apiKey, order=authParams;resolvedEnv, optional"` - MinConnectTimeout int `keda:"name=minConnectTimeout, order=triggerMetadata, default=5"` + Endpoint string `keda:"name=endpoint, order=triggerMetadata;resolvedEnv"` + Namespace string `keda:"name=namespace, order=triggerMetadata;resolvedEnv, default=default"` + ActivationTargetQueueSize int64 `keda:"name=activationTargetQueueSize, order=triggerMetadata, default=0"` + TargetQueueSize int64 `keda:"name=targetQueueSize, order=triggerMetadata, default=5"` + TaskQueue string `keda:"name=taskQueue, order=triggerMetadata;resolvedEnv"` + QueueTypes []string `keda:"name=queueTypes, order=triggerMetadata, optional"` + BuildID string `keda:"name=buildId, order=triggerMetadata;resolvedEnv, optional"` + AllActive bool `keda:"name=selectAllActive, order=triggerMetadata, default=false"` + Unversioned bool `keda:"name=selectUnversioned, order=triggerMetadata, default=false"` + IncludeRunningWorkflowCount bool `keda:"name=includeRunningWorkflowCount, order=triggerMetadata, default=true"` + WorkflowTaskQueueForCount string `keda:"name=workflowTaskQueueForCount, order=triggerMetadata;resolvedEnv, optional"` + APIKey string `keda:"name=apiKey, order=authParams;resolvedEnv, optional"` + MinConnectTimeout int `keda:"name=minConnectTimeout, order=triggerMetadata, default=5"` UnsafeSsl bool `keda:"name=unsafeSsl, order=triggerMetadata, optional"` Cert string `keda:"name=cert, order=authParams, optional"` @@ -159,7 +163,42 @@ func (s *temporalScaler) getQueueSize(ctx context.Context) (int64, error) { return 0, fmt.Errorf("failed to get Temporal queue size: %w", err) } - return getCombinedBacklogCount(resp), nil + backlog := getCombinedBacklogCount(resp) + + if !s.metadata.IncludeRunningWorkflowCount { + return backlog, nil + } + + runningCount, err := s.getRunningWorkflowCount(ctx) + if err != nil { + s.logger.V(1).Info("failed to get running workflow count, using backlog only", "error", err) + return backlog, nil + } + + return backlog + runningCount, nil +} + +// getRunningWorkflowCount returns the approximate number of running workflow executions +// for the task queue (or workflowTaskQueueForCount if set). Used to avoid premature +// scale-down when workers are fast and backlog is often zero. +func (s *temporalScaler) getRunningWorkflowCount(ctx context.Context) (int64, error) { + taskQueue := s.metadata.WorkflowTaskQueueForCount + if taskQueue == "" { + taskQueue = s.metadata.TaskQueue + } + // Escape single quotes in task queue name for visibility query + escaped := strings.ReplaceAll(taskQueue, "'", "''") + query := fmt.Sprintf("ExecutionStatus = 'Running' AND TaskQueue = '%s'", escaped) + + req := &workflowservice.CountWorkflowExecutionsRequest{ + Namespace: s.metadata.Namespace, + Query: query, + } + resp, err := s.tcl.CountWorkflow(ctx, req) + if err != nil { + return 0, fmt.Errorf("count workflow: %w", err) + } + return resp.GetCount(), nil } func getQueueTypes(queueTypes []string) []sdk.TaskQueueType { diff --git a/pkg/scalers/temporal_scaler_test.go b/pkg/scalers/temporal_scaler_test.go index 149322ef27d..85a533c41a3 100644 --- a/pkg/scalers/temporal_scaler_test.go +++ b/pkg/scalers/temporal_scaler_test.go @@ -103,14 +103,15 @@ func TestParseTemporalMetadata(t *testing.T) { "namespace": "default", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + MinConnectTimeout: 5, }, wantErr: true, }, @@ -121,14 +122,15 @@ func TestParseTemporalMetadata(t *testing.T) { "taskQueue": "testxx", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + MinConnectTimeout: 5, }, wantErr: false, }, @@ -141,14 +143,15 @@ func TestParseTemporalMetadata(t *testing.T) { "activationTargetQueueSize": "12", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 12, - AllActive: false, - Unversioned: false, - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 12, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + MinConnectTimeout: 5, }, wantErr: false, }, @@ -160,15 +163,16 @@ func TestParseTemporalMetadata(t *testing.T) { "taskQueue": "testxx", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - APIKey: "test01", - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + APIKey: "test01", + MinConnectTimeout: 5, }, authParams: map[string]string{ "apiKey": "test01", @@ -184,15 +188,16 @@ func TestParseTemporalMetadata(t *testing.T) { "queueTypes": "workflow,activity", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - QueueTypes: []string{"workflow", "activity"}, - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + QueueTypes: []string{"workflow", "activity"}, + MinConnectTimeout: 5, }, wantErr: false, }, @@ -209,15 +214,16 @@ func TestParseTemporalMetadata(t *testing.T) { "taskQueueFromEnv": "taskQueue", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - APIKey: "test01", - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + APIKey: "test01", + MinConnectTimeout: 5, }, authParams: map[string]string{ "apiKey": "test01", @@ -233,15 +239,16 @@ func TestParseTemporalMetadata(t *testing.T) { "apiKey": "test-api-key", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - APIKey: "test-api-key", - MinConnectTimeout: 5, + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + APIKey: "test-api-key", + MinConnectTimeout: 5, }, authParams: map[string]string{ "apiKey": "test-api-key", @@ -257,15 +264,16 @@ func TestParseTemporalMetadata(t *testing.T) { "tlsServerName": "my-namespace.tmpr.cloud", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - MinConnectTimeout: 5, - TLSServerName: "my-namespace.tmpr.cloud", + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + MinConnectTimeout: 5, + TLSServerName: "my-namespace.tmpr.cloud", }, wantErr: false, }, @@ -281,16 +289,17 @@ func TestParseTemporalMetadata(t *testing.T) { "apiKey": "test01", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - APIKey: "test01", - MinConnectTimeout: 5, - TLSServerName: "my-namespace.tmpr.cloud", + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + APIKey: "test01", + MinConnectTimeout: 5, + TLSServerName: "my-namespace.tmpr.cloud", }, wantErr: false, }, @@ -309,19 +318,63 @@ func TestParseTemporalMetadata(t *testing.T) { "ca": "ca-data", }, wantMeta: &temporalMetadata{ - Endpoint: "test:7233", - Namespace: "default", - TaskQueue: "testxx", - TargetQueueSize: 5, - ActivationTargetQueueSize: 0, - AllActive: false, - Unversioned: false, - Cert: "cert-data", - Key: "key-data", - KeyPassword: "password", - CA: "ca-data", - MinConnectTimeout: 5, - TLSServerName: "my-namespace.tmpr.cloud", + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + Cert: "cert-data", + Key: "key-data", + KeyPassword: "password", + CA: "ca-data", + MinConnectTimeout: 5, + TLSServerName: "my-namespace.tmpr.cloud", + }, + wantErr: false, + }, + { + name: "includeRunningWorkflowCount disabled", + metadata: map[string]string{ + "endpoint": "test:7233", + "namespace": "default", + "taskQueue": "testxx", + "includeRunningWorkflowCount": "false", + }, + wantMeta: &temporalMetadata{ + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "testxx", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: false, + MinConnectTimeout: 5, + }, + wantErr: false, + }, + { + name: "workflowTaskQueueForCount set", + metadata: map[string]string{ + "endpoint": "test:7233", + "namespace": "default", + "taskQueue": "activity-queue", + "workflowTaskQueueForCount": "workflow-queue", + }, + wantMeta: &temporalMetadata{ + Endpoint: "test:7233", + Namespace: "default", + TaskQueue: "activity-queue", + TargetQueueSize: 5, + ActivationTargetQueueSize: 0, + AllActive: false, + Unversioned: false, + IncludeRunningWorkflowCount: true, + WorkflowTaskQueueForCount: "workflow-queue", + MinConnectTimeout: 5, }, wantErr: false, },