File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -551,14 +551,23 @@ jobs:
551551 INPUT_IMAGE-DIGEST : ${{ steps.get-image-digest.outputs.digest }}
552552 with :
553553 script : |
554- // FIXME: remove once https://github.com/docker/github-builder-experimental/issues/30 is resolved
555- await new Promise(resolve => setTimeout(resolve, 2000));
556-
557554 const { Sigstore } = require('@docker/actions-toolkit/lib/sigstore/sigstore');
558555
559556 const inpImageNames = core.getMultilineInput('image-names');
560557 const inpImageDigest = core.getInput('image-digest');
561558
559+ // ECR registry regexes: https://github.com/docker/login-action/blob/28fdb31ff34708d19615a74d67103ddc2ea9725c/src/aws.ts#L8-L9
560+ const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/;
561+ const ecrPublicRegistryRegex = /public\.ecr\.aws|ecr-public\.aws\.com/;
562+ for (const imageName of inpImageNames) {
563+ if (ecrRegistryRegex.test(imageName) || ecrPublicRegistryRegex.test(imageName)) {
564+ core.info(`Detected ECR image name: ${imageName}, adding delay to mitigate eventual consistency issue`);
565+ // FIXME: remove once https://github.com/docker/github-builder-experimental/issues/30 is resolved
566+ await new Promise(resolve => setTimeout(resolve, 5000));
567+ break;
568+ }
569+ }
570+
562571 const sigstore = new Sigstore();
563572 const signResults = await sigstore.signAttestationManifests({
564573 imageNames: inpImageNames,
Original file line number Diff line number Diff line change @@ -445,14 +445,23 @@ jobs:
445445 INPUT_IMAGE-DIGEST : ${{ steps.build.outputs.digest }}
446446 with :
447447 script : |
448- // FIXME: remove once https://github.com/docker/github-builder-experimental/issues/30 is resolved
449- await new Promise(resolve => setTimeout(resolve, 2000));
450-
451448 const { Sigstore } = require('@docker/actions-toolkit/lib/sigstore/sigstore');
452449
453450 const inpImageNames = core.getMultilineInput('image-names');
454451 const inpImageDigest = core.getInput('image-digest');
455452
453+ // ECR registry regexes: https://github.com/docker/login-action/blob/28fdb31ff34708d19615a74d67103ddc2ea9725c/src/aws.ts#L8-L9
454+ const ecrRegistryRegex = /^(([0-9]{12})\.(dkr\.ecr|dkr-ecr)\.(.+)\.(on\.aws|amazonaws\.com(.cn)?))(\/([^:]+)(:.+)?)?$/;
455+ const ecrPublicRegistryRegex = /public\.ecr\.aws|ecr-public\.aws\.com/;
456+ for (const imageName of inpImageNames) {
457+ if (ecrRegistryRegex.test(imageName) || ecrPublicRegistryRegex.test(imageName)) {
458+ core.info(`Detected ECR image name: ${imageName}, adding delay to mitigate eventual consistency issue`);
459+ // FIXME: remove once https://github.com/docker/github-builder-experimental/issues/30 is resolved
460+ await new Promise(resolve => setTimeout(resolve, 5000));
461+ break;
462+ }
463+ }
464+
456465 const sigstore = new Sigstore();
457466 const signResults = await sigstore.signAttestationManifests({
458467 imageNames: inpImageNames,
You can’t perform that action at this time.
0 commit comments