diff --git a/src/soci-index-build.ts b/src/soci-index-build.ts index fb2365c..a47fd27 100644 --- a/src/soci-index-build.ts +++ b/src/soci-index-build.ts @@ -42,7 +42,9 @@ export class SociIndexBuild extends Construct { constructor(scope: Construct, id: string, props: SociIndexBuildProps) { super(scope, id); - const binaryUrl = 'https://github.com/tmokmss/soci-wrapper/releases/download/v0.1.1/soci-wrapper-v0.1.1-linux-amd64.tar.gz'; + const sociWrapperVersion = 'v0.1.2'; + + const binaryUrl = `https://github.com/tmokmss/soci-wrapper/releases/download/${sociWrapperVersion}/soci-wrapper-${sociWrapperVersion}-linux-amd64.tar.gz`; const handler = new SingletonFunction(this, 'CustomResourceHandler', { // Use raw string to avoid from tightening CDK version requirement diff --git a/test/soci-index-build.integ.snapshot/SociIndexBuildIntegTest.template.json b/test/soci-index-build.integ.snapshot/SociIndexBuildIntegTest.template.json index 3e1c02a..c98a7a2 100644 --- a/test/soci-index-build.integ.snapshot/SociIndexBuildIntegTest.template.json +++ b/test/soci-index-build.integ.snapshot/SociIndexBuildIntegTest.template.json @@ -314,7 +314,7 @@ ] }, "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"current_dir=$(pwd)\",\n \"wget --quiet -O soci-wrapper.tar.gz https://github.com/tmokmss/soci-wrapper/releases/download/v0.1.1/soci-wrapper-v0.1.1-linux-amd64.tar.gz\",\n \"tar -xvzf soci-wrapper.tar.gz\",\n \"\",\n \"export AWS_ACCOUNT=$(aws sts get-caller-identity --query \\\"Account\\\" --output text)\",\n \"export REGISTRY_USER=AWS\",\n \"export REGISTRY_PASSWORD=$(aws ecr get-login-password --region $AWS_REGION)\",\n \"export REGISTRY=$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com\",\n \"aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $REGISTRY\",\n \"REPO_NAME=$repositoryName\",\n \"IMAGE_TAG=$imageTag\",\n \"DIGEST=$(aws ecr describe-images --repository-name $REPO_NAME --image-ids imageTag=$IMAGE_TAG --query imageDetails[0].imageDigest --output text)\",\n \"./soci-wrapper $REPO_NAME $DIGEST $AWS_REGION $AWS_ACCOUNT\"\n ]\n },\n \"post_build\": {\n \"commands\": [\n \"echo Build completed on `date`\",\n \"\\nSTATUS='SUCCESS'\\nif [ $CODEBUILD_BUILD_SUCCEEDING -ne 1 ] # Test if the build is failing\\nthen\\nSTATUS='FAILED'\\nREASON=\\\"deploy-time-build failed. See CloudWatch Log stream for the detailed reason: \\nhttps://$AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$AWS_REGION#logsV2:log-groups/log-group/\\\\$252Faws\\\\$252Fcodebuild\\\\$252F$projectName/log-events/$CODEBUILD_LOG_PATH\\\"\\nfi\\ncat < payload.json\\n{\\n \\\"StackId\\\": \\\"$stackId\\\",\\n \\\"RequestId\\\": \\\"$requestId\\\",\\n \\\"LogicalResourceId\\\":\\\"$logicalResourceId\\\",\\n \\\"PhysicalResourceId\\\": \\\"$imageTag\\\",\\n \\\"Status\\\": \\\"$STATUS\\\",\\n \\\"Reason\\\": \\\"$REASON\\\"\\n}\\nEOF\\ncurl -vv -i -X PUT -H 'Content-Type:' -d \\\"@payload.json\\\" \\\"$responseURL\\\"\\n \"\n ]\n }\n }\n}", + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"current_dir=$(pwd)\",\n \"wget --quiet -O soci-wrapper.tar.gz https://github.com/tmokmss/soci-wrapper/releases/download/v0.1.2/soci-wrapper-v0.1.2-linux-amd64.tar.gz\",\n \"tar -xvzf soci-wrapper.tar.gz\",\n \"\",\n \"export AWS_ACCOUNT=$(aws sts get-caller-identity --query \\\"Account\\\" --output text)\",\n \"export REGISTRY_USER=AWS\",\n \"export REGISTRY_PASSWORD=$(aws ecr get-login-password --region $AWS_REGION)\",\n \"export REGISTRY=$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com\",\n \"aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $REGISTRY\",\n \"REPO_NAME=$repositoryName\",\n \"IMAGE_TAG=$imageTag\",\n \"DIGEST=$(aws ecr describe-images --repository-name $REPO_NAME --image-ids imageTag=$IMAGE_TAG --query imageDetails[0].imageDigest --output text)\",\n \"./soci-wrapper $REPO_NAME $DIGEST $AWS_REGION $AWS_ACCOUNT\"\n ]\n },\n \"post_build\": {\n \"commands\": [\n \"echo Build completed on `date`\",\n \"\\nSTATUS='SUCCESS'\\nif [ $CODEBUILD_BUILD_SUCCEEDING -ne 1 ] # Test if the build is failing\\nthen\\nSTATUS='FAILED'\\nREASON=\\\"deploy-time-build failed. See CloudWatch Log stream for the detailed reason: \\nhttps://$AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$AWS_REGION#logsV2:log-groups/log-group/\\\\$252Faws\\\\$252Fcodebuild\\\\$252F$projectName/log-events/$CODEBUILD_LOG_PATH\\\"\\nfi\\ncat < payload.json\\n{\\n \\\"StackId\\\": \\\"$stackId\\\",\\n \\\"RequestId\\\": \\\"$requestId\\\",\\n \\\"LogicalResourceId\\\":\\\"$logicalResourceId\\\",\\n \\\"PhysicalResourceId\\\": \\\"$imageTag\\\",\\n \\\"Status\\\": \\\"$STATUS\\\",\\n \\\"Reason\\\": \\\"$REASON\\\"\\n}\\nEOF\\ncurl -vv -i -X PUT -H 'Content-Type:' -d \\\"@payload.json\\\" \\\"$responseURL\\\"\\n \"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, "Cache": { diff --git a/test/soci-index-build.integ.snapshot/tree.json b/test/soci-index-build.integ.snapshot/tree.json index 982082a..9c65954 100644 --- a/test/soci-index-build.integ.snapshot/tree.json +++ b/test/soci-index-build.integ.snapshot/tree.json @@ -555,7 +555,7 @@ }, "source": { "type": "NO_SOURCE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"current_dir=$(pwd)\",\n \"wget --quiet -O soci-wrapper.tar.gz https://github.com/tmokmss/soci-wrapper/releases/download/v0.1.1/soci-wrapper-v0.1.1-linux-amd64.tar.gz\",\n \"tar -xvzf soci-wrapper.tar.gz\",\n \"\",\n \"export AWS_ACCOUNT=$(aws sts get-caller-identity --query \\\"Account\\\" --output text)\",\n \"export REGISTRY_USER=AWS\",\n \"export REGISTRY_PASSWORD=$(aws ecr get-login-password --region $AWS_REGION)\",\n \"export REGISTRY=$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com\",\n \"aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $REGISTRY\",\n \"REPO_NAME=$repositoryName\",\n \"IMAGE_TAG=$imageTag\",\n \"DIGEST=$(aws ecr describe-images --repository-name $REPO_NAME --image-ids imageTag=$IMAGE_TAG --query imageDetails[0].imageDigest --output text)\",\n \"./soci-wrapper $REPO_NAME $DIGEST $AWS_REGION $AWS_ACCOUNT\"\n ]\n },\n \"post_build\": {\n \"commands\": [\n \"echo Build completed on `date`\",\n \"\\nSTATUS='SUCCESS'\\nif [ $CODEBUILD_BUILD_SUCCEEDING -ne 1 ] # Test if the build is failing\\nthen\\nSTATUS='FAILED'\\nREASON=\\\"deploy-time-build failed. See CloudWatch Log stream for the detailed reason: \\nhttps://$AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$AWS_REGION#logsV2:log-groups/log-group/\\\\$252Faws\\\\$252Fcodebuild\\\\$252F$projectName/log-events/$CODEBUILD_LOG_PATH\\\"\\nfi\\ncat < payload.json\\n{\\n \\\"StackId\\\": \\\"$stackId\\\",\\n \\\"RequestId\\\": \\\"$requestId\\\",\\n \\\"LogicalResourceId\\\":\\\"$logicalResourceId\\\",\\n \\\"PhysicalResourceId\\\": \\\"$imageTag\\\",\\n \\\"Status\\\": \\\"$STATUS\\\",\\n \\\"Reason\\\": \\\"$REASON\\\"\\n}\\nEOF\\ncurl -vv -i -X PUT -H 'Content-Type:' -d \\\"@payload.json\\\" \\\"$responseURL\\\"\\n \"\n ]\n }\n }\n}" + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"current_dir=$(pwd)\",\n \"wget --quiet -O soci-wrapper.tar.gz https://github.com/tmokmss/soci-wrapper/releases/download/v0.1.2/soci-wrapper-v0.1.2-linux-amd64.tar.gz\",\n \"tar -xvzf soci-wrapper.tar.gz\",\n \"\",\n \"export AWS_ACCOUNT=$(aws sts get-caller-identity --query \\\"Account\\\" --output text)\",\n \"export REGISTRY_USER=AWS\",\n \"export REGISTRY_PASSWORD=$(aws ecr get-login-password --region $AWS_REGION)\",\n \"export REGISTRY=$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com\",\n \"aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $REGISTRY\",\n \"REPO_NAME=$repositoryName\",\n \"IMAGE_TAG=$imageTag\",\n \"DIGEST=$(aws ecr describe-images --repository-name $REPO_NAME --image-ids imageTag=$IMAGE_TAG --query imageDetails[0].imageDigest --output text)\",\n \"./soci-wrapper $REPO_NAME $DIGEST $AWS_REGION $AWS_ACCOUNT\"\n ]\n },\n \"post_build\": {\n \"commands\": [\n \"echo Build completed on `date`\",\n \"\\nSTATUS='SUCCESS'\\nif [ $CODEBUILD_BUILD_SUCCEEDING -ne 1 ] # Test if the build is failing\\nthen\\nSTATUS='FAILED'\\nREASON=\\\"deploy-time-build failed. See CloudWatch Log stream for the detailed reason: \\nhttps://$AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$AWS_REGION#logsV2:log-groups/log-group/\\\\$252Faws\\\\$252Fcodebuild\\\\$252F$projectName/log-events/$CODEBUILD_LOG_PATH\\\"\\nfi\\ncat < payload.json\\n{\\n \\\"StackId\\\": \\\"$stackId\\\",\\n \\\"RequestId\\\": \\\"$requestId\\\",\\n \\\"LogicalResourceId\\\":\\\"$logicalResourceId\\\",\\n \\\"PhysicalResourceId\\\": \\\"$imageTag\\\",\\n \\\"Status\\\": \\\"$STATUS\\\",\\n \\\"Reason\\\": \\\"$REASON\\\"\\n}\\nEOF\\ncurl -vv -i -X PUT -H 'Content-Type:' -d \\\"@payload.json\\\" \\\"$responseURL\\\"\\n \"\n ]\n }\n }\n}" }, "cache": { "type": "NO_CACHE"