@ibm-cloud/cd-tools 1.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.
package/config.js ADDED
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Licensed Materials - Property of IBM
3
+ * (c) Copyright IBM Corporation 2025. All Rights Reserved.
4
+ *
5
+ * Note to U.S. Government Users Restricted Rights:
6
+ * Use, duplication or disclosure restricted by GSA ADP Schedule
7
+ * Contract with IBM Corp.
8
+ */
9
+
10
+ const COPY_TOOLCHAIN_DESC = `Copies a toolchain, including tool integrations and Tekton pipelines, to another region or resource group.
11
+
12
+ Examples:
13
+ export IBMCLOUD_API_KEY='...'
14
+ npx @ibm-cloud/cd-migration-tools copy-toolchain -c \${TOOLCHAIN_CRN} -r us-south
15
+ Copy a toolchain to the Dallas region with the same name, in the same resource group.
16
+ npx @ibm-cloud/cd-migration-tools copy-toolchain -c \${TOOLCHAIN_CRN} -r eu-de -n new-toolchain-name -g new-resource-group --apikey \${APIKEY}
17
+ Copy a toolchain to the Frankfurt region with the specified name and target resource group, using the given API key
18
+
19
+ Environment Variables:
20
+ IBMCLOUD_API_KEY API Key used to perform the copy. Must have IAM permission to read and create toolchains and S2S authorizations in source and target region / resource group`
21
+
22
+ const MIGRATION_DOC_URL = 'https://github.com/IBM/continuous-delivery-tools'; // TODO: replace with docs link
23
+
24
+ const SOURCE_REGIONS = [
25
+ 'au-syd',
26
+ 'br-sao',
27
+ 'ca-mon',
28
+ 'ca-tor',
29
+ 'eu-de',
30
+ 'eu-es',
31
+ 'eu-gb',
32
+ 'jp-osa',
33
+ 'jp-tok',
34
+ 'us-east',
35
+ 'us-south'
36
+ ];
37
+
38
+ const TARGET_REGIONS = [
39
+ 'au-syd',
40
+ 'br-sao',
41
+ 'ca-mon',
42
+ 'ca-tor',
43
+ 'eu-de',
44
+ 'eu-es',
45
+ 'eu-gb',
46
+ 'jp-osa',
47
+ 'jp-tok',
48
+ 'us-east',
49
+ 'us-south'
50
+ ];
51
+
52
+ const TERRAFORM_REQUIRED_VERSION = '1.13.3';
53
+
54
+ const TERRAFORMER_REQUIRED_VERSION = '0.8.30';
55
+
56
+ // see https://docs.gitlab.com/user/reserved_names/
57
+ const RESERVED_GRIT_PROJECT_NAMES = [
58
+ '\\-',
59
+ 'badges',
60
+ 'blame',
61
+ 'blob',
62
+ 'builds',
63
+ 'commits',
64
+ 'create',
65
+ 'create_dir',
66
+ 'edit',
67
+ 'environments/folders',
68
+ 'files',
69
+ 'find_file',
70
+ 'gitlab-lfs/objects',
71
+ 'info/lfs/objects',
72
+ 'new',
73
+ 'preview',
74
+ 'raw',
75
+ 'refs',
76
+ 'tree',
77
+ 'update',
78
+ 'wikis'
79
+ ];
80
+
81
+ const RESERVED_GRIT_GROUP_NAMES = [
82
+ '\\-',
83
+ '.well-known',
84
+ '404.html',
85
+ '422.html',
86
+ '500.html',
87
+ '502.html',
88
+ '503.html',
89
+ 'admin',
90
+ 'api',
91
+ 'apple-touch-icon.png',
92
+ 'assets',
93
+ 'dashboard',
94
+ 'deploy.html',
95
+ 'explore',
96
+ 'favicon.ico',
97
+ 'favicon.png',
98
+ 'files',
99
+ 'groups',
100
+ 'health_check',
101
+ 'help',
102
+ 'import',
103
+ 'jwt',
104
+ 'login',
105
+ 'oauth',
106
+ 'profile',
107
+ 'projects',
108
+ 'public',
109
+ 'robots.txt',
110
+ 's',
111
+ 'search',
112
+ 'sitemap',
113
+ 'sitemap.xml',
114
+ 'sitemap.xml.gz',
115
+ 'slash-command-logo.png',
116
+ 'snippets',
117
+ 'unsubscribes',
118
+ 'uploads',
119
+ 'users',
120
+ 'v2'
121
+ ];
122
+
123
+ const RESERVED_GRIT_SUBGROUP_NAME = '\\-';
124
+
125
+ const UPDATEABLE_SECRET_PROPERTIES_BY_TOOL_TYPE = {
126
+ "artifactory": [
127
+ "token"
128
+ ],
129
+ "cloudobjectstorage": [
130
+ "cos_api_key",
131
+ "hmac_access_key_id",
132
+ "hmac_secret_access_key"
133
+ ],
134
+ "github_integrated": [
135
+ "api_token"
136
+ ],
137
+ "githubconsolidated": [
138
+ "api_token"
139
+ ],
140
+ "gitlab": [
141
+ "api_token"
142
+ ],
143
+ "hashicorpvault": [
144
+ "token",
145
+ "role_id",
146
+ "secret_id",
147
+ "password"
148
+ ],
149
+ "hostedgit": [
150
+ "api_token"
151
+ ],
152
+ "jenkins": [
153
+ "api_token"
154
+ ],
155
+ "jira": [
156
+ "password",
157
+ "api_token"
158
+ ],
159
+ "nexus": [
160
+ "token"
161
+ ],
162
+ "pagerduty": [
163
+ "service_key"
164
+ ],
165
+ "private_worker": [
166
+ "workerQueueCredentials"
167
+ ],
168
+ "saucelabs": [
169
+ "key",
170
+ "access_key"
171
+ ],
172
+ "security_compliance": [
173
+ "scc_api_key"
174
+ ],
175
+ "slack": [
176
+ "api_token",
177
+ "webhook"
178
+ ],
179
+ "sonarqube": [
180
+ "user_password"
181
+ ]
182
+ };
183
+
184
+ const VAULT_REGEX = [
185
+ new RegExp('[\\{]{1}(?<reference>\\b(?<provider>vault)\\b[:]{2}(?<integration>[ a-zA-Z0-9_-]*)[.]{0,1}(?<secret>.*))[\\}]{1}', 'iu'),
186
+ new RegExp('^(?<reference>crn:v1:(?:bluemix|staging):public:(?<type>secrets-manager):(?<region>[a-zA-Z0-9-]*)\\b:a\/(?<account_id>[0-9a-fA-F]*)\\b:(?<instance_id>[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})\\b:secret:(?<secret_id>[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}))$', 'iu'),
187
+ new RegExp('(?<reference>(?<type>ref:[\\/]{2}secrets-manager)[.]{1}(?<instance_path>.*))', 'iu')
188
+ ];
189
+
190
+ export {
191
+ COPY_TOOLCHAIN_DESC,
192
+ UPDATEABLE_SECRET_PROPERTIES_BY_TOOL_TYPE,
193
+ MIGRATION_DOC_URL,
194
+ SOURCE_REGIONS,
195
+ TARGET_REGIONS,
196
+ TERRAFORM_REQUIRED_VERSION,
197
+ TERRAFORMER_REQUIRED_VERSION,
198
+ RESERVED_GRIT_PROJECT_NAMES,
199
+ RESERVED_GRIT_GROUP_NAMES,
200
+ RESERVED_GRIT_SUBGROUP_NAME,
201
+ VAULT_REGEX
202
+ };
package/index.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Licensed Materials - Property of IBM
4
+ * (c) Copyright IBM Corporation 2025. All Rights Reserved.
5
+ *
6
+ * Note to U.S. Government Users Restricted Rights:
7
+ * Use, duplication or disclosure restricted by GSA ADP Schedule
8
+ * Contract with IBM Corp.
9
+ */
10
+
11
+ import { program } from 'commander';
12
+ import * as commands from './cmd/index.js'
13
+
14
+ program
15
+ .name('index.js')
16
+ .description('Tools and utilities for the IBM Cloud Continuous Delivery service and resources.')
17
+ .version('0.0.1')
18
+ .showHelpAfterError();
19
+
20
+ for (let i in commands) {
21
+ program.addCommand(commands[i]);
22
+ }
23
+
24
+ program.parseAsync();
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@ibm-cloud/cd-tools",
3
+ "version": "1.0.0",
4
+ "description": "Tools and utilities for the IBM Cloud Continuous Delivery service and resources",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/IBM/continuous-delivery-tools"
8
+ },
9
+ "keywords": [
10
+ "ibm"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "author": "IBM Corp.",
16
+ "license": "Apache-2.0",
17
+ "dependencies": {
18
+ "@cdktf/hcl2json": "^0.21.0",
19
+ "axios": "^1.12.2",
20
+ "axios-retry": "^4.5.0",
21
+ "cli-table3": "^0.6.5",
22
+ "commander": "^14.0.1",
23
+ "json-to-tf": "^0.3.1",
24
+ "ora": "^9.0.0",
25
+ "strip-ansi": "^7.1.2"
26
+ },
27
+ "type": "module"
28
+ }