From 3e204c399398424cc41ace5f4e811a9787b7b9be Mon Sep 17 00:00:00 2001 From: Hassy Veldstra Date: Fri, 11 Oct 2024 10:42:17 +0100 Subject: [PATCH] feat: send GHA job URL to cloud for tests running on GHA (#3366) --- packages/artillery/lib/platform/cloud/cloud.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/artillery/lib/platform/cloud/cloud.js b/packages/artillery/lib/platform/cloud/cloud.js index 3031f731d3..f8a06dc67f 100644 --- a/packages/artillery/lib/platform/cloud/cloud.js +++ b/packages/artillery/lib/platform/cloud/cloud.js @@ -12,7 +12,7 @@ const util = require('node:util'); const chokidar = require('chokidar'); const fs = require('fs'); const path = require('path'); -const { isCI, name: ciName } = require('ci-info'); +const { isCI, name: ciName, GITHUB_ACTIONS } = require('ci-info'); class ArtilleryCloudPlugin { constructor(_script, _events, { flags }) { @@ -61,9 +61,19 @@ class ArtilleryCloudPlugin { this.getLoadTestEndpoint = `${this.baseUrl}/api/load-tests/${this.testRunId}/status`; + let ciURL = null; + if (isCI && GITHUB_ACTIONS) { + const { GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID } = + process.env; + if (GITHUB_SERVER_URL && GITHUB_REPOSITORY && GITHUB_RUN_ID) { + ciURL = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`; + } + } + const metadata = Object.assign({}, testInfo.metadata, { isCI, - ciName + ciName, + ciURL }); await this._event('testrun:init', {