@ibm-cloud/cd-tools 1.15.24 → 1.15.25

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/README.md CHANGED
@@ -81,8 +81,8 @@ Examples:
81
81
  Copy all the Git Repos and Issue Tracking projects in the group "mygroup" from the Toronto region to the Dallas, with the same group name.
82
82
 
83
83
  Options:
84
- -s, --source-region <region> The source region from which to copy the project group (choices: "au-syd", "br-sao", "ca-mon", "ca-tor", "eu-de", "eu-es", "eu-gb", "jp-osa", "jp-tok", "us-east", "us-south")
85
- -d, --dest-region <region> The destination region to copy the projects to (choices: "au-syd", "br-sao", "ca-mon", "ca-tor", "eu-de", "eu-es", "eu-gb", "jp-osa", "jp-tok", "us-east", "us-south")
84
+ -s, --source-region <region> The source region from which to copy the project group (choices: "au-syd", "br-sao", "ca-tor", "eu-de", "eu-gb", "jp-tok", "us-east", "us-south")
85
+ -d, --dest-region <region> The destination region to copy the projects to (choices: "au-syd", "br-sao", "ca-tor", "eu-de", "eu-gb", "jp-tok", "us-east", "us-south")
86
86
  --st, --source-token <token> A Git Repos and Issue Tracking personal access token from the source region. The api scope is required on the token.
87
87
  --dt, --dest-token <token> A Git Repos and Issue Tracking personal access token from the target region. The api scope is required on the token.
88
88
  -g, --group-id <id> The id of the group to copy from the source region (e.g. "1796019"), or the group name (e.g. "mygroup") for top-level groups. For sub-groups, a path
@@ -148,7 +148,7 @@ Environment Variables:
148
148
 
149
149
  Basic options:
150
150
  -c, --toolchain-crn <crn> The CRN of the source toolchain to copy
151
- -r, --region <region> The destination region of the copied toolchain (choices: "au-syd", "br-sao", "ca-mon", "ca-tor", "eu-de", "eu-es", "eu-gb", "jp-osa", "jp-tok", "us-east", "us-south")
151
+ -r, --region <region> The destination region of the copied toolchain (choices: "au-syd", "br-sao", "ca-tor", "eu-de", "eu-gb", "jp-tok", "us-east", "us-south")
152
152
  -a, --apikey <api_key> API key used to authenticate. Must be a user API key, with IAM permission to read and create toolchains and service-to-service authorizations in source and target region / resource group
153
153
  -n, --name <name> (Optional) The name of the copied toolchain (default: same name as original)
154
154
  -g, --resource-group <resource_group> (Optional) The name or ID of destination resource group of the copied toolchain (default: same resource group as original)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Licensed Materials - Property of IBM
3
- * (c) Copyright IBM Corporation 2025. All Rights Reserved.
3
+ * (c) Copyright IBM Corporation 2025, 2026. All Rights Reserved.
4
4
  *
5
5
  * Note to U.S. Government Users Restricted Rights:
6
6
  * Use, duplication or disclosure restricted by GSA ADP Schedule
