@ibm-cloud/cd-tools 1.11.1 → 1.11.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/README.md CHANGED
@@ -74,15 +74,20 @@ The `copy-project-group` command copies a [group](https://docs.gitlab.com/user/g
74
74
  $ npx @ibm-cloud/cd-tools copy-project-group -h
75
75
  Usage: @ibm-cloud/cd-tools copy-project-group [options]
76
76
 
77
- Bulk migrate GitLab group projects
77
+ Copies all Git Repos and Issue Tracking projects in a group to another region.
78
+
79
+ Examples:
80
+ npx @ibm-cloud/cd-tools copy-project-group -g "1796019" -s ca-tor -d us-south --st ${PAT_CA_TOR} --dt ${PAT_US_SOUTH}
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.
78
82
 
79
83
  Options:
80
- -s, --source-region <region> Source GitLab instance region
81
- -d, --dest-region <region> Destination GitLab instance region
82
- --st, --source-token <token> Source GitLab access token
83
- --dt, --dest-token <token> Destination GitLab access token
84
- -g, --group-id <id> Source group ID to migrate
85
- -n, --new-name <n> New group path (optional)
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")
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
+ --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
+ -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
89
+ is also allowed, e.g. "mygroup/subgroup"
90
+ -n, --new-group-slug <slug> (Optional) Destination group URL slug (single path segment, e.g. "mygroup-copy"). Must be unique. Group display name remains the same as source.
86
91
  -h, --help display help for command
87
92
  ```
88
93
 
@@ -153,7 +158,7 @@ Advanced options:
153
158
  -d, --terraform-dir <path> (Optional) The target local directory to store the generated Terraform (.tf) files
154
159
  -D, --dry-run (Optional) Skip running terraform apply; only generate the Terraform (.tf) files
155
160
  -f, --force (Optional) Force the copy toolchain command to run without user confirmation
156
- -S, --skip-s2s (Optional) Skip importing toolchain-generated service-to-service authorizations
161
+ -S, --skip-s2s (Optional) Skip creating toolchain-generated service-to-service authorizations
157
162
  -T, --skip-disable-triggers (Optional) Skip disabling Tekton pipeline Git or timed triggers. Note: This may result in duplicate pipeline runs
158
163
  -C, --compact (Optional) Generate all resources in a single resources.tf file
159
164
  -v, --verbose (Optional) Increase log output
@@ -11,7 +11,7 @@ import { Command } from 'commander';
11
11
  import axios from 'axios';
12
12
  import readline from 'readline/promises';
13
13
  import { writeFile } from 'fs/promises';
14
- import { SOURCE_REGIONS } from '../config.js';
14
+ import { COPY_PROJECT_GROUP_DESC, SOURCE_REGIONS } from '../config.js';
15
15
  import { getWithRetry } from './utils/requests.js';
16
16
 
17
17
  const HTTP_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes default
@@ -480,7 +480,7 @@ async function handleBulkImportConflict({ destination, destUrl, sourceGroupFullP
480
480
  }
481
481
 
482
482
  console.log(`\nConflict detected: ${importResErr}`);
483
- console.log(`Please specify a new group name using -n, --new-name <n> when trying again`);
483
+ console.log(`Please specify a new group name using -n, --new-group-slug <n> when trying again`);
484
484
  console.log(`\nGroup already migrated.`);
485
485
  if (groupUrl) console.log(`Migrated group: ${groupUrl}`);
486
486
  if (historyUrl) console.log(`Group import history: ${historyUrl}`);
@@ -507,7 +507,7 @@ async function directTransfer(options) {
507
507
  console.log(`Fetching source group from ID: ${options.groupId}...`);
508
508
  const sourceGroup = await source.getGroup(options.groupId);
509
509
 
510
- let destinationGroupPath = options.newName || sourceGroup.path;
510
+ let destinationGroupPath = options.newGroupSlug || sourceGroup.path;
511
511
 
512
512
  let sourceProjects;
513
513
  try {
@@ -527,8 +527,8 @@ async function directTransfer(options) {
527
527
  sourceProjects.forEach(p => console.log(p.name_with_namespace || p.nameWithNamespace || p.fullPath));
528
528
  }
529
529
 
530
- if (options.newName) {
531
- await promptUser(options.newName);
530
+ if (options.newGroupSlug) {
531
+ await promptUser(options.newGroupSlug);
532
532
  }
533
533
 
534
534
  // Generate URL mapping JSON before starting the migration
@@ -677,13 +677,14 @@ async function directTransfer(options) {
677
677
  }
678
678
 
679
679
  const command = new Command('copy-project-group')
680
- .description('Bulk migrate GitLab group projects')
681
- .requiredOption('-s, --source-region <region>', 'Source GitLab instance region')
682
- .requiredOption('-d, --dest-region <region>', 'Destination GitLab instance region')
683
- .requiredOption('--st, --source-token <token>', 'Source GitLab access token')
684
- .requiredOption('--dt, --dest-token <token>', 'Destination GitLab access token')
685
- .requiredOption('-g, --group-id <id>', 'Source group ID to migrate')
686
- .option('-n, --new-name <n>', 'New group path (optional)')
680
+ .summary('Copies all Git Repos and Issue Tracking projects in a group to another region.')
681
+ .description(COPY_PROJECT_GROUP_DESC)
682
+ .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")')
683
+ .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")')
684
+ .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.')
685
+ .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.')
686
+ .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"')
687
+ .option('-n, --new-group-slug <slug>', '(Optional) Destination group URL slug (single path segment, e.g. "mygroup-copy"). Must be unique. Group display name remains the same as source.')
687
688
  .showHelpAfterError()
688
689
  .hook('preAction', cmd => cmd.showHelpAfterError(false)) // only show help during validation
689
690
  .action(async (options) => {
package/config.js CHANGED
@@ -17,7 +17,13 @@ Examples:
17
17
  Copy a toolchain to the Frankfurt region with the specified name and target resource group, using the given API key
18
18
 
19
19
  Environment Variables:
20
- IBMCLOUD_API_KEY API key used to authenticate. Must have IAM permission to read and create toolchains and service-to-service authorizations in source and target region / resource group`
20
+ IBMCLOUD_API_KEY API key used to authenticate. Must have IAM permission to read and create toolchains and service-to-service authorizations in source and target region / resource group`;
21
+
22
+ const COPY_PROJECT_GROUP_DESC = `Copies all Git Repos and Issue Tracking projects in a group to another region.
23
+
24
+ Examples:
25
+ npx @ibm-cloud/cd-tools copy-project-group -g "1796019" -s ca-tor -d us-south --st \${PAT_CA_TOR} --dt \${PAT_US_SOUTH}
26
+ 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.`;
21
27
 
22
28
  const DOCS_URL = 'https://github.com/IBM/continuous-delivery-tools';
23
29
 
@@ -222,6 +228,7 @@ const VAULT_REGEX = [
222
228
 
223
229
  export {
224
230
  COPY_TOOLCHAIN_DESC,
231
+ COPY_PROJECT_GROUP_DESC,
225
232
  DOCS_URL,
226
233
  SOURCE_REGIONS,
227
234
  TARGET_REGIONS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibm-cloud/cd-tools",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Tools and utilities for the IBM Cloud Continuous Delivery service and resources",
5
5
  "repository": {
6
6
  "type": "git",