Skip to content

Commit

Permalink
feat: send CI status to cloud
Browse files Browse the repository at this point in the history
If the test is running in CI, set isCI true and send the name of
the CI service to Artillery Cloud as part of test's metadata.

This will be shown in reports and available as a property to
filter & search on too.
  • Loading branch information
hassy committed Oct 3, 2024
1 parent e52b310 commit 7d552d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
17 changes: 16 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion packages/artillery/lib/platform/cloud/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const util = require('node:util');
const chokidar = require('chokidar');
const fs = require('fs');
const path = require('path');
const { isCI, name: ciName } = require('ci-info');

class ArtilleryCloudPlugin {
constructor(_script, _events, { flags }) {
this.enabled = false;
Expand Down Expand Up @@ -59,8 +61,13 @@ class ArtilleryCloudPlugin {

this.getLoadTestEndpoint = `${this.baseUrl}/api/load-tests/${this.testRunId}/status`;

const metadata = Object.assign({}, testInfo.metadata, {
isCI,
ciName
});

await this._event('testrun:init', {
metadata: testInfo.metadata
metadata: metadata
});
this.setGetLoadTestInterval = this.setGetStatusInterval();

Expand Down
2 changes: 1 addition & 1 deletion packages/artillery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"aws-sdk": "^2.1338.0",
"chalk": "^2.4.2",
"chokidar": "^3.6.0",
"ci-info": "^3.8.0",
"ci-info": "^4.0.0",
"cli-table3": "^0.6.0",
"cross-spawn": "^7.0.3",
"csv-parse": "^4.16.3",
Expand Down

0 comments on commit 7d552d8

Please sign in to comment.