cdk-ecr-deployment 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +31 -22
- package/API.md +13 -15
- package/README.md +32 -0
- package/lambda/go.mod +128 -11
- package/lambda/go.sum +261 -4810
- package/lambda/install.js +21 -6
- package/lambda/internal/tarfile/s3file.go +1 -1
- package/lib/config.js +2 -3
- package/lib/index.d.ts +15 -0
- package/lib/index.js +20 -5
- package/package.json +15 -13
package/.jsii
CHANGED
|
@@ -3457,7 +3457,7 @@
|
|
|
3457
3457
|
"stability": "stable"
|
|
3458
3458
|
},
|
|
3459
3459
|
"homepage": "https://github.com/cdklabs/cdk-ecr-deployment",
|
|
3460
|
-
"jsiiVersion": "5.
|
|
3460
|
+
"jsiiVersion": "5.7.8 (build 2bc6834)",
|
|
3461
3461
|
"keywords": [
|
|
3462
3462
|
"cdk"
|
|
3463
3463
|
],
|
|
@@ -3472,7 +3472,7 @@
|
|
|
3472
3472
|
},
|
|
3473
3473
|
"name": "cdk-ecr-deployment",
|
|
3474
3474
|
"readme": {
|
|
3475
|
-
"markdown": "# cdk-ecr-deployment\n\n[](https://github.com/cdklabs/cdk-ecr-deployment/actions/workflows/release.yml)\n[](https://www.npmjs.com/package/cdk-ecr-deployment)\n[](https://pypi.org/project/cdk-ecr-deployment)\n[](https://www.npmjs.com/package/cdk-ecr-deployment)\n[](https://pypi.org/project/cdk-ecr-deployment)\n\nCDK construct to synchronize single docker image between docker registries.\n\n**Only use v3 of this package**\n\n⚠️ Version 2.* is no longer supported, as the Go.1.x runtime is no longer supported in AWS Lambda.\\\n⚠️ Version 1.* is no longer supported, as CDK v1 has reached the end-of-life\nstage.\n\n## Features\n\n- Copy image from ECR/external registry to (another) ECR/external registry\n- Copy an archive tarball image from s3 to ECR/external registry\n\n## Environment variables\n\nEnable flags: `true`, `1`. e.g. `export CI=1`\n\n- `CI` indicate if it's CI environment. This flag will enable building lambda from scratch.\n- `NO_PREBUILT_LAMBDA` disable using prebuilt lambda.\n- `FORCE_PREBUILT_LAMBDA` force using prebuilt lambda.\n\n⚠️ If you want to force using prebuilt lambda in CI environment to reduce build time. Try `export FORCE_PREBUILT_LAMBDA=1`.\n\n## Examples\n\n```ts\nimport { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';\n\nconst image = new DockerImageAsset(this, 'CDKDockerImage', {\n directory: path.join(__dirname, 'docker'),\n});\n\n// Copy from cdk docker image asset to another ECR.\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage1', {\n src: new ecrdeploy.DockerImageName(image.imageUri),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx:latest`),\n});\n\n// Copy from docker registry to ECR.\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage2', {\n src: new ecrdeploy.DockerImageName('nginx:latest'),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx2:latest`),\n});\n\n// Copy from private docker registry to ECR.\n// The format of secret in aws secrets manager must be either:\n// - plain text in format <username>:<password>\n// - json in format {\"username\":\"<username>\",\"password\":\"<password>\"}\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage3', {\n src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'username:password'),\n // src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'aws-secrets-manager-secret-name'),\n // src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'arn:aws:secretsmanager:us-west-2:000000000000:secret:id'),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx3:latest`),\n}).addToPrincipalPolicy(new iam.PolicyStatement({\n effect: iam.Effect.ALLOW,\n actions: [\n 'secretsmanager:GetSecretValue',\n ],\n resources: ['*'],\n}));\n```\n\n## Sample: [test/example.ecr-deployment.ts](./test/example.ecr-deployment.ts)\n\n```shell\n# Run the following command to try the sample.\nNO_PREBUILT_LAMBDA=1 npx cdk deploy -a \"npx ts-node -P tsconfig.dev.json --prefer-ts-exts test/example.ecr-deployment.ts\"\n```\n\n## [API](./API.md)\n\n## Tech Details & Contribution\n\nThe core of this project relies on [containers/image](https://github.com/containers/image) which is used by [Skopeo](https://github.com/containers/skopeo).\nPlease take a look at those projects before contribution.\n\nTo support a new docker image source(like docker tarball in s3), you need to implement [image transport interface](https://github.com/containers/image/blob/master/types/types.go). You could take a look at [docker-archive](https://github.com/containers/image/blob/ccb87a8d0f45cf28846e307eb0ec2b9d38a458c2/docker/archive/transport.go) transport for a good start.\n\nTo test the `lambda` folder, `make test`.\n"
|
|
3475
|
+
"markdown": "# cdk-ecr-deployment\n\n[](https://github.com/cdklabs/cdk-ecr-deployment/actions/workflows/release.yml)\n[](https://www.npmjs.com/package/cdk-ecr-deployment)\n[](https://pypi.org/project/cdk-ecr-deployment)\n[](https://www.npmjs.com/package/cdk-ecr-deployment)\n[](https://pypi.org/project/cdk-ecr-deployment)\n\nCDK construct to synchronize single docker image between docker registries.\n\n**Only use v3 of this package**\n\n⚠️ Version 2.* is no longer supported, as the Go.1.x runtime is no longer supported in AWS Lambda.\\\n⚠️ Version 1.* is no longer supported, as CDK v1 has reached the end-of-life\nstage.\n\n## Features\n\n- Copy image from ECR/external registry to (another) ECR/external registry\n- Copy an archive tarball image from s3 to ECR/external registry\n\n## Environment variables\n\nEnable flags: `true`, `1`. e.g. `export CI=1`\n\n- `CI` indicate if it's CI environment. This flag will enable building lambda from scratch.\n- `NO_PREBUILT_LAMBDA` disable using prebuilt lambda.\n- `FORCE_PREBUILT_LAMBDA` force using prebuilt lambda.\n\n⚠️ If you want to force using prebuilt lambda in CI environment to reduce build time. Try `export FORCE_PREBUILT_LAMBDA=1`.\n\n## Examples\n\n```ts\nimport { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';\n\nconst image = new DockerImageAsset(this, 'CDKDockerImage', {\n directory: path.join(__dirname, 'docker'),\n});\n\n// Copy from cdk docker image asset to another ECR.\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage1', {\n src: new ecrdeploy.DockerImageName(image.imageUri),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx:latest`),\n});\n\n// Copy from docker registry to ECR.\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage2', {\n src: new ecrdeploy.DockerImageName('nginx:latest'),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx2:latest`),\n});\n\n// Copy from private docker registry to ECR.\n// The format of secret in aws secrets manager must be either:\n// - plain text in format <username>:<password>\n// - json in format {\"username\":\"<username>\",\"password\":\"<password>\"}\nnew ecrdeploy.ECRDeployment(this, 'DeployDockerImage3', {\n src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'username:password'),\n // src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'aws-secrets-manager-secret-name'),\n // src: new ecrdeploy.DockerImageName('javacs3/nginx:latest', 'arn:aws:secretsmanager:us-west-2:000000000000:secret:id'),\n dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/my-nginx3:latest`),\n}).addToPrincipalPolicy(new iam.PolicyStatement({\n effect: iam.Effect.ALLOW,\n actions: [\n 'secretsmanager:GetSecretValue',\n ],\n resources: ['*'],\n}));\n```\n\n## Sample: [test/example.ecr-deployment.ts](./test/example.ecr-deployment.ts)\n\nAfter cloning the repository, install dependencies and run a full build:\n\n```console\nyarn --frozen-lockfile --check-files\nyarn build\n```\n\nThen run the example like this:\n\n```shell\n# Run the following command to try the sample.\nNO_PREBUILT_LAMBDA=1 npx cdk deploy -a \"npx ts-node -P tsconfig.dev.json --prefer-ts-exts test/example.ecr-deployment.ts\"\n```\n\nTo run the DockerHub example you will first need to setup a Secret in AWS Secrets Manager to provide DockerHub credentials.\nReplace `username:access-token` with your credentials.\n**Please note that Secrets will occur a cost.**\n\n```console\naws secretsmanager create-secret --name DockerHubCredentials --secret-string \"username:access-token\"\n```\n\nFrom the output, copy the ARN of your new secret and export it as env variable\n\n```console\nexport DOCKERHUB_SECRET_ARN=\"<ARN>\"\n```\n\nFinally run:\n\n```shell\n# Run the following command to try the sample.\nNO_PREBUILT_LAMBDA=1 npx cdk deploy -a \"npx ts-node -P tsconfig.dev.json --prefer-ts-exts test/dockerhub-example.ecr-deployment.ts\"\n```\n\nIf your Secret is encrypted, you might have to adjust the example to also grant decrypt permissions.\n\n## [API](./API.md)\n\n## Tech Details & Contribution\n\nThe core of this project relies on [containers/image](https://github.com/containers/image) which is used by [Skopeo](https://github.com/containers/skopeo).\nPlease take a look at those projects before contribution.\n\nTo support a new docker image source(like docker tarball in s3), you need to implement [image transport interface](https://github.com/containers/image/blob/master/types/types.go). You could take a look at [docker-archive](https://github.com/containers/image/blob/ccb87a8d0f45cf28846e307eb0ec2b9d38a458c2/docker/archive/transport.go) transport for a good start.\n\nTo test the `lambda` folder, `make test`.\n"
|
|
3476
3476
|
},
|
|
3477
3477
|
"repository": {
|
|
3478
3478
|
"type": "git",
|
|
@@ -3515,10 +3515,13 @@
|
|
|
3515
3515
|
},
|
|
3516
3516
|
"locationInModule": {
|
|
3517
3517
|
"filename": "src/index.ts",
|
|
3518
|
-
"line":
|
|
3518
|
+
"line": 159
|
|
3519
3519
|
},
|
|
3520
3520
|
"parameters": [
|
|
3521
3521
|
{
|
|
3522
|
+
"docs": {
|
|
3523
|
+
"summary": "- The name of the image, e.g. retrieved from `DockerImageAsset.imageUri`."
|
|
3524
|
+
},
|
|
3522
3525
|
"name": "name",
|
|
3523
3526
|
"type": {
|
|
3524
3527
|
"primitive": "string"
|
|
@@ -3526,8 +3529,8 @@
|
|
|
3526
3529
|
},
|
|
3527
3530
|
{
|
|
3528
3531
|
"docs": {
|
|
3529
|
-
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\
|
|
3530
|
-
"summary": "The credentials of the docker image."
|
|
3532
|
+
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\nIf specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or\nJSON (`{\"username\":\"<username>\",\"password\":\"<password>\"}`).\nFor more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html",
|
|
3533
|
+
"summary": "- The credentials of the docker image."
|
|
3531
3534
|
},
|
|
3532
3535
|
"name": "creds",
|
|
3533
3536
|
"optional": true,
|
|
@@ -3556,7 +3559,7 @@
|
|
|
3556
3559
|
"immutable": true,
|
|
3557
3560
|
"locationInModule": {
|
|
3558
3561
|
"filename": "src/index.ts",
|
|
3559
|
-
"line":
|
|
3562
|
+
"line": 160
|
|
3560
3563
|
},
|
|
3561
3564
|
"name": "uri",
|
|
3562
3565
|
"overrides": "cdk-ecr-deployment.IImageName",
|
|
@@ -3566,13 +3569,13 @@
|
|
|
3566
3569
|
},
|
|
3567
3570
|
{
|
|
3568
3571
|
"docs": {
|
|
3569
|
-
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\
|
|
3572
|
+
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\nIf specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or\nJSON (`{\"username\":\"<username>\",\"password\":\"<password>\"}`).\nFor more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html",
|
|
3570
3573
|
"stability": "stable",
|
|
3571
|
-
"summary": "The credentials of the docker image."
|
|
3574
|
+
"summary": "- The credentials of the docker image."
|
|
3572
3575
|
},
|
|
3573
3576
|
"locationInModule": {
|
|
3574
3577
|
"filename": "src/index.ts",
|
|
3575
|
-
"line":
|
|
3578
|
+
"line": 159
|
|
3576
3579
|
},
|
|
3577
3580
|
"name": "creds",
|
|
3578
3581
|
"optional": true,
|
|
@@ -3597,7 +3600,7 @@
|
|
|
3597
3600
|
},
|
|
3598
3601
|
"locationInModule": {
|
|
3599
3602
|
"filename": "src/index.ts",
|
|
3600
|
-
"line":
|
|
3603
|
+
"line": 186
|
|
3601
3604
|
},
|
|
3602
3605
|
"parameters": [
|
|
3603
3606
|
{
|
|
@@ -3623,7 +3626,7 @@
|
|
|
3623
3626
|
"kind": "class",
|
|
3624
3627
|
"locationInModule": {
|
|
3625
3628
|
"filename": "src/index.ts",
|
|
3626
|
-
"line":
|
|
3629
|
+
"line": 183
|
|
3627
3630
|
},
|
|
3628
3631
|
"methods": [
|
|
3629
3632
|
{
|
|
@@ -3632,7 +3635,7 @@
|
|
|
3632
3635
|
},
|
|
3633
3636
|
"locationInModule": {
|
|
3634
3637
|
"filename": "src/index.ts",
|
|
3635
|
-
"line":
|
|
3638
|
+
"line": 255
|
|
3636
3639
|
},
|
|
3637
3640
|
"name": "addToPrincipalPolicy",
|
|
3638
3641
|
"parameters": [
|
|
@@ -3963,16 +3966,22 @@
|
|
|
3963
3966
|
},
|
|
3964
3967
|
"locationInModule": {
|
|
3965
3968
|
"filename": "src/index.ts",
|
|
3966
|
-
"line":
|
|
3969
|
+
"line": 174
|
|
3967
3970
|
},
|
|
3968
3971
|
"parameters": [
|
|
3969
3972
|
{
|
|
3973
|
+
"docs": {
|
|
3974
|
+
"summary": "- the S3 bucket name and path of the archive (a S3 URI without the s3://)."
|
|
3975
|
+
},
|
|
3970
3976
|
"name": "p",
|
|
3971
3977
|
"type": {
|
|
3972
3978
|
"primitive": "string"
|
|
3973
3979
|
}
|
|
3974
3980
|
},
|
|
3975
3981
|
{
|
|
3982
|
+
"docs": {
|
|
3983
|
+
"summary": "- appended to the end of the name with a `:`, e.g. `:latest`."
|
|
3984
|
+
},
|
|
3976
3985
|
"name": "ref",
|
|
3977
3986
|
"optional": true,
|
|
3978
3987
|
"type": {
|
|
@@ -3981,8 +3990,8 @@
|
|
|
3981
3990
|
},
|
|
3982
3991
|
{
|
|
3983
3992
|
"docs": {
|
|
3984
|
-
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\
|
|
3985
|
-
"summary": "The credentials of the docker image."
|
|
3993
|
+
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\nIf specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or\nJSON (`{\"username\":\"<username>\",\"password\":\"<password>\"}`).\nFor more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html",
|
|
3994
|
+
"summary": "- The credentials of the docker image."
|
|
3986
3995
|
},
|
|
3987
3996
|
"name": "creds",
|
|
3988
3997
|
"optional": true,
|
|
@@ -3998,7 +4007,7 @@
|
|
|
3998
4007
|
"kind": "class",
|
|
3999
4008
|
"locationInModule": {
|
|
4000
4009
|
"filename": "src/index.ts",
|
|
4001
|
-
"line":
|
|
4010
|
+
"line": 163
|
|
4002
4011
|
},
|
|
4003
4012
|
"name": "S3ArchiveName",
|
|
4004
4013
|
"properties": [
|
|
@@ -4011,7 +4020,7 @@
|
|
|
4011
4020
|
"immutable": true,
|
|
4012
4021
|
"locationInModule": {
|
|
4013
4022
|
"filename": "src/index.ts",
|
|
4014
|
-
"line":
|
|
4023
|
+
"line": 180
|
|
4015
4024
|
},
|
|
4016
4025
|
"name": "uri",
|
|
4017
4026
|
"overrides": "cdk-ecr-deployment.IImageName",
|
|
@@ -4021,13 +4030,13 @@
|
|
|
4021
4030
|
},
|
|
4022
4031
|
{
|
|
4023
4032
|
"docs": {
|
|
4024
|
-
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\
|
|
4033
|
+
"remarks": "Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.\nIf specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or\nJSON (`{\"username\":\"<username>\",\"password\":\"<password>\"}`).\nFor more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html",
|
|
4025
4034
|
"stability": "stable",
|
|
4026
|
-
"summary": "The credentials of the docker image."
|
|
4035
|
+
"summary": "- The credentials of the docker image."
|
|
4027
4036
|
},
|
|
4028
4037
|
"locationInModule": {
|
|
4029
4038
|
"filename": "src/index.ts",
|
|
4030
|
-
"line":
|
|
4039
|
+
"line": 174
|
|
4031
4040
|
},
|
|
4032
4041
|
"name": "creds",
|
|
4033
4042
|
"optional": true,
|
|
@@ -4040,6 +4049,6 @@
|
|
|
4040
4049
|
"symbolId": "src/index:S3ArchiveName"
|
|
4041
4050
|
}
|
|
4042
4051
|
},
|
|
4043
|
-
"version": "3.2.
|
|
4044
|
-
"fingerprint": "
|
|
4052
|
+
"version": "3.2.2",
|
|
4053
|
+
"fingerprint": "QOhoeQIxu0qsn9rbZoulqw9Cpt/J49fk6y86SJ5dm+8="
|
|
4045
4054
|
}
|
package/API.md
CHANGED
|
@@ -331,8 +331,8 @@ new DockerImageName(name: string, creds?: string)
|
|
|
331
331
|
|
|
332
332
|
| **Name** | **Type** | **Description** |
|
|
333
333
|
| --- | --- | --- |
|
|
334
|
-
| <code><a href="#cdk-ecr-deployment.DockerImageName.Initializer.parameter.name">name</a></code> | <code>string</code> |
|
|
335
|
-
| <code><a href="#cdk-ecr-deployment.DockerImageName.Initializer.parameter.creds">creds</a></code> | <code>string</code> | The credentials of the docker image. |
|
|
334
|
+
| <code><a href="#cdk-ecr-deployment.DockerImageName.Initializer.parameter.name">name</a></code> | <code>string</code> | - The name of the image, e.g. retrieved from `DockerImageAsset.imageUri`. |
|
|
335
|
+
| <code><a href="#cdk-ecr-deployment.DockerImageName.Initializer.parameter.creds">creds</a></code> | <code>string</code> | - The credentials of the docker image. |
|
|
336
336
|
|
|
337
337
|
---
|
|
338
338
|
|
|
@@ -340,6 +340,8 @@ new DockerImageName(name: string, creds?: string)
|
|
|
340
340
|
|
|
341
341
|
- *Type:* string
|
|
342
342
|
|
|
343
|
+
The name of the image, e.g. retrieved from `DockerImageAsset.imageUri`.
|
|
344
|
+
|
|
343
345
|
---
|
|
344
346
|
|
|
345
347
|
##### `creds`<sup>Optional</sup> <a name="creds" id="cdk-ecr-deployment.DockerImageName.Initializer.parameter.creds"></a>
|
|
@@ -349,10 +351,8 @@ new DockerImageName(name: string, creds?: string)
|
|
|
349
351
|
The credentials of the docker image.
|
|
350
352
|
|
|
351
353
|
Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.
|
|
352
|
-
|
|
353
354
|
If specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or
|
|
354
355
|
JSON (`{"username":"<username>","password":"<password>"}`).
|
|
355
|
-
|
|
356
356
|
For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html
|
|
357
357
|
|
|
358
358
|
---
|
|
@@ -364,7 +364,7 @@ For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/lates
|
|
|
364
364
|
| **Name** | **Type** | **Description** |
|
|
365
365
|
| --- | --- | --- |
|
|
366
366
|
| <code><a href="#cdk-ecr-deployment.DockerImageName.property.uri">uri</a></code> | <code>string</code> | The uri of the docker image. |
|
|
367
|
-
| <code><a href="#cdk-ecr-deployment.DockerImageName.property.creds">creds</a></code> | <code>string</code> | The credentials of the docker image. |
|
|
367
|
+
| <code><a href="#cdk-ecr-deployment.DockerImageName.property.creds">creds</a></code> | <code>string</code> | - The credentials of the docker image. |
|
|
368
368
|
|
|
369
369
|
---
|
|
370
370
|
|
|
@@ -393,10 +393,8 @@ public readonly creds: string;
|
|
|
393
393
|
The credentials of the docker image.
|
|
394
394
|
|
|
395
395
|
Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.
|
|
396
|
-
|
|
397
396
|
If specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or
|
|
398
397
|
JSON (`{"username":"<username>","password":"<password>"}`).
|
|
399
|
-
|
|
400
398
|
For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html
|
|
401
399
|
|
|
402
400
|
---
|
|
@@ -416,9 +414,9 @@ new S3ArchiveName(p: string, ref?: string, creds?: string)
|
|
|
416
414
|
|
|
417
415
|
| **Name** | **Type** | **Description** |
|
|
418
416
|
| --- | --- | --- |
|
|
419
|
-
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.p">p</a></code> | <code>string</code> |
|
|
420
|
-
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.ref">ref</a></code> | <code>string</code> |
|
|
421
|
-
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.creds">creds</a></code> | <code>string</code> | The credentials of the docker image. |
|
|
417
|
+
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.p">p</a></code> | <code>string</code> | - the S3 bucket name and path of the archive (a S3 URI without the s3://). |
|
|
418
|
+
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.ref">ref</a></code> | <code>string</code> | - appended to the end of the name with a `:`, e.g. `:latest`. |
|
|
419
|
+
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.creds">creds</a></code> | <code>string</code> | - The credentials of the docker image. |
|
|
422
420
|
|
|
423
421
|
---
|
|
424
422
|
|
|
@@ -426,12 +424,16 @@ new S3ArchiveName(p: string, ref?: string, creds?: string)
|
|
|
426
424
|
|
|
427
425
|
- *Type:* string
|
|
428
426
|
|
|
427
|
+
the S3 bucket name and path of the archive (a S3 URI without the s3://).
|
|
428
|
+
|
|
429
429
|
---
|
|
430
430
|
|
|
431
431
|
##### `ref`<sup>Optional</sup> <a name="ref" id="cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.ref"></a>
|
|
432
432
|
|
|
433
433
|
- *Type:* string
|
|
434
434
|
|
|
435
|
+
appended to the end of the name with a `:`, e.g. `:latest`.
|
|
436
|
+
|
|
435
437
|
---
|
|
436
438
|
|
|
437
439
|
##### `creds`<sup>Optional</sup> <a name="creds" id="cdk-ecr-deployment.S3ArchiveName.Initializer.parameter.creds"></a>
|
|
@@ -441,10 +443,8 @@ new S3ArchiveName(p: string, ref?: string, creds?: string)
|
|
|
441
443
|
The credentials of the docker image.
|
|
442
444
|
|
|
443
445
|
Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.
|
|
444
|
-
|
|
445
446
|
If specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or
|
|
446
447
|
JSON (`{"username":"<username>","password":"<password>"}`).
|
|
447
|
-
|
|
448
448
|
For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html
|
|
449
449
|
|
|
450
450
|
---
|
|
@@ -456,7 +456,7 @@ For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/lates
|
|
|
456
456
|
| **Name** | **Type** | **Description** |
|
|
457
457
|
| --- | --- | --- |
|
|
458
458
|
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.property.uri">uri</a></code> | <code>string</code> | The uri of the docker image. |
|
|
459
|
-
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.property.creds">creds</a></code> | <code>string</code> | The credentials of the docker image. |
|
|
459
|
+
| <code><a href="#cdk-ecr-deployment.S3ArchiveName.property.creds">creds</a></code> | <code>string</code> | - The credentials of the docker image. |
|
|
460
460
|
|
|
461
461
|
---
|
|
462
462
|
|
|
@@ -485,10 +485,8 @@ public readonly creds: string;
|
|
|
485
485
|
The credentials of the docker image.
|
|
486
486
|
|
|
487
487
|
Format `user:password` or `AWS Secrets Manager secret arn` or `AWS Secrets Manager secret name`.
|
|
488
|
-
|
|
489
488
|
If specifying an AWS Secrets Manager secret, the format of the secret should be either plain text (`user:password`) or
|
|
490
489
|
JSON (`{"username":"<username>","password":"<password>"}`).
|
|
491
|
-
|
|
492
490
|
For more details on JSON format, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html
|
|
493
491
|
|
|
494
492
|
---
|
package/README.md
CHANGED
|
@@ -70,11 +70,43 @@ new ecrdeploy.ECRDeployment(this, 'DeployDockerImage3', {
|
|
|
70
70
|
|
|
71
71
|
## Sample: [test/example.ecr-deployment.ts](./test/example.ecr-deployment.ts)
|
|
72
72
|
|
|
73
|
+
After cloning the repository, install dependencies and run a full build:
|
|
74
|
+
|
|
75
|
+
```console
|
|
76
|
+
yarn --frozen-lockfile --check-files
|
|
77
|
+
yarn build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then run the example like this:
|
|
81
|
+
|
|
73
82
|
```shell
|
|
74
83
|
# Run the following command to try the sample.
|
|
75
84
|
NO_PREBUILT_LAMBDA=1 npx cdk deploy -a "npx ts-node -P tsconfig.dev.json --prefer-ts-exts test/example.ecr-deployment.ts"
|
|
76
85
|
```
|
|
77
86
|
|
|
87
|
+
To run the DockerHub example you will first need to setup a Secret in AWS Secrets Manager to provide DockerHub credentials.
|
|
88
|
+
Replace `username:access-token` with your credentials.
|
|
89
|
+
**Please note that Secrets will occur a cost.**
|
|
90
|
+
|
|
91
|
+
```console
|
|
92
|
+
aws secretsmanager create-secret --name DockerHubCredentials --secret-string "username:access-token"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
From the output, copy the ARN of your new secret and export it as env variable
|
|
96
|
+
|
|
97
|
+
```console
|
|
98
|
+
export DOCKERHUB_SECRET_ARN="<ARN>"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Finally run:
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
# Run the following command to try the sample.
|
|
105
|
+
NO_PREBUILT_LAMBDA=1 npx cdk deploy -a "npx ts-node -P tsconfig.dev.json --prefer-ts-exts test/dockerhub-example.ecr-deployment.ts"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If your Secret is encrypted, you might have to adjust the example to also grant decrypt permissions.
|
|
109
|
+
|
|
78
110
|
## [API](./API.md)
|
|
79
111
|
|
|
80
112
|
## Tech Details & Contribution
|
package/lambda/go.mod
CHANGED
|
@@ -1,19 +1,136 @@
|
|
|
1
1
|
module cdk-ecr-deployment-handler
|
|
2
2
|
|
|
3
|
-
go 1.
|
|
3
|
+
go 1.24.1
|
|
4
4
|
|
|
5
5
|
require (
|
|
6
|
-
github.com/aws/aws-lambda-go v1.
|
|
7
|
-
github.com/aws/aws-sdk-go-v2 v1.
|
|
8
|
-
github.com/aws/aws-sdk-go-v2/config v1.
|
|
9
|
-
github.com/aws/aws-sdk-go-v2/service/ecr v1.
|
|
10
|
-
github.com/aws/aws-sdk-go-v2/service/s3 v1.
|
|
11
|
-
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.
|
|
12
|
-
github.com/containers/image/v5 v5.
|
|
13
|
-
github.com/golang/groupcache v0.0.0-
|
|
6
|
+
github.com/aws/aws-lambda-go v1.47.0
|
|
7
|
+
github.com/aws/aws-sdk-go-v2 v1.36.3
|
|
8
|
+
github.com/aws/aws-sdk-go-v2/config v1.29.9
|
|
9
|
+
github.com/aws/aws-sdk-go-v2/service/ecr v1.43.0
|
|
10
|
+
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2
|
|
11
|
+
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.35.2
|
|
12
|
+
github.com/containers/image/v5 v5.34.2
|
|
13
|
+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8
|
|
14
14
|
github.com/opencontainers/go-digest v1.0.0
|
|
15
15
|
github.com/pkg/errors v0.9.1
|
|
16
16
|
github.com/sirupsen/logrus v1.9.3
|
|
17
|
-
github.com/stretchr/testify v1.
|
|
18
|
-
|
|
17
|
+
github.com/stretchr/testify v1.10.0
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
require (
|
|
21
|
+
dario.cat/mergo v1.0.1 // indirect
|
|
22
|
+
github.com/BurntSushi/toml v1.4.0 // indirect
|
|
23
|
+
github.com/Microsoft/go-winio v0.6.2 // indirect
|
|
24
|
+
github.com/Microsoft/hcsshim v0.12.9 // indirect
|
|
25
|
+
github.com/VividCortex/ewma v1.2.0 // indirect
|
|
26
|
+
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
|
27
|
+
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
|
28
|
+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect
|
|
29
|
+
github.com/aws/aws-sdk-go-v2/credentials v1.17.62 // indirect
|
|
30
|
+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
|
|
31
|
+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect
|
|
32
|
+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect
|
|
33
|
+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
|
34
|
+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 // indirect
|
|
35
|
+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
|
|
36
|
+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0 // indirect
|
|
37
|
+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
|
|
38
|
+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect
|
|
39
|
+
github.com/aws/aws-sdk-go-v2/service/sso v1.25.1 // indirect
|
|
40
|
+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.1 // indirect
|
|
41
|
+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 // indirect
|
|
42
|
+
github.com/aws/smithy-go v1.22.2 // indirect
|
|
43
|
+
github.com/containerd/cgroups/v3 v3.0.3 // indirect
|
|
44
|
+
github.com/containerd/errdefs v0.3.0 // indirect
|
|
45
|
+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
|
46
|
+
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
|
|
47
|
+
github.com/containerd/typeurl/v2 v2.2.3 // indirect
|
|
48
|
+
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect
|
|
49
|
+
github.com/containers/ocicrypt v1.2.1 // indirect
|
|
50
|
+
github.com/containers/storage v1.57.2 // indirect
|
|
51
|
+
github.com/cyberphone/json-canonicalization v0.0.0-20231217050601-ba74d44ecf5f // indirect
|
|
52
|
+
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
|
|
53
|
+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
|
54
|
+
github.com/distribution/reference v0.6.0 // indirect
|
|
55
|
+
github.com/docker/distribution v2.8.3+incompatible // indirect
|
|
56
|
+
github.com/docker/docker v27.5.1+incompatible // indirect
|
|
57
|
+
github.com/docker/docker-credential-helpers v0.8.2 // indirect
|
|
58
|
+
github.com/docker/go-connections v0.5.0 // indirect
|
|
59
|
+
github.com/docker/go-units v0.5.0 // indirect
|
|
60
|
+
github.com/felixge/httpsnoop v1.0.4 // indirect
|
|
61
|
+
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
|
|
62
|
+
github.com/go-logr/logr v1.4.2 // indirect
|
|
63
|
+
github.com/go-logr/stdr v1.2.2 // indirect
|
|
64
|
+
github.com/go-openapi/analysis v0.23.0 // indirect
|
|
65
|
+
github.com/go-openapi/errors v0.22.0 // indirect
|
|
66
|
+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
|
67
|
+
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
|
68
|
+
github.com/go-openapi/loads v0.22.0 // indirect
|
|
69
|
+
github.com/go-openapi/runtime v0.28.0 // indirect
|
|
70
|
+
github.com/go-openapi/spec v0.21.0 // indirect
|
|
71
|
+
github.com/go-openapi/strfmt v0.23.0 // indirect
|
|
72
|
+
github.com/go-openapi/swag v0.23.0 // indirect
|
|
73
|
+
github.com/go-openapi/validate v0.24.0 // indirect
|
|
74
|
+
github.com/gogo/protobuf v1.3.2 // indirect
|
|
75
|
+
github.com/golang/protobuf v1.5.4 // indirect
|
|
76
|
+
github.com/google/go-containerregistry v0.20.2 // indirect
|
|
77
|
+
github.com/google/go-intervals v0.0.2 // indirect
|
|
78
|
+
github.com/google/uuid v1.6.0 // indirect
|
|
79
|
+
github.com/gorilla/mux v1.8.1 // indirect
|
|
80
|
+
github.com/hashicorp/errwrap v1.1.0 // indirect
|
|
81
|
+
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
|
82
|
+
github.com/josharian/intern v1.0.0 // indirect
|
|
83
|
+
github.com/json-iterator/go v1.1.12 // indirect
|
|
84
|
+
github.com/klauspost/compress v1.17.11 // indirect
|
|
85
|
+
github.com/klauspost/pgzip v1.2.6 // indirect
|
|
86
|
+
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
|
|
87
|
+
github.com/mailru/easyjson v0.7.7 // indirect
|
|
88
|
+
github.com/mattn/go-runewidth v0.0.16 // indirect
|
|
89
|
+
github.com/mattn/go-sqlite3 v1.14.24 // indirect
|
|
90
|
+
github.com/miekg/pkcs11 v1.1.1 // indirect
|
|
91
|
+
github.com/mistifyio/go-zfs/v3 v3.0.1 // indirect
|
|
92
|
+
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
|
93
|
+
github.com/moby/docker-image-spec v1.3.1 // indirect
|
|
94
|
+
github.com/moby/sys/capability v0.4.0 // indirect
|
|
95
|
+
github.com/moby/sys/mountinfo v0.7.2 // indirect
|
|
96
|
+
github.com/moby/sys/user v0.3.0 // indirect
|
|
97
|
+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
98
|
+
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
99
|
+
github.com/oklog/ulid v1.3.1 // indirect
|
|
100
|
+
github.com/opencontainers/image-spec v1.1.0 // indirect
|
|
101
|
+
github.com/opencontainers/runtime-spec v1.2.0 // indirect
|
|
102
|
+
github.com/opencontainers/selinux v1.11.1 // indirect
|
|
103
|
+
github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect
|
|
104
|
+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
105
|
+
github.com/proglottis/gpgme v0.1.4 // indirect
|
|
106
|
+
github.com/rivo/uniseg v0.4.7 // indirect
|
|
107
|
+
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
|
|
108
|
+
github.com/sigstore/fulcio v1.6.4 // indirect
|
|
109
|
+
github.com/sigstore/rekor v1.3.8 // indirect
|
|
110
|
+
github.com/sigstore/sigstore v1.8.12 // indirect
|
|
111
|
+
github.com/smallstep/pkcs7 v0.1.1 // indirect
|
|
112
|
+
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 // indirect
|
|
113
|
+
github.com/sylabs/sif/v2 v2.20.2 // indirect
|
|
114
|
+
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
|
|
115
|
+
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
|
|
116
|
+
github.com/ulikunitz/xz v0.5.12 // indirect
|
|
117
|
+
github.com/vbatts/tar-split v0.11.7 // indirect
|
|
118
|
+
github.com/vbauerster/mpb/v8 v8.9.1 // indirect
|
|
119
|
+
go.mongodb.org/mongo-driver v1.14.0 // indirect
|
|
120
|
+
go.opencensus.io v0.24.0 // indirect
|
|
121
|
+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
|
|
122
|
+
go.opentelemetry.io/otel v1.31.0 // indirect
|
|
123
|
+
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
|
124
|
+
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
|
125
|
+
golang.org/x/crypto v0.35.0 // indirect
|
|
126
|
+
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
|
|
127
|
+
golang.org/x/net v0.36.0 // indirect
|
|
128
|
+
golang.org/x/sync v0.11.0 // indirect
|
|
129
|
+
golang.org/x/sys v0.30.0 // indirect
|
|
130
|
+
golang.org/x/term v0.29.0 // indirect
|
|
131
|
+
golang.org/x/text v0.22.0 // indirect
|
|
132
|
+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
|
|
133
|
+
google.golang.org/grpc v1.69.4 // indirect
|
|
134
|
+
google.golang.org/protobuf v1.36.2 // indirect
|
|
135
|
+
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
19
136
|
)
|