Skip to content

Commit

Permalink
fix: Use RELATIVE_CI_SLUG env var
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Mar 9, 2020
1 parent cf77a50 commit 8b9d1c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports.CLI_MISSING_CONFIGURATION_ERROR = `${ERROR_PREFIX} relative-ci.co
module.exports.CLI_INVALID_CONFIGURATION_ERROR = `${ERROR_PREFIX} The path to your webpack stats file is missing! ${SETUP_INFO}`;
module.exports.CLI_MISSING_STATS_FILE_ERROR = `${ERROR_PREFIX} The webpack stats file does not exists! ${SETUP_INFO}`;

module.exports.AGENT_MISSING_KEY_ERROR = `${ERROR_PREFIX} "key" environment variable is missing, make sure the agent is setup correctly! ${SETUP_INFO}`;
module.exports.AGENT_MISSING_SLUG_ERROR = `${ERROR_PREFIX} "slug" environment variable is missing, make sure the agent is setup correctly! ${SETUP_INFO}`;
module.exports.AGENT_MISSING_KEY_ERROR = `${ERROR_PREFIX} "key" parameter is missing, make sure to set RELATIVE_CI_KEY environment variable! ${SETUP_INFO}`;
module.exports.AGENT_MISSING_SLUG_ERROR = `${ERROR_PREFIX} "slug" parameter is missing, make sure to set RELATIVE_CI_SLUG environment variable (RELATIVE_CI_SLUG=organization-a/project-a) if you are not using a supported CI service! ${SETUP_INFO}`;
module.exports.AGENT_MISSING_COMMIT_ERROR = `${ERROR_PREFIX} "commit" environment variable is missing, make sure the agent is setup correctly! ${SETUP_INFO}`;
module.exports.AGENT_MISSING_BRANCH_ERROR = `${ERROR_PREFIX} "branch" environment variable is missing, make sure the agent is setup correctly! ${SETUP_INFO}`;
8 changes: 8 additions & 0 deletions src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ export const agent = (artifactsData, config, logger = console) => {

const { includeCommitMessage } = config;

let slug = process.env.RELATIVE_CI_SLUG;

if (!slug) {
debug('RELATIVE_CI_SLUG not available, using env-ci');
slug = envCIVars.slug;
}

const params = {
key: process.env.RELATIVE_CI_KEY,
endpoint: process.env.RELATIVE_CI_ENDPOINT || DEFAULT_ENDPOINT,
agentVersion: pck.version,

...envCIVars,
branch: envCIVars.branch || envCIVars.prBranch,
slug,

...includeCommitMessage ? {
commitMessage: getCommitMessage(),
Expand Down

0 comments on commit 8b9d1c3

Please sign in to comment.