mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-04 06:15:07 +09:00
chore: Update dist
This commit is contained in:
+52
-46
@@ -71149,7 +71149,7 @@ function verifyKeys(creds) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
async function retryAndBackoff(fn, isRetryable, maxRetries = 12, retries = 0, base = 50) {
|
async function retryAndBackoff(fn, isRetryable, maxRetries = 12, retries = 0, base = 50, label) {
|
||||||
try {
|
try {
|
||||||
return await fn();
|
return await fn();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -71159,15 +71159,16 @@ async function retryAndBackoff(fn, isRetryable, maxRetries = 12, retries = 0, ba
|
|||||||
}
|
}
|
||||||
const delay = Math.random() * (2 ** retries * base);
|
const delay = Math.random() * (2 ** retries * base);
|
||||||
const nextRetry = retries + 1;
|
const nextRetry = retries + 1;
|
||||||
debug(
|
const opName = label ? ` ${label}` : "";
|
||||||
`retryAndBackoff: attempt ${nextRetry} of ${maxRetries} failed: ${errorMessage(err)}. Retrying after ${Math.floor(delay)}ms.`
|
info(
|
||||||
|
`Retry${opName}: attempt ${nextRetry} of ${maxRetries} failed: ${errorMessage(err)}. Retrying after ${Math.floor(delay)}ms.`
|
||||||
);
|
);
|
||||||
await sleep(delay);
|
await sleep(delay);
|
||||||
if (nextRetry >= maxRetries) {
|
if (nextRetry >= maxRetries) {
|
||||||
debug("retryAndBackoff: reached max retries; giving up.");
|
info(`Retry${opName}: reached max retries (${maxRetries}); giving up.`);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
return await retryAndBackoff(fn, isRetryable, maxRetries, nextRetry, base);
|
return await retryAndBackoff(fn, isRetryable, maxRetries, nextRetry, base, label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function errorMessage(error3) {
|
function errorMessage(error3) {
|
||||||
@@ -72861,6 +72862,7 @@ async function run() {
|
|||||||
} else if (maxRetries < 1) {
|
} else if (maxRetries < 1) {
|
||||||
maxRetries = 1;
|
maxRetries = 1;
|
||||||
}
|
}
|
||||||
|
const withRetry = (fn, label) => retryAndBackoff(fn, !disableRetry, maxRetries, 0, 50, label);
|
||||||
const useGitHubOIDCProvider = () => {
|
const useGitHubOIDCProvider = () => {
|
||||||
if (forceSkipOidc) return false;
|
if (forceSkipOidc) return false;
|
||||||
if (!!roleToAssume && !webIdentityTokenFile && !AccessKeyId && !process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && !roleChaining) {
|
if (!!roleToAssume && !webIdentityTokenFile && !AccessKeyId && !process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && !roleChaining) {
|
||||||
@@ -72898,13 +72900,9 @@ async function run() {
|
|||||||
}
|
}
|
||||||
if (useGitHubOIDCProvider()) {
|
if (useGitHubOIDCProvider()) {
|
||||||
try {
|
try {
|
||||||
webIdentityToken = await retryAndBackoff(
|
webIdentityToken = await withRetry(async () => {
|
||||||
async () => {
|
return getIDToken(audience);
|
||||||
return getIDToken(audience);
|
}, "getIDToken");
|
||||||
},
|
|
||||||
!disableRetry,
|
|
||||||
maxRetries
|
|
||||||
);
|
|
||||||
} catch (error3) {
|
} catch (error3) {
|
||||||
throw new Error(`getIDToken call failed: ${errorMessage(error3)}`);
|
throw new Error(`getIDToken call failed: ${errorMessage(error3)}`);
|
||||||
}
|
}
|
||||||
@@ -72917,12 +72915,18 @@ async function run() {
|
|||||||
writeProfileFiles(awsProfile, { AccessKeyId, SecretAccessKey, SessionToken }, region, overwriteAwsProfile);
|
writeProfileFiles(awsProfile, { AccessKeyId, SecretAccessKey, SessionToken }, region, overwriteAwsProfile);
|
||||||
}
|
}
|
||||||
} else if (!webIdentityTokenFile && !roleChaining) {
|
} else if (!webIdentityTokenFile && !roleChaining) {
|
||||||
await credentialsClient.validateCredentials(void 0, roleChaining, expectedAccountIds);
|
await withRetry(
|
||||||
sourceAccountId = await exportAccountId(credentialsClient, maskAccountId);
|
() => credentialsClient.validateCredentials(void 0, roleChaining, expectedAccountIds),
|
||||||
|
"validateCredentials"
|
||||||
|
);
|
||||||
|
sourceAccountId = await withRetry(() => exportAccountId(credentialsClient, maskAccountId), "exportAccountId");
|
||||||
}
|
}
|
||||||
if (AccessKeyId || roleChaining) {
|
if (AccessKeyId || roleChaining) {
|
||||||
await credentialsClient.validateCredentials(AccessKeyId, roleChaining, expectedAccountIds);
|
await withRetry(
|
||||||
sourceAccountId = await exportAccountId(credentialsClient, maskAccountId);
|
() => credentialsClient.validateCredentials(AccessKeyId, roleChaining, expectedAccountIds),
|
||||||
|
"validateCredentials"
|
||||||
|
);
|
||||||
|
sourceAccountId = await withRetry(() => exportAccountId(credentialsClient, maskAccountId), "exportAccountId");
|
||||||
}
|
}
|
||||||
if (customTags && (useGitHubOIDCProvider() || webIdentityTokenFile)) {
|
if (customTags && (useGitHubOIDCProvider() || webIdentityTokenFile)) {
|
||||||
warning(
|
warning(
|
||||||
@@ -72932,39 +72936,38 @@ async function run() {
|
|||||||
if (roleToAssume) {
|
if (roleToAssume) {
|
||||||
let roleCredentials;
|
let roleCredentials;
|
||||||
do {
|
do {
|
||||||
roleCredentials = await retryAndBackoff(
|
roleCredentials = await withRetry(async () => {
|
||||||
async () => {
|
return assumeRole({
|
||||||
return assumeRole({
|
credentialsClient,
|
||||||
credentialsClient,
|
sourceAccountId,
|
||||||
sourceAccountId,
|
roleToAssume,
|
||||||
roleToAssume,
|
roleExternalId,
|
||||||
roleExternalId,
|
roleDuration,
|
||||||
roleDuration,
|
roleSessionName,
|
||||||
roleSessionName,
|
roleSkipSessionTagging,
|
||||||
roleSkipSessionTagging,
|
transitiveTagKeys,
|
||||||
transitiveTagKeys,
|
webIdentityTokenFile,
|
||||||
webIdentityTokenFile,
|
webIdentityToken,
|
||||||
webIdentityToken,
|
inlineSessionPolicy,
|
||||||
inlineSessionPolicy,
|
managedSessionPolicies,
|
||||||
managedSessionPolicies,
|
customTags
|
||||||
customTags
|
});
|
||||||
});
|
}, "AssumeRole");
|
||||||
},
|
|
||||||
!disableRetry,
|
|
||||||
maxRetries
|
|
||||||
);
|
|
||||||
} while (specialCharacterWorkaround && !verifyKeys(roleCredentials.Credentials));
|
} while (specialCharacterWorkaround && !verifyKeys(roleCredentials.Credentials));
|
||||||
info(`Authenticated as assumedRoleId ${roleCredentials.AssumedRoleUser?.AssumedRoleId}`);
|
info(`Authenticated as assumedRoleId ${roleCredentials.AssumedRoleUser?.AssumedRoleId}`);
|
||||||
exportCredentials(roleCredentials.Credentials, outputCredentials, outputEnvCredentials);
|
exportCredentials(roleCredentials.Credentials, outputCredentials, outputEnvCredentials);
|
||||||
if ((!process.env.GITHUB_ACTIONS || AccessKeyId) && !awsProfile) {
|
if ((!process.env.GITHUB_ACTIONS || AccessKeyId) && !awsProfile) {
|
||||||
await credentialsClient.validateCredentials(
|
await withRetry(
|
||||||
roleCredentials.Credentials?.AccessKeyId,
|
() => credentialsClient.validateCredentials(
|
||||||
roleChaining,
|
roleCredentials.Credentials?.AccessKeyId,
|
||||||
expectedAccountIds
|
roleChaining,
|
||||||
|
expectedAccountIds
|
||||||
|
),
|
||||||
|
"validateCredentials"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (outputEnvCredentials) {
|
if (outputEnvCredentials) {
|
||||||
await exportAccountId(credentialsClient, maskAccountId);
|
await withRetry(() => exportAccountId(credentialsClient, maskAccountId), "exportAccountId");
|
||||||
}
|
}
|
||||||
if (awsProfile) {
|
if (awsProfile) {
|
||||||
if (!roleCredentials.Credentials) {
|
if (!roleCredentials.Credentials) {
|
||||||
@@ -72972,10 +72975,13 @@ async function run() {
|
|||||||
}
|
}
|
||||||
if (AccessKeyId || !process.env.GITHUB_ACTIONS) {
|
if (AccessKeyId || !process.env.GITHUB_ACTIONS) {
|
||||||
writeProfileFiles(awsProfile, roleCredentials.Credentials, region, true);
|
writeProfileFiles(awsProfile, roleCredentials.Credentials, region, true);
|
||||||
await credentialsClient.validateCredentials(
|
await withRetry(
|
||||||
roleCredentials.Credentials.AccessKeyId,
|
() => credentialsClient.validateCredentials(
|
||||||
roleChaining,
|
roleCredentials.Credentials?.AccessKeyId,
|
||||||
expectedAccountIds
|
roleChaining,
|
||||||
|
expectedAccountIds
|
||||||
|
),
|
||||||
|
"validateCredentials"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
writeProfileFiles(awsProfile, roleCredentials.Credentials, region, overwriteAwsProfile);
|
writeProfileFiles(awsProfile, roleCredentials.Credentials, region, overwriteAwsProfile);
|
||||||
|
|||||||
Reference in New Issue
Block a user