Skip to content

Commit

Permalink
Addressed #136
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceMcCarthy committed Aug 23, 2024
1 parent 64a6783 commit 5cbf9de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ exports.run = run;
if (require.main === module) {
try {
core.debug('Starting main run');
core.info(`Note: Any AWS SDK warnings come from the Akeyless dependencies. Once they're addressed, this action will automatically inherit those fixes in the next update.`);
run();
} catch (error) {
core.debug(error.stack);
Expand Down
12 changes: 12 additions & 0 deletions src/secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ async function exportDynamicSecrets(akeylessToken, dynamicSecrets, apiUrl, expor
const api = akeylessApi.api(apiUrl);

for (const [akeylessPath, variableName] of Object.entries(dynamicSecrets)) {
core.info(`Requesting ${akeylessPath}...`);

try {
const param = akeyless.GetDynamicSecretValue.constructFromObject({
token: akeylessToken,
Expand All @@ -18,6 +20,8 @@ async function exportDynamicSecrets(akeylessToken, dynamicSecrets, apiUrl, expor
});

if (dynamicSecret === null || dynamicSecret === undefined) {
core.info(`Could not fetch ${akeylessPath}. Skipping...`);
core.notice(`Notice: ${akeylessPath} was not found in Akeyless. Skipped.`);
return;
}

Expand Down Expand Up @@ -86,6 +90,8 @@ async function exportDynamicSecrets(akeylessToken, dynamicSecrets, apiUrl, expor
// core.info(`Property ${key} is from prototype chain. contact developer to shate special dynamic secret situation.`);
// }
}

core.info(`Successfully exported ${akeylessPath} to ${variableName}.`);
}
} catch (error) {
core.error(`Failed to export dynamic secrets: ${JSON.stringify(error)}`);
Expand All @@ -98,6 +104,8 @@ async function exportStaticSecrets(akeylessToken, staticSecrets, apiUrl, exportS
const api = akeylessApi.api(apiUrl);

for (const [akeylessPath, variableName] of Object.entries(staticSecrets)) {
core.info(`Requesting ${akeylessPath}...`);

const name = akeylessPath;

const param = akeyless.GetSecretValue.constructFromObject({
Expand All @@ -111,6 +119,8 @@ async function exportStaticSecrets(akeylessToken, staticSecrets, apiUrl, exportS
});

if (staticSecret === undefined) {
core.info(`Could not fetch ${akeylessPath}. Skipping...`);
core.notice(`Notice: ${akeylessPath} was not found in Akeyless. Skipped.`);
return;
}

Expand All @@ -127,6 +137,8 @@ async function exportStaticSecrets(akeylessToken, staticSecrets, apiUrl, exportS
if (exportSecretsToEnvironment) {
core.exportVariable(variableName, secretValue);
}

core.info(`Successfully exported ${akeylessPath} to ${variableName}.`);
}
}

Expand Down

0 comments on commit 5cbf9de

Please sign in to comment.