Skip to content

Commit b08e88a

Browse files
committed
docs: add transfer command to pipectl CLI documentation
1 parent 1068db9 commit b08e88a

3 files changed

Lines changed: 136 additions & 28 deletions

File tree

‎docs/content/en/docs-dev/user-guide/command-line-tool.md‎

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Available Commands:
153153
piped Manage piped resources.
154154
plan-preview Show plan preview against the specified commit.
155155
plugin Do plugin tasks.
156+
transfer Transfer data between control planes.
156157
version Print the information of current binary.
157158
158159
Flags:
@@ -357,11 +358,11 @@ You can encrypt it the same way you do [from the web](../managing-application/se
357358
--input-file={PATH_TO_SECRET_FILE}
358359
```
359360

360-
Note: The docs for pipectl available command is maybe outdated, we suggest users use the `help` command for the updated usage while using pipectl.
361+
> **Note:** The docs for pipectl available command may be outdated. We suggest users use the `help` command for the updated usage while using pipectl.
361362
362363
### Migrating application configs and database
363364

364-
Migrate v0 application configs and database records to be compatible with the plugin-based pipedv1.
365+
Migrate v0 application configs and database records to be compatible with the plugin-based piped v1.
365366

366367
#### Migrating application config
367368

@@ -383,7 +384,7 @@ The `--config-files` and `--dirs` flags are mutually exclusive; one of them is r
383384

384385
#### Migrating database
385386

386-
Migrate database records to be compatible with plugin-architectured piped:
387+
Migrate database records to be compatible with plugin-architected piped:
387388

388389
``` console
389390
pipectl migrate database \
@@ -408,6 +409,49 @@ pipectl plugin push \
408409

409410
The `--files` flag maps platforms to binary files in `os/arch=filepath` format. All of `--files`, `--tag`, `--registry`, and `--repository` are required. Add `--insecure` to skip TLS verification when using an HTTP-only registry.
410411

412+
### Transferring data between control planes
413+
414+
Transfer pipeds and applications from one control plane to another.
415+
416+
#### Backing up data
417+
418+
Back up all pipeds and applications from the source control plane to a local file:
419+
420+
``` console
421+
pipectl transfer backup \
422+
--address={SOURCE_CONTROL_PLANE_API_ADDRESS} \
423+
--api-key={SOURCE_API_KEY} \
424+
--output-file=backup.json
425+
```
426+
427+
Add `--labels` to filter applications by labels (comma-separated `KEY:VALUE` pairs, e.g. `--labels=env:prod,team:backend`). Deployment history is not included, because the API does not expose a write endpoint for deployments.
428+
429+
#### Restoring data
430+
431+
Restoring is a two-step process, because the control plane validates that each application's Git repository is registered on the target piped before the application can be created, and repository registration only happens after the piped agent connects.
432+
433+
1. Register the pipeds on the target control plane, then update each piped's configuration with the new ID and key before restarting the piped agents:
434+
435+
``` console
436+
pipectl transfer restore piped \
437+
--address={TARGET_CONTROL_PLANE_API_ADDRESS} \
438+
--api-key={TARGET_API_KEY} \
439+
--input-file=backup.json \
440+
--output-file=mapping.json
441+
```
442+
443+
2. Once the piped agents have reconnected to the target control plane and registered their repositories, restore the applications:
444+
445+
``` console
446+
pipectl transfer restore application \
447+
--address={TARGET_CONTROL_PLANE_API_ADDRESS} \
448+
--api-key={TARGET_API_KEY} \
449+
--input-file=backup.json \
450+
--piped-id-mapping-file=mapping.json
451+
```
452+
453+
Disabled applications from the source are restored and immediately re-disabled on the target to preserve their original status.
454+
411455
### You want more?
412456

413457
We always want to add more needed commands into pipectl. Please let us know what command you want to add by creating issues in the [pipe-cd/pipecd](https://github.com/pipe-cd/pipecd/issues) repository. We also welcome your pull request to add the command.

‎docs/content/en/docs-v0.57.x/user-guide/command-line-tool.md‎

Lines changed: 88 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,16 @@ Usage:
144144
145145
Available Commands:
146146
application Manage application resources.
147+
completion Generate the autocompletion script for the specified shell
147148
deployment Manage deployment resources.
148149
encrypt Encrypt the plaintext entered in either stdin or the --input-file flag.
149150
event Manage event resources.
150151
help Help about any command
151-
init Generate an application config (app.pipecd.yaml) easily and interactively.
152+
migrate Do migration tasks.
152153
piped Manage piped resources.
153154
plan-preview Show plan preview against the specified commit.
155+
plugin Do plugin tasks.
156+
transfer Transfer data between control planes.
154157
version Print the information of current binary.
155158
156159
Flags:
@@ -355,39 +358,99 @@ You can encrypt it the same way you do [from the web](../managing-application/se
355358
--input-file={PATH_TO_SECRET_FILE}
356359
```
357360

358-
Note: The docs for pipectl available command is maybe outdated, we suggest users use the `help` command for the updated usage while using pipectl.
361+
> **Note:** The docs for pipectl available command may be outdated. We suggest users use the `help` command for the updated usage while using pipectl.
359362
360-
### Generating an application config (app.pipecd.yaml)
363+
### Migrating application configs and database
361364

365+
Migrate v0 application configs and database records to be compatible with the plugin-based piped v1.
362366

363-
Generate an app.pipecd.yaml interactively:
367+
#### Migrating application config
368+
369+
Convert v0 application config files to the v1 format:
370+
371+
``` console
372+
pipectl migrate application-config \
373+
--config-files=path/to/app.pipecd.yaml
374+
```
375+
376+
Or migrate all application config files in a directory:
377+
378+
``` console
379+
pipectl migrate application-config \
380+
--dirs=path/to/app/directory
381+
```
382+
383+
The `--config-files` and `--dirs` flags are mutually exclusive; one of them is required. The original file is backed up with a `.old` extension.
384+
385+
#### Migrating database
386+
387+
Migrate database records to be compatible with plugin-architected piped:
388+
389+
``` console
390+
pipectl migrate database \
391+
--address={CONTROL_PLANE_API_ADDRESS} \
392+
--api-key={API_KEY} \
393+
--applications={APPLICATION_ID}
394+
```
395+
396+
The `--applications` flag accepts a list of application IDs and is required.
397+
398+
### Pushing a plugin
399+
400+
Push a plugin binary to an OCI registry:
364401

365402
``` console
366-
$ pipectl init
367-
Which platform? Enter the number [0]Kubernetes [1]ECS: 1
368-
Name of the application: myApp
369-
...
403+
pipectl plugin push \
404+
--files=linux/amd64=./plugin-linux-amd64,linux/arm64=./plugin-linux-arm64 \
405+
--tag=v0.1.0 \
406+
--registry=ghcr.io/pipe-cd \
407+
--repository=my-plugin
370408
```
371409

372-
After the above interaction, you can get the config YAML:
373-
374-
```yaml
375-
apiVersion: pipecd.dev/v1beta1
376-
kind: ECSApp
377-
spec:
378-
name: myApp
379-
input:
380-
serviceDefinitionFile: serviceDef.yaml
381-
taskDefinitionFile: taskDef.yaml
382-
targetGroups:
383-
primary:
384-
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:123456789012:targetgroup/xxx/xxx
385-
containerName: web
386-
containerPort: 80
387-
description: Generated by `pipectl init`. See https://pipecd.dev/docs/user-guide/configuration-reference/ for more.
410+
The `--files` flag maps platforms to binary files in `os/arch=filepath` format. All of `--files`, `--tag`, `--registry`, and `--repository` are required. Add `--insecure` to skip TLS verification when using an HTTP-only registry.
411+
412+
### Transferring data between control planes
413+
414+
Transfer pipeds and applications from one control plane to another.
415+
416+
#### Backing up data
417+
418+
Back up all pipeds and applications from the source control plane to a local file:
419+
420+
``` console
421+
pipectl transfer backup \
422+
--address={SOURCE_CONTROL_PLANE_API_ADDRESS} \
423+
--api-key={SOURCE_API_KEY} \
424+
--output-file=backup.json
388425
```
389426

390-
See [Feature Status](../feature-status/_index.md#pipectl-init).
427+
Add `--labels` to filter applications by labels (comma-separated `KEY:VALUE` pairs, e.g. `--labels=env:prod,team:backend`). Deployment history is not included, because the API does not expose a write endpoint for deployments.
428+
429+
#### Restoring data
430+
431+
Restoring is a two-step process, because the control plane validates that each application's Git repository is registered on the target piped before the application can be created, and repository registration only happens after the piped agent connects.
432+
433+
1. Register the pipeds on the target control plane, then update each piped's configuration with the new ID and key before restarting the piped agents:
434+
435+
``` console
436+
pipectl transfer restore piped \
437+
--address={TARGET_CONTROL_PLANE_API_ADDRESS} \
438+
--api-key={TARGET_API_KEY} \
439+
--input-file=backup.json \
440+
--output-file=mapping.json
441+
```
442+
443+
2. Once the piped agents have reconnected to the target control plane and registered their repositories, restore the applications:
444+
445+
``` console
446+
pipectl transfer restore application \
447+
--address={TARGET_CONTROL_PLANE_API_ADDRESS} \
448+
--api-key={TARGET_API_KEY} \
449+
--input-file=backup.json \
450+
--piped-id-mapping-file=mapping.json
451+
```
452+
453+
Disabled applications from the source are restored and immediately re-disabled on the target to preserve their original status.
391454

392455
### You want more?
393456

‎docs/content/en/docs-v1.0.x/user-guide/command-line-tool.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Available Commands:
153153
piped Manage piped resources.
154154
plan-preview Show plan preview against the specified commit.
155155
plugin Do plugin tasks.
156+
transfer Transfer data between control planes.
156157
version Print the information of current binary.
157158
158159
Flags:

0 commit comments

Comments
 (0)