@@ -925,8 +925,8 @@ async function directTransfer(options) {
925
925
  const command = new Command('copy-project-group')
926
926
  .summary('Copies all Git Repos and Issue Tracking projects in a group to another region.')
927
927
  .description(COPY_PROJECT_GROUP_DESC)
928
- .requiredOption('-s, --source-region <region>', 'The source region from which to copy the project group (choices: "au-syd", "br-sao", "ca-mon", "ca-tor", "eu-de", "eu-es", "eu-gb", "jp-osa", "jp-tok", "us-east", "us-south")')
929
- .requiredOption('-d, --dest-region <region>', 'The destination region to copy the projects to (choices: "au-syd", "br-sao", "ca-mon", "ca-tor", "eu-de", "eu-es", "eu-gb", "jp-osa", "jp-tok", "us-east", "us-south")')
928
+ .requiredOption('-s, --source-region <region>', 'The source region from which to copy the project group (choices: "au-syd", "br-sao", "ca-tor", "eu-de", "eu-gb", "jp-tok", "us-east", "us-south")')
929
+ .requiredOption('-d, --dest-region <region>', 'The destination region to copy the projects to (choices: "au-syd", "br-sao", "ca-tor", "eu-de", "eu-gb", "jp-tok", "us-east", "us-south")')
930
930
  .requiredOption('--st, --source-token <token>', 'A Git Repos and Issue Tracking personal access token from the source region. The api scope is required on the token.')
931
931
  .requiredOption('--dt, --dest-token <token>', 'A Git Repos and Issue Tracking personal access token from the target region. The api scope is required on the token.')
932
932
  .requiredOption('-g, --group-id <id>', 'The id of the group to copy from the source region (e.g. "1796019"), or the group name (e.g. "mygroup") for top-level groups. For sub-groups, a path is also allowed, e.g. "mygroup/subgroup"')
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Licensed Materials - Property of IBM
3
- * (c) Copyright IBM Corporation 2025. All Rights Reserved.
3
+ * (c) Copyright IBM Corporation 2025, 2026. All Rights Reserved.
4
4
  *
5
5
  * Note to U.S. Government Users Restricted Rights:
6
6
  * Use, duplication or disclosure restricted by GSA ADP Schedule
@@ -13,7 +13,7 @@ import { parse as tfToJson } from '@cdktf/hcl2json'
13
13
  import { jsonToTf } from 'json-to-tf';
14
14
 
15
15
  import { getPipelineData, getToolchainTools } from './requests.js';
16
- import { runTerraformPlanGenerate, setTerraformEnv } from './terraform.js';
16
+ import { initProviderFile, runTerraformPlanGenerate, setTerraformEnv } from './terraform.js';
17
17
  import { escapeReservedChars, getRandChars, isSecretReference, normalizeName } from './utils.js';
18
18
  import { logger } from './logger.js';
19
19
 
@@ -157,6 +157,7 @@ export async function importTerraform(token, apiKey, region, toolchainId, toolch
157
157
  importBlocksToTf(importBlocks, dir);
158
158
 
159
159
  if (!fs.existsSync(`${dir}/generated`)) fs.mkdirSync(`${dir}/generated`);
160
+ await initProviderFile(region, `${dir}/generated`);
160
161
 
161
162
  // STEP 2/2: run terraform import and post-processing
162
163
  setTerraformEnv(apiKey, verbosity);
@@ -381,8 +382,9 @@ function importBlocksToTf(blocks, dir) {
381
382
 
382
383
  blocks.forEach((block) => {
383
384
  const template = `import {
384
- id = "${block.id}"
385
- to = ${block.to}
385
+ id = "${block.id}"
386
+ to = ${block.to}
387
+ provider = ibm
386
388
  }\n\n`;
387
389
  fileContent += template;
388
390
  });
package/config.js CHANGED
@@ -30,12 +30,9 @@ const DOCS_URL = 'https://github.com/IBM/continuous-delivery-tools';
30
30
  const SOURCE_REGIONS = [
31
31
  'au-syd',
32
32
  'br-sao',
33
- 'ca-mon',
34
33
  'ca-tor',
35
34
  'eu-de',
36
- 'eu-es',
37
35
  'eu-gb',
38
- 'jp-osa',
39
36
  'jp-tok',
40
37
  'us-east',
41
38
  'us-south'
@@ -44,12 +41,9 @@ const SOURCE_REGIONS = [
44
41
  const TARGET_REGIONS = [
45
42
  'au-syd',
46
43
  'br-sao',
47
- 'ca-mon',
48
44
  'ca-tor',
49
45
  'eu-de',
50
- 'eu-es',
51
46
  'eu-gb',
52
- 'jp-osa',
53
47
  'jp-tok',
54
48
  'us-east',
55
49
  'us-south'
@@ -58,12 +52,9 @@ const TARGET_REGIONS = [
58
52
  const BROKER_REGIONS = [
59
53
  'au-syd',
60
54
  'br-sao',
61
- 'ca-mon',
62
55
  'ca-tor',
63
56
  'eu-de',
64
- 'eu-es',
65
57
  'eu-gb',
66
- 'jp-osa',
67
58
  'jp-tok',
68
59
  'us-east',
69
60
  'us-south'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibm-cloud/cd-tools",
3
- "version": "1.15.24",
3
+ "version": "1.15.25",
4
4
  "description": "Tools and utilities for the IBM Cloud Continuous Delivery service and resources",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,11 +29,12 @@ const CLI_PATH = path.resolve('index.js');
29
29
  const COMMAND = 'copy-toolchain';
30
30
 
31
31
  const toolchainsToDelete = new Map();
32
- after(async () => await deleteCreatedToolchains(toolchainsToDelete));
33
32
 
34
33
  describe('copy-toolchain: Test functionalities', function () {
35
34
  this.timeout('300s');
36
35
  this.command = COMMAND;
36
+
37
+ after(async () => await deleteCreatedToolchains(toolchainsToDelete));
37
38
  const testCases = [
38
39
  {
39
40
  name: 'Terraform Version Verification',
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Licensed Materials - Property of IBM
3
- * (c) Copyright IBM Corporation 2025. All Rights Reserved.
3
+ * (c) Copyright IBM Corporation 2025, 2026. All Rights Reserved.
4
4
  *
5
5
  * Note to U.S. Government Users Restricted Rights:
6
6
  * Use, duplication or disclosure restricted by GSA ADP Schedule
@@ -25,15 +25,16 @@ const CLI_PATH = path.resolve('index.js');
25
25
  const COMMAND = 'copy-toolchain';
26
26
 
27
27
  const toolchainsToDelete = new Map();
28
- after(async () => await deleteCreatedToolchains(toolchainsToDelete));
29
28
 
30
29
  describe('copy-toolchain: Test tool validation', function () {
31
30
  this.timeout('300s');
32
31
  this.command = COMMAND;
32
+
33
+ after(async () => await deleteCreatedToolchains(toolchainsToDelete));
33
34
  const testCases = [
34
35
  {
35
36
  name: 'Misconfigured tool identified',
36
- cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['1pl-ghe-cd'].crn, '-r', TARGET_REGIONS[10]],
37
+ cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['1pl-ghe-cd'].crn, '-r', TARGET_REGIONS[7]],
37
38
  expected: /slack[\s\S]*?misconfigured/,
38
39
  options: {
39
40
  exitCondition: 'Caution: The above tool(s) will not be properly configured post migration. Do you want to proceed?',
@@ -45,7 +46,7 @@ describe('copy-toolchain: Test tool validation', function () {
45
46
  },
46
47
  {
47
48
  name: 'Tools with plain text secrets identified',
48
- cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['1pl-ghe-cd'].crn, '-r', TARGET_REGIONS[10]],
49
+ cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['1pl-ghe-cd'].crn, '-r', TARGET_REGIONS[7]],
49
50
  expected: null,
50
51
  options: {
51
52
  exitCondition: 'Caution: The above tool(s) will not be properly configured post migration. Do you want to proceed?',
@@ -62,7 +63,7 @@ describe('copy-toolchain: Test tool validation', function () {
62
63
  },
63
64
  {
64
65
  name: 'Classic pipelines are identified',
65
- cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['misconfigured'].crn, '-r', TARGET_REGIONS[10]],
66
+ cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['misconfigured'].crn, '-r', TARGET_REGIONS[0]],
66
67
  expected: /Warning! Classic pipelines are currently not supported in migration/,
67
68
  options: {
68
69
  exitCondition: 'Caution: The above tool(s) will not be properly configured post migration. Do you want to proceed?',
@@ -74,7 +75,7 @@ describe('copy-toolchain: Test tool validation', function () {
74
75
  },
75
76
  {
76
77
  name: 'Git tools using PAT are identified',
77
- cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['misconfigured'].crn, '-r', TARGET_REGIONS[10]],
78
+ cmd: [CLI_PATH, COMMAND, '-c', TEST_TOOLCHAINS['misconfigured'].crn, '-r', TARGET_REGIONS[0]],
78
79
  expected: null,
79
80
  options: {
80
81
  exitCondition: 'Caution: The above tool(s) will not be properly configured post migration. Do you want to proceed?',