Skip to content

Commit

Permalink
feat: send GHA job URL to cloud for tests running on GHA (#3366)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy authored Oct 11, 2024
1 parent 007b1ff commit 3e204c3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/artillery/lib/platform/cloud/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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', {
Expand Down

0 comments on commit 3e204c3

Please sign in to comment.