-
Notifications
You must be signed in to change notification settings - Fork 368
feat: add new commands for completion and migration in pipectl #6751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vedantlavale
wants to merge
11
commits into
pipe-cd:master
Choose a base branch
from
vedantlavale:fix-pipectl-cli-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+180
−51
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
880e8c7
feat: add new commands for completion and migration in pipectl
vedantlavale 33b178c
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale b3ddfc1
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale 12e7845
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale fa20009
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale ece9dc7
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale 327a1d0
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale 1068db9
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale 93c7b2b
docs: add transfer command to pipectl CLI documentation
vedantlavale 6691f26
Merge branch 'master' into fix-pipectl-cli-docs
rahulshendre 3994593
Merge branch 'master' into fix-pipectl-cli-docs
vedantlavale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,13 +144,16 @@ Usage: | |
|
|
||
| Available Commands: | ||
| application Manage application resources. | ||
| completion Generate the autocompletion script for the specified shell | ||
| deployment Manage deployment resources. | ||
| encrypt Encrypt the plaintext entered in either stdin or the --input-file flag. | ||
| event Manage event resources. | ||
| help Help about any command | ||
| init Generate an application config (app.pipecd.yaml) easily and interactively. | ||
| migrate Do migration tasks. | ||
| piped Manage piped resources. | ||
| plan-preview Show plan preview against the specified commit. | ||
| plugin Do plugin tasks. | ||
| transfer Transfer data between control planes. | ||
| version Print the information of current binary. | ||
|
|
||
| Flags: | ||
|
|
@@ -355,39 +358,99 @@ You can encrypt it the same way you do [from the web](../managing-application/se | |
| --input-file={PATH_TO_SECRET_FILE} | ||
| ``` | ||
|
|
||
| Note: The docs for pipectl available command is maybe outdated, we suggest users use the `help` command for the updated usage while using pipectl. | ||
| > **Note:** The docs for pipectl available command may be outdated. We suggest users use the `help` command for the updated usage while using pipectl. | ||
|
|
||
| ### Generating an application config (app.pipecd.yaml) | ||
| ### Migrating application configs and database | ||
|
|
||
| Migrate v0 application configs and database records to be compatible with the plugin-based piped v1. | ||
|
|
||
| Generate an app.pipecd.yaml interactively: | ||
| #### Migrating application config | ||
|
|
||
| Convert v0 application config files to the v1 format: | ||
|
|
||
| ``` console | ||
| pipectl migrate application-config \ | ||
| --config-files=path/to/app.pipecd.yaml | ||
| ``` | ||
|
|
||
| Or migrate all application config files in a directory: | ||
|
|
||
| ``` console | ||
| pipectl migrate application-config \ | ||
| --dirs=path/to/app/directory | ||
| ``` | ||
|
|
||
| The `--config-files` and `--dirs` flags are mutually exclusive; one of them is required. The original file is backed up with a `.old` extension. | ||
|
|
||
| #### Migrating database | ||
|
|
||
| Migrate database records to be compatible with plugin-architected piped: | ||
|
|
||
| ``` console | ||
| pipectl migrate database \ | ||
| --address={CONTROL_PLANE_API_ADDRESS} \ | ||
| --api-key={API_KEY} \ | ||
| --applications={APPLICATION_ID} | ||
| ``` | ||
|
|
||
| The `--applications` flag accepts a list of application IDs and is required. | ||
|
|
||
| ### Pushing a plugin | ||
|
|
||
| Push a plugin binary to an OCI registry: | ||
|
|
||
| ``` console | ||
| $ pipectl init | ||
| Which platform? Enter the number [0]Kubernetes [1]ECS: 1 | ||
| Name of the application: myApp | ||
| ... | ||
| pipectl plugin push \ | ||
| --files=linux/amd64=./plugin-linux-amd64,linux/arm64=./plugin-linux-arm64 \ | ||
| --tag=v0.1.0 \ | ||
| --registry=ghcr.io/pipe-cd \ | ||
| --repository=my-plugin | ||
| ``` | ||
|
|
||
| After the above interaction, you can get the config YAML: | ||
|
|
||
| ```yaml | ||
| apiVersion: pipecd.dev/v1beta1 | ||
| kind: ECSApp | ||
| spec: | ||
| name: myApp | ||
| input: | ||
| serviceDefinitionFile: serviceDef.yaml | ||
| taskDefinitionFile: taskDef.yaml | ||
| targetGroups: | ||
| primary: | ||
| targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:123456789012:targetgroup/xxx/xxx | ||
| containerName: web | ||
| containerPort: 80 | ||
| description: Generated by `pipectl init`. See https://pipecd.dev/docs/user-guide/configuration-reference/ for more. | ||
| 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. | ||
|
|
||
| ### Transferring data between control planes | ||
|
|
||
| Transfer pipeds and applications from one control plane to another. | ||
|
|
||
| #### Backing up data | ||
|
|
||
| Back up all pipeds and applications from the source control plane to a local file: | ||
|
|
||
| ``` console | ||
| pipectl transfer backup \ | ||
| --address={SOURCE_CONTROL_PLANE_API_ADDRESS} \ | ||
| --api-key={SOURCE_API_KEY} \ | ||
| --output-file=backup.json | ||
| ``` | ||
|
|
||
| See [Feature Status](../feature-status/_index.md#pipectl-init). | ||
| 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. | ||
|
|
||
| #### Restoring data | ||
|
|
||
| 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. | ||
|
|
||
| 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: | ||
|
|
||
| ``` console | ||
| pipectl transfer restore piped \ | ||
| --address={TARGET_CONTROL_PLANE_API_ADDRESS} \ | ||
| --api-key={TARGET_API_KEY} \ | ||
| --input-file=backup.json \ | ||
| --output-file=mapping.json | ||
| ``` | ||
|
|
||
| 2. Once the piped agents have reconnected to the target control plane and registered their repositories, restore the applications: | ||
|
|
||
| ``` console | ||
| pipectl transfer restore application \ | ||
| --address={TARGET_CONTROL_PLANE_API_ADDRESS} \ | ||
| --api-key={TARGET_API_KEY} \ | ||
| --input-file=backup.json \ | ||
| --piped-id-mapping-file=mapping.json | ||
| ``` | ||
|
|
||
| Disabled applications from the source are restored and immediately re-disabled on the target to preserve their original status. | ||
|
|
||
| ### You want more? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds too informal. Please fix. |
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.