Skip to content

Commit

Permalink
refactor: Update debug entries
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Feb 1, 2024
1 parent f89f16f commit 1c06046
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const agent = (artifactsData, config, args = {}, logger = console) => {

const envVars = getEnvVars();

// Normalized env vars - merge provided args with env vars
// Normalized params - merge provided args with env vars
// @type {EnvVars}
const normalizedEnvVars = {
const normalizedParams = {
slug: args.slug || envVars.slug,
branch: args.branch || envVars.branch,
pr: args.pr || envVars.pr,
Expand All @@ -54,23 +54,23 @@ export const agent = (artifactsData, config, args = {}, logger = console) => {
endpoint: envVars.endpoint,
};

debug('normalized env vars ', maskObjectProperties(normalizedEnvVars, ['key']));
debug('normalized parameters - agent configuration with environmental variables fallback', maskObjectProperties(normalizedParams, ['key']));

const { includeCommitMessage } = config;

const params = {
agentVersion: packageInfo.version,

...normalizedEnvVars,
...normalizedParams,

// Get commit message using git if includeCommitMessage is set and
// there is no --commit-message argument or RELATIVE_CI_COMMIT_MESSAGE
...includeCommitMessage && !normalizedEnvVars.commitMessage && {
...includeCommitMessage && !normalizedParams.commitMessage && {
commitMessage: getCommitMessage(),
},
};

debug('Job parameters', maskObjectProperties(params, ['key']));
debug('job parameters', maskObjectProperties(params, ['key']));

// Validate parameters
if (!params.key) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function getEnvVars() {
commit: process.env.RELATIVE_CI_COMMIT,
commitMessage: process.env.RELATIVE_CI_COMMIT_MESSAGE,
};
debug('custom environment variables', maskObjectProperties(customEnvVars, ['key']));
debug('RELATIVE_CI environment variables', maskObjectProperties(customEnvVars, ['key']));

const resolvedEnvVars = {
key: customEnvVars.key,
Expand All @@ -140,7 +140,7 @@ export function getEnvVars() {
commit: customEnvVars.commit || envCIvars.commit,
commitMessage: customEnvVars.commitMessage,
};
debug('resolved environment variables', maskObjectProperties(envCIvars, ['key']));
debug('resolved environment variables', maskObjectProperties(resolvedEnvVars, ['key']));

return resolvedEnvVars;
}

0 comments on commit 1c06046

Please sign in to comment.