From 3be4a7f90ae5e013f5482d6afd9e482d131ea7c9 Mon Sep 17 00:00:00 2001 From: Bernardo Guerreiro Date: Fri, 12 Jan 2024 12:32:56 +0000 Subject: [PATCH] ci(test): add tag with commit sha to ci tests --- .github/workflows/examples.yml | 2 +- .github/workflows/run-aws-tests.yml | 3 ++- packages/artillery/test/cli/_helpers.js | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index af3fba9dac..f2c28d3c9d 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -8,7 +8,7 @@ on: env: ARTILLERY_BINARY_PATH: ${{ github.workspace }}/packages/artillery/bin/run - CLI_TAGS: repo:${{ github.repository }},actor:${{ github.actor }},type:smoke,ci:true + CLI_TAGS: repo:${{ github.repository }},actor:${{ github.actor }},type:smoke,ci:true,commit:${{ github.sha }} CLI_NOTE: Running from the Official Artillery Github Action! ðŸ˜€ jobs: diff --git a/.github/workflows/run-aws-tests.yml b/.github/workflows/run-aws-tests.yml index 4a049aef9f..743a5db9ce 100644 --- a/.github/workflows/run-aws-tests.yml +++ b/.github/workflows/run-aws-tests.yml @@ -72,4 +72,5 @@ jobs: ARTILLERY_CLOUD_ENDPOINT: ${{ secrets.ARTILLERY_CLOUD_ENDPOINT_TEST }} ARTILLERY_CLOUD_API_KEY: ${{ secrets.ARTILLERY_CLOUD_API_KEY_TEST }} GITHUB_REPO: ${{ github.repository }} - GITHUB_ACTOR: ${{ github.actor }} \ No newline at end of file + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_SHA: ${{ github.sha }} \ No newline at end of file diff --git a/packages/artillery/test/cli/_helpers.js b/packages/artillery/test/cli/_helpers.js index 7c63fb6f80..9b428151bb 100644 --- a/packages/artillery/test/cli/_helpers.js +++ b/packages/artillery/test/cli/_helpers.js @@ -34,8 +34,13 @@ function getTestTags(additionalTags) { const actorTag = `actor:${process.env.GITHUB_ACTOR || 'localhost'}`; const repoTag = `repo:${process.env.GITHUB_REPO || 'artilleryio/artillery'}`; const ciTag = `ci:${process.env.GITHUB_ACTIONS ? 'true' : 'false'}`; + const baseTags = [repoTag, actorTag, ciTag]; - return `${repoTag},${actorTag},${ciTag},${additionalTags.join(',')}`; + if (process.env.GITHUB_SHA) { + baseTags.push(`commit:${process.env.GITHUB_SHA}`); + } + + return `${[...baseTags, ...additionalTags].join(',')}`; } module.exports = {