cdk-assets 0.0.0

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.
Files changed (56) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +195 -0
  4. package/bin/cdk-assets +2 -0
  5. package/bin/cdk-assets.d.ts +1 -0
  6. package/bin/cdk-assets.js +70 -0
  7. package/bin/docker-credential-cdk-assets +2 -0
  8. package/bin/docker-credential-cdk-assets.d.ts +13 -0
  9. package/bin/docker-credential-cdk-assets.js +39 -0
  10. package/bin/list.d.ts +3 -0
  11. package/bin/list.js +10 -0
  12. package/bin/logging.d.ts +4 -0
  13. package/bin/logging.js +28 -0
  14. package/bin/publish.d.ts +5 -0
  15. package/bin/publish.js +49 -0
  16. package/lib/asset-manifest.d.ts +162 -0
  17. package/lib/asset-manifest.js +245 -0
  18. package/lib/aws-types.d.ts +1660 -0
  19. package/lib/aws-types.js +138 -0
  20. package/lib/aws.d.ts +70 -0
  21. package/lib/aws.js +125 -0
  22. package/lib/index.d.ts +4 -0
  23. package/lib/index.js +21 -0
  24. package/lib/private/archive.d.ts +3 -0
  25. package/lib/private/archive.js +87 -0
  26. package/lib/private/asset-handler.d.ts +54 -0
  27. package/lib/private/asset-handler.js +3 -0
  28. package/lib/private/docker-credentials.d.ts +35 -0
  29. package/lib/private/docker-credentials.js +89 -0
  30. package/lib/private/docker.d.ts +98 -0
  31. package/lib/private/docker.js +232 -0
  32. package/lib/private/fs-extra.d.ts +3 -0
  33. package/lib/private/fs-extra.js +37 -0
  34. package/lib/private/handlers/client-options.d.ts +3 -0
  35. package/lib/private/handlers/client-options.js +12 -0
  36. package/lib/private/handlers/container-images.d.ts +22 -0
  37. package/lib/private/handlers/container-images.js +224 -0
  38. package/lib/private/handlers/files.d.ts +14 -0
  39. package/lib/private/handlers/files.js +288 -0
  40. package/lib/private/handlers/index.d.ts +3 -0
  41. package/lib/private/handlers/index.js +16 -0
  42. package/lib/private/p-limit.d.ts +10 -0
  43. package/lib/private/p-limit.js +51 -0
  44. package/lib/private/placeholders.d.ts +10 -0
  45. package/lib/private/placeholders.js +34 -0
  46. package/lib/private/shell.d.ts +24 -0
  47. package/lib/private/shell.js +131 -0
  48. package/lib/private/util.d.ts +5 -0
  49. package/lib/private/util.js +16 -0
  50. package/lib/progress.d.ts +114 -0
  51. package/lib/progress.js +104 -0
  52. package/lib/publishing.d.ts +118 -0
  53. package/lib/publishing.js +193 -0
  54. package/package.json +103 -0
  55. package/scripts/manual-test-manifest.json +12 -0
  56. package/scripts/manual-test.sh +22 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ AWS Cloud Development Kit (AWS CDK)
