From 8b9d1c3d1f8aae77db13f73b34e01a020c4d75e5 Mon Sep 17 00:00:00 2001 From: Vio Date: Mon, 9 Mar 2020 08:56:54 +0100 Subject: [PATCH] fix: Use RELATIVE_CI_SLUG env var --- locales/en.js | 4 ++-- src/agent.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/locales/en.js b/locales/en.js index 6e422af7..9d75a923 100644 --- a/locales/en.js +++ b/locales/en.js @@ -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}`; diff --git a/src/agent.js b/src/agent.js index a0e92190..69d77d58 100644 --- a/src/agent.js +++ b/src/agent.js @@ -26,6 +26,13 @@ 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, @@ -33,6 +40,7 @@ export const agent = (artifactsData, config, logger = console) => { ...envCIVars, branch: envCIVars.branch || envCIVars.prBranch, + slug, ...includeCommitMessage ? { commitMessage: getCommitMessage(),