From 4ec029e3c27c1e2156a68e0ef9b10b824f9eb0bc Mon Sep 17 00:00:00 2001 From: Kazuho Cryer-Shinozuka Date: Sat, 1 Mar 2025 16:23:56 +0900 Subject: [PATCH] temp --- .../LookupStack.assets.json | 20 -- .../LookupStack.template.json | 36 --- .../Stack.assets.json | 34 --- .../Stack.template.json | 165 ------------- .../index.js | 2 - .../cdk.out | 1 - ...efaultTestDeployAssert6B08011C.assets.json | 19 -- ...aultTestDeployAssert6B08011C.template.json | 36 --- .../integ.json | 13 - .../manifest.json | 218 ----------------- .../tree.json | 224 ------------------ .../aws-ecr/test/integ.repository-lookup.ts | 23 +- 12 files changed, 15 insertions(+), 776 deletions(-) delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/asset.3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160/index.js delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdk.out delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/integ.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/manifest.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.assets.json deleted file mode 100644 index 58ee63fad0d7d..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.assets.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": "40.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "LookupStack.template.json", - "packaging": "file" - }, - "destinations": { - "12345678-test-region": { - "bucketName": "cdk-hnb659fds-assets-12345678-test-region", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "region": "test-region", - "assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/LookupStack.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.assets.json deleted file mode 100644 index 679ff6d397010..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.assets.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "version": "40.0.0", - "files": { - "3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160": { - "source": { - "path": "asset.3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160", - "packaging": "zip" - }, - "destinations": { - "12345678-test-region": { - "bucketName": "cdk-hnb659fds-assets-12345678-test-region", - "objectKey": "3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160.zip", - "region": "test-region", - "assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region" - } - } - }, - "93b6be9cf97c17c486acf50de7631d19c095f37f5fbb99f332bd36f187858a98": { - "source": { - "path": "Stack.template.json", - "packaging": "file" - }, - "destinations": { - "12345678-test-region": { - "bucketName": "cdk-hnb659fds-assets-12345678-test-region", - "objectKey": "93b6be9cf97c17c486acf50de7631d19c095f37f5fbb99f332bd36f187858a98.json", - "region": "test-region", - "assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.template.json deleted file mode 100644 index 4fc1e0708963e..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/Stack.template.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "Resources": { - "Repo02AC86CF": { - "Type": "AWS::ECR::Repository", - "Properties": { - "RepositoryName": "my-repo", - "Tags": [ - { - "Key": "aws-cdk:auto-delete-images", - "Value": "true" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "RepoAutoDeleteImagesCustomResource65201E29": { - "Type": "Custom::ECRAutoDeleteImages", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomECRAutoDeleteImagesCustomResourceProviderHandler8D89C030", - "Arn" - ] - }, - "RepositoryName": { - "Ref": "Repo02AC86CF" - } - }, - "DependsOn": [ - "Repo02AC86CF" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomECRAutoDeleteImagesCustomResourceProviderRole665F2773": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ], - "Policies": [ - { - "PolicyName": "Inline", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "ecr:BatchDeleteImage", - "ecr:DescribeRepositories", - "ecr:ListImages", - "ecr:ListTagsForResource" - ], - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:test-region:12345678:repository/*" - ] - ] - } - ], - "Condition": { - "StringEquals": { - "ecr:ResourceTag/aws-cdk:auto-delete-images": "true" - } - } - } - ] - } - } - ] - } - }, - "CustomECRAutoDeleteImagesCustomResourceProviderHandler8D89C030": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": "cdk-hnb659fds-assets-12345678-test-region", - "S3Key": "3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "index.handler", - "Role": { - "Fn::GetAtt": [ - "CustomECRAutoDeleteImagesCustomResourceProviderRole665F2773", - "Arn" - ] - }, - "Runtime": "nodejs18.x", - "Description": { - "Fn::Join": [ - "", - [ - "Lambda function for auto-deleting images in ", - { - "Ref": "Repo02AC86CF" - }, - " repository." - ] - ] - } - }, - "DependsOn": [ - "CustomECRAutoDeleteImagesCustomResourceProviderRole665F2773" - ] - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/asset.3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/asset.3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160/index.js deleted file mode 100644 index eff0ff2826a48..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/asset.3bbaa4a6ad9dab22284496cb250a9e77fb2f26bc181f35610877275058a4f160/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var C=Object.create;var c=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var L=(e,o)=>{for(var t in o)c(e,t,{get:o[t],enumerable:!0})},d=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of S(o))!P.call(e,r)&&r!==t&&c(e,r,{get:()=>o[r],enumerable:!(s=w(o,r))||s.enumerable});return e};var l=(e,o,t)=>(t=e!=null?C(A(e)):{},d(o||!e||!e.__esModule?c(t,"default",{value:e,enumerable:!0}):t,e)),T=e=>d(c({},"__esModule",{value:!0}),e);var W={};L(W,{autoDeleteHandler:()=>I,handler:()=>k});module.exports=T(W);var h=require("@aws-sdk/client-ecr");var m=l(require("https")),R=l(require("url")),n={sendHttpRequest:x,log:N,includeStackTraces:!0,userHandlerIndex:"./index"},p="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",D="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";function y(e){return async(o,t)=>{let s={...o,ResponseURL:"..."};if(n.log(JSON.stringify(s,void 0,2)),o.RequestType==="Delete"&&o.PhysicalResourceId===p){n.log("ignoring DELETE event caused by a failed CREATE event"),await u("SUCCESS",o);return}try{let r=await e(s,t),a=b(o,r);await u("SUCCESS",a)}catch(r){let a={...o,Reason:n.includeStackTraces?r.stack:r.message};a.PhysicalResourceId||(o.RequestType==="Create"?(n.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),a.PhysicalResourceId=p):n.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(o)}`)),await u("FAILED",a)}}}function b(e,o={}){let t=o.PhysicalResourceId??e.PhysicalResourceId??e.RequestId;if(e.RequestType==="Delete"&&t!==e.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${e.PhysicalResourceId}" to "${o.PhysicalResourceId}" during deletion`);return{...e,...o,PhysicalResourceId:t}}async function u(e,o){let t={Status:e,Reason:o.Reason??e,StackId:o.StackId,RequestId:o.RequestId,PhysicalResourceId:o.PhysicalResourceId||D,LogicalResourceId:o.LogicalResourceId,NoEcho:o.NoEcho,Data:o.Data},s=R.parse(o.ResponseURL),r=`${s.protocol}//${s.hostname}/${s.pathname}?***`;n.log("submit response to cloudformation",r,t);let a=JSON.stringify(t),f={hostname:s.hostname,path:s.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(a,"utf8")}};await F({attempts:5,sleep:1e3},n.sendHttpRequest)(f,a)}async function x(e,o){return new Promise((t,s)=>{try{let r=m.request(e,a=>{a.resume(),!a.statusCode||a.statusCode>=400?s(new Error(`Unsuccessful HTTP response: ${a.statusCode}`)):t()});r.on("error",s),r.write(o),r.end()}catch(r){s(r)}})}function N(e,...o){console.log(e,...o)}function F(e,o){return async(...t)=>{let s=e.attempts,r=e.sleep;for(;;)try{return await o(...t)}catch(a){if(s--<=0)throw a;await H(Math.floor(Math.random()*r)),r*=2}}}async function H(e){return new Promise(o=>setTimeout(o,e))}var g="aws-cdk:auto-delete-images",i=new h.ECR({}),k=y(I);async function I(e){switch(e.RequestType){case"Create":break;case"Update":return{PhysicalResourceId:(await q(e)).PhysicalResourceId};case"Delete":return U(e.ResourceProperties?.RepositoryName)}}async function q(e){let o=e,t=o.OldResourceProperties?.RepositoryName;return{PhysicalResourceId:o.ResourceProperties?.RepositoryName??t}}async function E(e){let o=await i.listImages(e),t=[],s=[];(o.imageIds??[]).forEach(a=>{"imageTag"in a?s.push(a):t.push(a)});let r=o.nextToken??null;t.length===0&&s.length===0||(s.length!==0&&await i.batchDeleteImage({repositoryName:e.repositoryName,imageIds:s}),t.length!==0&&await i.batchDeleteImage({repositoryName:e.repositoryName,imageIds:t}),r&&await E({...e,nextToken:r}))}async function U(e){if(!e)throw new Error("No RepositoryName was provided.");let t=(await i.describeRepositories({repositoryNames:[e]})).repositories?.find(s=>s.repositoryName===e);if(!await _(t?.repositoryArn)){process.stdout.write(`Repository does not have '${g}' tag, skipping cleaning. -`);return}try{await E({repositoryName:e})}catch(s){if(s.name!=="RepositoryNotFoundException")throw s}}async function _(e){return(await i.listTagsForResource({resourceArn:e})).tags?.some(t=>t.Key===g&&t.Value==="true")}0&&(module.exports={autoDeleteHandler,handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdk.out deleted file mode 100644 index 1e02a2deb191b..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"40.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json deleted file mode 100644 index 03e27a027c527..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "40.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/integ.json deleted file mode 100644 index 8b6bf4ae159a9..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/integ.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "enableLookups": true, - "version": "40.0.0", - "testCases": { - "cdk-integ-auto-delete-images/DefaultTest": { - "stacks": [ - "Stack" - ], - "assertionStack": "cdk-integ-auto-delete-images/DefaultTest/DeployAssert", - "assertionStackName": "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/manifest.json deleted file mode 100644 index 7583c131cb8d3..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/manifest.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "version": "40.0.0", - "artifacts": { - "Stack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "Stack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "Stack": { - "type": "aws:cloudformation:stack", - "environment": "aws://12345678/test-region", - "properties": { - "templateFile": "Stack.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-deploy-role-12345678-test-region", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-cfn-exec-role-12345678-test-region", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/93b6be9cf97c17c486acf50de7631d19c095f37f5fbb99f332bd36f187858a98.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "Stack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-lookup-role-12345678-test-region", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "Stack.assets" - ], - "metadata": { - "/Stack/Repo": [ - { - "type": "aws:cdk:analytics:construct", - "data": "*" - } - ], - "/Stack/Repo/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Repo02AC86CF" - } - ], - "/Stack/Repo/AutoDeleteImagesCustomResource": [ - { - "type": "aws:cdk:analytics:construct", - "data": "*" - } - ], - "/Stack/Repo/AutoDeleteImagesCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "RepoAutoDeleteImagesCustomResource65201E29" - } - ], - "/Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider": [ - { - "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", - "data": true - } - ], - "/Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomECRAutoDeleteImagesCustomResourceProviderRole665F2773" - } - ], - "/Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomECRAutoDeleteImagesCustomResourceProviderHandler8D89C030" - } - ], - "/Stack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/Stack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "Stack" - }, - "LookupStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "LookupStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "LookupStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://12345678/test-region", - "properties": { - "templateFile": "LookupStack.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-deploy-role-12345678-test-region", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-cfn-exec-role-12345678-test-region", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "LookupStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-lookup-role-12345678-test-region", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "LookupStack.assets" - ], - "metadata": { - "/LookupStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/LookupStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "LookupStack" - }, - "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets" - ], - "metadata": { - "/cdk-integ-auto-delete-images/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/cdk-integ-auto-delete-images/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "cdk-integ-auto-delete-images/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - }, - "missing": [ - { - "key": "cc-api-provider:account=12345678:exactIdentifier=my-repo:propertiesToReturn.0=Arn:region=test-region:typeName=AWS$:$:ECR$:$:Repository", - "provider": "cc-api-provider", - "props": { - "dummyValue": [ - { - "Arn": "arn:${Token[AWS.Partition.10]}:ecr:us-east-1:123456789012:repository/DUMMY_ARN" - } - ], - "account": "12345678", - "region": "test-region", - "typeName": "AWS::ECR::Repository", - "exactIdentifier": "my-repo", - "propertiesToReturn": [ - "Arn" - ], - "lookupRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-lookup-role-12345678-test-region" - } - } - ] -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/tree.json deleted file mode 100644 index 918262e8ba36a..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.js.snapshot/tree.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Stack": { - "id": "Stack", - "path": "Stack", - "children": { - "Repo": { - "id": "Repo", - "path": "Stack/Repo", - "children": { - "Resource": { - "id": "Resource", - "path": "Stack/Repo/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECR::Repository", - "aws:cdk:cloudformation:props": { - "repositoryName": "my-repo", - "tags": [ - { - "key": "aws-cdk:auto-delete-images", - "value": "true" - } - ] - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "AutoDeleteImagesCustomResource": { - "id": "AutoDeleteImagesCustomResource", - "path": "Stack/Repo/AutoDeleteImagesCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "Stack/Repo/AutoDeleteImagesCustomResource/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2", - "metadata": [ - "*" - ] - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2", - "metadata": [ - "*" - ] - } - }, - "Custom::ECRAutoDeleteImagesCustomResourceProvider": { - "id": "Custom::ECRAutoDeleteImagesCustomResourceProvider", - "path": "Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Role": { - "id": "Role", - "path": "Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider/Role", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "Handler": { - "id": "Handler", - "path": "Stack/Custom::ECRAutoDeleteImagesCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "Stack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "Stack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "LookupStack": { - "id": "LookupStack", - "path": "LookupStack", - "children": { - "LookupRepo": { - "id": "LookupRepo", - "path": "LookupStack/LookupRepo", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2", - "metadata": [] - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "LookupStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "LookupStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "cdk-integ-auto-delete-images": { - "id": "cdk-integ-auto-delete-images", - "path": "cdk-integ-auto-delete-images", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "cdk-integ-auto-delete-images/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "cdk-integ-auto-delete-images/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "cdk-integ-auto-delete-images/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "cdk-integ-auto-delete-images/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "cdk-integ-auto-delete-images/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.4.2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.ts index 60fd3a56ce216..1af7115a1f605 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-lookup.ts @@ -1,36 +1,43 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; import * as ecr from 'aws-cdk-lib/aws-ecr'; const app = new App(); const repositoryName = 'my-repo'; -const stack = new Stack(app, 'Stack', { +const setupStack = new Stack(app, 'EcrRepoStack', { env: { account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, }, }); -new ecr.Repository(stack, 'Repo', { +new ecr.Repository(setupStack, 'Repo', { repositoryName, removalPolicy: RemovalPolicy.DESTROY, autoDeleteImages: true, }); -const lookupStack = new Stack(app, 'LookupStack', { +const lookupStack = new Stack(app, 'EcrRepoLookupStack', { env: { account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, }, }); - -ecr.Repository.fromLookup(lookupStack, 'LookupRepo', { +new ecr.Repository(lookupStack, 'TestRepo', { + repositoryName: 'test-repo', + removalPolicy: RemovalPolicy.DESTROY, + autoDeleteImages: true, +}); +const lookupRepo = ecr.Repository.fromLookup(lookupStack, 'LookupRepo', { repositoryName, }); +new CfnOutput(lookupStack, 'RepositoryUri', { + value: lookupRepo.repositoryUri, +}); + new IntegTest(app, 'cdk-integ-auto-delete-images', { - enableLookups: true, - testCases: [stack], + testCases: [lookupStack], });