2
+ Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
package/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # cdk-assets
2
+
3
+ <!--BEGIN STABILITY BANNER-->
4
+
5
+ ---
6
+
7
+ > V3 of cdk-assets is still under active development and is subject to non-backward compatible changes while
8
+ > being released with the `rc` suffix.
9
+ >
10
+ > These changes are not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes
11
+ > will be announced in the release notes.
12
+
13
+ ---
14
+
15
+ <!--END STABILITY BANNER-->
16
+
17
+ A tool for publishing CDK assets to AWS environments.
18
+
19
+ ## Overview
20
+
21
+ `cdk-assets` requires an asset manifest file called `assets.json`, in a CDK
22
+ CloudAssembly (`cdk.out/assets.json`). It will take the assets listed in the
23
+ manifest, prepare them as required and upload them to the locations indicated in
24
+ the manifest.
25
+
26
+ Currently the following asset types are supported:
27
+
28
+ - Files and archives, uploaded to S3
29
+ - Docker Images, uploaded to ECR
30
+ - Files, archives, and Docker images built by external utilities
31
+
32
+ S3 buckets and ECR repositories to upload to are expected to exist already.
33
+
34
+ We expect assets to be immutable, and we expect that immutability to be
35
+ reflected both in the asset ID and in the destination location. This reflects
36
+ itself in the following behaviors:
37
+
38
+ - If the indicated asset already exists in the given destination location, it
39
+ will not be packaged and uploaded.
40
+ - If some locally cached artifact (depending on the asset type a file or an
41
+ image in the local Docker cache) already exists named after the asset's ID, it
42
+ will not be packaged, but will be uploaded directly to the destination
43
+ location.
44
+
45
+ For assets build by external utilities, the contract is such that cdk-assets
46
+ expects the utility to manage dedupe detection as well as path/image tag generation.
47
+ This means that cdk-assets will call the external utility every time generation
48
+ is warranted, and it is up to the utility to a) determine whether to do a
49
+ full rebuild; and b) to return only one thing on stdout: the path to the file/archive
50
+ asset, or the name of the local Docker image.
51
+
52
+ ## Usage
53
+
54
+ The `cdk-asset` tool can be used programmatically and via the CLI. Use
55
+ programmatic access if you need more control over authentication than the
56
+ default [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3)
57
+ implementation allows.
58
+
59
+ Command-line use looks like this:
60
+
61
+ ```console
62
+ $ cdk-assets /path/to/cdk.out [ASSET:DEST] [ASSET] [:DEST] [...]
63
+ ```
64
+
65
+ Credentials will be taken from the `AWS_ACCESS_KEY...` environment variables
66
+ or the `default` profile (or another profile if `AWS_PROFILE` is set).
67
+
68
+ A subset of the assets and destinations can be uploaded by specifying their
69
+ asset IDs or destination IDs.
70
+
71
+ ## Manifest Example
72
+
73
+ An asset manifest looks like this:
74
+
75
+ ```json
76
+ {
77
+ "version": "1.22.0",
78
+ "files": {
79
+ "7aac5b80b050e7e4e168f84feffa5893": {
80
+ "source": {
81
+ "path": "some_directory",
82
+ "packaging": "zip"
83
+ },
84
+ "destinations": {
85
+ "us-east-1": {
86
+ "region": "us-east-1",
87
+ "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account",
88
+ "bucketName": "MyBucket",
89
+ "objectKey": "7aac5b80b050e7e4e168f84feffa5893.zip"
90
+ }
91
+ }
92
+ },
93
+ "3dfe2b80b050e7e4e168f84feff678d4": {
94
+ "source": {
95
+ "executable": ["myzip"]
96
+ },
97
+ "destinations": {
98
+ "us-east-1": {
99
+ "region": "us-east-1",
100
+ "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account",
101
+ "bucketName": "MySpecialBucket",
102
+ "objectKey": "3dfe2b80b050e7e4e168f84feff678d4.zip"
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "dockerImages": {
108
+ "b48783c58a86f7b8c68a4591c4f9be31": {
109
+ "source": {
110
+ "directory": "dockerdir"
111
+ },
112
+ "destinations": {
113
+ "us-east-1": {
114
+ "region": "us-east-1",
115
+ "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account",
116
+ "repositoryName": "MyRepository",
117
+ "imageTag": "b48783c58a86f7b8c68a4591c4f9be31",
118
+ "imageUri": "123456789012.dkr.ecr.us-east-1.amazonaws.com/MyRepository:1234567891b48783c58a86f7b8c68a4591c4f9be31"
119
+ }
120
+ }
121
+ },
122
+ "d92753c58a86f7b8c68a4591c4f9cf28": {
123
+ "source": {
124
+ "executable": ["mytool", "package", "dockerdir"]
125
+ },
126
+ "destinations": {
127
+ "us-east-1": {
128
+ "region": "us-east-1",
129
+ "assumeRoleArn": "arn:aws:iam::12345789012:role/my-account",
130
+ "repositoryName": "MyRepository2",
131
+ "imageTag": "d92753c58a86f7b8c68a4591c4f9cf28",
132
+ "imageUri": "123456789987.dkr.ecr.us-east-1.amazonaws.com/MyRepository2:1234567891b48783c58a86f7b8c68a4591c4f9be31"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ ### Placeholders
141
+
142
+ The `destination` block of an asset manifest may contain the following region
143
+ and account placeholders:
144
+
145
+ - `${AWS::Region}`
146
+ - `${AWS::AccountId}`
147
+
148
+ These will be substituted with the region and account IDs currently configured
149
+ on the AWS SDK (through environment variables or `~/.aws/...` config files).
150
+
151
+ - The `${AWS::AccountId}` placeholder will _not_ be re-evaluated after
152
+ performing the `AssumeRole` call.
153
+ - If `${AWS::Region}` is used, it will principally be replaced with the value
154
+ in the `region` key. If the default region is intended, leave the `region`
155
+ key out of the manifest at all.
156
+
157
+ ## Docker image credentials
158
+
159
+ For Docker image asset publishing, `cdk-assets` will `docker login` with
160
+ credentials from ECR GetAuthorizationToken prior to building and publishing, so
161
+ that the Dockerfile can reference images in the account's ECR repo.
162
+
163
+ `cdk-assets` can also be configured to read credentials from both ECR and
164
+ SecretsManager prior to build by creating a credential configuration at
165
+ '~/.cdk/cdk-docker-creds.json' (override this location by setting the
166
+ CDK_DOCKER_CREDS_FILE environment variable). The credentials file has the
167
+ following format:
168
+
169
+ ```json
170
+ {
171
+ "version": "1.0",
172
+ "domainCredentials": {
173
+ "domain1.example.com": {
174
+ "secretsManagerSecretId": "mySecret", // Can be the secret ID or full ARN
175
+ "roleArn": "arn:aws:iam::0123456789012:role/my-role" // (Optional) role with permissions to the secret
176
+ },
177
+ "domain2.example.com": {
178
+ "ecrRepository": true,
179
+ "roleArn": "arn:aws:iam::0123456789012:role/my-role" // (Optional) role with permissions to the repo
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ If the credentials file is present, `docker` will be configured to use the
186
+ `docker-credential-cdk-assets` credential helper for each of the domains listed
187
+ in the file. This helper will assume the role provided (if present), and then fetch
188
+ the login credentials from either SecretsManager or ECR.
189
+
190
+ ## Using Drop-in Docker Replacements
191
+
192
+ By default, the AWS CDK will build and publish Docker image assets using the
193
+ `docker` command. However, by specifying the `CDK_DOCKER` environment variable,
194
+ you can override the command that will be used to build and publish your
195
+ assets.
package/bin/cdk-assets ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./cdk-assets.js');
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const yargs = require("yargs");
4
+ const list_1 = require("./list");
5
+ const logging_1 = require("./logging");
6
+ const publish_1 = require("./publish");
7
+ const lib_1 = require("../lib");
8
+ async function main() {
9
+ const argv = yargs
10
+ .usage('$0 <cmd> [args]')
11
+ .option('verbose', {
12
+ alias: 'v',
13
+ type: 'boolean',
14
+ desc: 'Increase logging verbosity',
15
+ count: true,
16
+ default: 0,
17
+ })
18
+ .option('path', {
19
+ alias: 'p',
20
+ type: 'string',
21
+ desc: 'The path (file or directory) to load the assets from. If a directory, ' +
22
+ `the file '${lib_1.AssetManifest.DEFAULT_FILENAME}' will be loaded from it.`,
23
+ default: '.',
24
+ requiresArg: true,
25
+ })
26
+ .command('ls', 'List assets from the given manifest', (command) => command, wrapHandler(async (args) => {
27
+ await (0, list_1.list)(args);
28
+ }))
29
+ .command('publish [ASSET..]', 'Publish assets in the given manifest', (command) => command
30
+ .option('profile', {
31
+ type: 'string',
32
+ describe: 'Profile to use from AWS Credentials file',
33
+ })
34
+ .positional('ASSET', {
35
+ type: 'string',
36
+ array: true,
37
+ describe: 'Assets to publish (format: "ASSET[:DEST]"), default all',
38
+ }), wrapHandler(async (args) => {
39
+ await (0, publish_1.publish)({
40
+ path: args.path,
41
+ assets: args.ASSET,
42
+ profile: args.profile,
43
+ });
44
+ }))
45
+ .demandCommand()
46
+ .help()
47
+ .strict() // Error on wrong command
48
+ .version(logging_1.VERSION)
49
+ .showHelpOnFail(false).argv;
50
+ // Evaluating .argv triggers the parsing but the command gets implicitly executed,
51
+ // so we don't need the output.
52
+ Array.isArray(argv);
53
+ }
54
+ /**
55
+ * Wrap a command's handler with standard pre- and post-work
56
+ */
57
+ function wrapHandler(handler) {
58
+ return async (argv) => {
59
+ if (argv.verbose) {
60
+ (0, logging_1.setLogThreshold)('verbose');
61
+ }
62
+ await handler(argv);
63
+ };
64
+ }
65
+ main().catch((e) => {
66
+ // eslint-disable-next-line no-console
67
+ console.error(e.stack);
68
+ process.exitCode = 1;
69
+ });
70
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLWFzc2V0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNkay1hc3NldHMudHMiXSwibm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0,0 +1,13 @@
1
+ /**
2
+ * Docker Credential Helper to retrieve credentials based on an external configuration file.
3
+ * Supports loading credentials from ECR repositories and from Secrets Manager,
4
+ * optionally via an assumed role.
5
+ *
6
+ * The only operation currently supported by this credential helper at this time is the `get`
7
+ * command, which receives a domain name as input on stdin and returns a Username/Secret in
8
+ * JSON format on stdout.
9
+ *
10
+ * IMPORTANT - The credential helper must not output anything else besides the final credentials
11
+ * in any success case; doing so breaks docker's parsing of the output and causes the login to fail.
12
+ */
13
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Docker Credential Helper to retrieve credentials based on an external configuration file.
4
+ * Supports loading credentials from ECR repositories and from Secrets Manager,
5
+ * optionally via an assumed role.
6
+ *
7
+ * The only operation currently supported by this credential helper at this time is the `get`
8
+ * command, which receives a domain name as input on stdin and returns a Username/Secret in
9
+ * JSON format on stdout.
10
+ *
11
+ * IMPORTANT - The credential helper must not output anything else besides the final credentials
12
+ * in any success case; doing so breaks docker's parsing of the output and causes the login to fail.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const fs = require("fs");
16
+ const lib_1 = require("../lib");
17
+ const docker_credentials_1 = require("../lib/private/docker-credentials");
18
+ async function main() {
19
+ // Expected invocation is [node, docker-credential-cdk-assets, get] with input fed via STDIN
20
+ // For other valid docker commands (store, list, erase), we no-op.
21
+ if (process.argv.length !== 3 || process.argv[2] !== 'get') {
22
+ process.exit(0);
23
+ }
24
+ const config = (0, docker_credentials_1.cdkCredentialsConfig)();
25
+ if (!config) {
26
+ throw new Error(`unable to find CDK Docker credentials at: ${(0, docker_credentials_1.cdkCredentialsConfigFile)()}`);
27
+ }
28
+ // Read the domain to fetch from stdin
29
+ let endpoint = fs.readFileSync(0, { encoding: 'utf-8' }).trim();
30
+ const credentials = await (0, docker_credentials_1.fetchDockerLoginCredentials)(new lib_1.DefaultAwsClient(), config, endpoint);
31
+ // Write the credentials back to stdout
32
+ fs.writeFileSync(1, JSON.stringify(credentials));
33
+ }
34
+ main().catch((e) => {
35
+ // eslint-disable-next-line no-console
36
+ console.error(e.stack);
37
+ process.exitCode = 1;
38
+ });
39
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9ja2VyLWNyZWRlbnRpYWwtY2RrLWFzc2V0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImRvY2tlci1jcmVkZW50aWFsLWNkay1hc3NldHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7OztHQVdHOztBQUVILHlCQUF5QjtBQUN6QixnQ0FBMEM7QUFFMUMsMEVBSTJDO0FBRTNDLEtBQUssVUFBVSxJQUFJO0lBQ2pCLDRGQUE0RjtJQUM1RixrRUFBa0U7SUFDbEUsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxDQUFDLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsS0FBSyxLQUFLLEVBQUUsQ0FBQztRQUMzRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ2xCLENBQUM7SUFFRCxNQUFNLE1BQU0sR0FBRyxJQUFBLHlDQUFvQixHQUFFLENBQUM7SUFDdEMsSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDO1FBQ1osTUFBTSxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsSUFBQSw2Q0FBd0IsR0FBRSxFQUFFLENBQUMsQ0FBQztJQUM3RixDQUFDO0lBRUQsc0NBQXNDO0lBQ3RDLElBQUksUUFBUSxHQUFHLEVBQUUsQ0FBQyxZQUFZLENBQUMsQ0FBQyxFQUFFLEVBQUUsUUFBUSxFQUFFLE9BQU8sRUFBRSxDQUFDLENBQUMsSUFBSSxFQUFFLENBQUM7SUFDaEUsTUFBTSxXQUFXLEdBQUcsTUFBTSxJQUFBLGdEQUEyQixFQUFDLElB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MgYXQ6ICR7Y2RrQ3JlZGVudGlhbHNDb25maWdGaWxlKCl9YCk7XG4gIH1cblxuICAvLyBSZWFkIHRoZSBkb21haW4gdG8gZmV0Y2ggZnJvbSBzdGRpblxuICBsZXQgZW5kcG9pbnQgPSBmcy5yZWFkRmlsZVN5bmMoMCwgeyBlbmNvZGluZzogJ3V0Zi04JyB9KS50cmltKCk7XG4gIGNvbnN0IGNyZWRlbnRpYWxzID0gYXdhaXQgZmV0Y2hEb2NrZXJMb2dpbkNyZWRlbnRpYWxzKG5ldyBEZWZhdWx0QXdzQ2xpZW50KCksIGNvbmZpZywgZW5kcG9pbnQpO1xuICAvLyBXcml0ZSB0aGUgY3JlZGVudGlhbHMgYmFjayB0byBzdGRvdXRcbiAgZnMud3JpdGVGaWxlU3luYygxLCBKU09OLnN0cmluZ2lmeShjcmVkZW50aWFscykpO1xufVxuXG5tYWluKCkuY2F0Y2goKGUpID0+IHtcbiAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWNvbnNvbGVcbiAgY29uc29sZS5lcnJvcihlLnN0YWNrKTtcbiAgcHJvY2Vzcy5leGl0Q29kZSA9IDE7XG59KTtcbiJdfQ==
package/bin/list.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare function list(args: {
2
+ path: string;
3
+ }): Promise<void>;
package/bin/list.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.list = list;
4
+ const lib_1 = require("../lib");
5
+ async function list(args) {
6
+ const manifest = lib_1.AssetManifest.fromPath(args.path);
7
+ // eslint-disable-next-line no-console
8
+ console.log(manifest.list().join('\n'));
9
+ }
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImxpc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxvQkFJQztBQU5ELGdDQUF1QztBQUVoQyxLQUFLLFVBQVUsSUFBSSxDQUFDLElBQXNCO0lBQy9DLE1BQU0sUUFBUSxHQUFHLG1CQUFhLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNuRCxzQ0FBc0M7SUFDdEMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsSUFBSSxFQUFFLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7QUFDMUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEFzc2V0TWFuaWZlc3QgfSBmcm9tICcuLi9saWInO1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gbGlzdChhcmdzOiB7IHBhdGg6IHN0cmluZyB9KSB7XG4gIGNvbnN0IG1hbmlmZXN0ID0gQXNzZXRNYW5pZmVzdC5mcm9tUGF0aChhcmdzLnBhdGgpO1xuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICBjb25zb2xlLmxvZyhtYW5pZmVzdC5saXN0KCkuam9pbignXFxuJykpO1xufVxuIl19
@@ -0,0 +1,4 @@
1
+ export type LogLevel = 'verbose' | 'info' | 'error';
2
+ export declare const VERSION: any;
3
+ export declare function setLogThreshold(threshold: LogLevel): void;
4
+ export declare function log(level: LogLevel, message: string, stream?: 'stdout' | 'stderr'): void;
package/bin/logging.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ exports.setLogThreshold = setLogThreshold;
5
+ exports.log = log;
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ let logThreshold = 'info';
9
+ exports.VERSION = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), { encoding: 'utf-8' })).version;
10
+ const LOG_LEVELS = {
11
+ verbose: 1,
12
+ info: 2,
13
+ error: 3,
14
+ };
15
+ function setLogThreshold(threshold) {
16
+ logThreshold = threshold;
17
+ }
18
+ function log(level, message, stream) {
19
+ if (LOG_LEVELS[level] >= LOG_LEVELS[logThreshold]) {
20
+ if (stream === 'stdout') {
21
+ console.log(`${level.padEnd(7, ' ')}: ${message}`);
22
+ }
23
+ else {
24
+ console.error(`${level.padEnd(7, ' ')}: ${message}`);
25
+ }
26
+ }
27
+ }
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2luZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImxvZ2dpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBZ0JBLDBDQUVDO0FBRUQsa0JBUUM7QUE1QkQseUJBQXlCO0FBQ3pCLDZCQUE2QjtBQUc3QixJQUFJLFlBQVksR0FBYSxNQUFNLENBQUM7QUFFdkIsUUFBQSxPQUFPLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FDL0IsRUFBRSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxJQUFJLEVBQUUsY0FBYyxDQUFDLEVBQUUsRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLENBQUMsQ0FDbkYsQ0FBQyxPQUFPLENBQUM7QUFFVixNQUFNLFVBQVUsR0FBNkI7SUFDM0MsT0FBTyxFQUFFLENBQUM7SUFDVixJQUFJLEVBQUUsQ0FBQztJQUNQLEtBQUssRUFBRSxDQUFDO0NBQ1QsQ0FBQztBQUVGLFNBQWdCLGVBQWUsQ0FBQyxTQUFtQjtJQUNqRCxZQUFZLEdBQUcsU0FBUyxDQUFDO0FBQzNCLENBQUM7QUFFRCxTQUFnQixHQUFHLENBQUMsS0FBZSxFQUFFLE9BQWUsRUFBRSxNQUE0QjtJQUNoRixJQUFJLFVBQVUsQ0FBQyxLQUFLLENBQUMsSUFBSSxVQUFVLENBQUMsWUF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ydCBmdW5jdGlvbiBsb2cobGV2ZWw6IExvZ0xldmVsLCBtZXNzYWdlOiBzdHJpbmcsIHN0cmVhbT86ICdzdGRvdXQnIHwgJ3N0ZGVycicpIHtcbiAgaWYgKExPR19MRVZFTFNbbGV2ZWxdID49IExPR19MRVZFTFNbbG9nVGhyZXNob2xkXSkge1xuICAgIGlmIChzdHJlYW0gPT09ICdzdGRvdXQnKSB7XG4gICAgICBjb25zb2xlLmxvZyhgJHtsZXZlbC5wYWRFbmQoNywgJyAnKX06ICR7bWVzc2FnZX1gKTtcbiAgICB9IGVsc2Uge1xuICAgICAgY29uc29sZS5lcnJvcihgJHtsZXZlbC5wYWRFbmQoNywgJyAnKX06ICR7bWVzc2FnZX1gKTtcbiAgICB9XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,5 @@
1
+ export declare function publish(args: {
2
+ path: string;
3
+ assets?: string[];
4
+ profile?: string;
5
+ }): Promise<void>;