Skip to content

Commit 39cb110

Browse files
authored
Merge pull request #144 from carapace-sh/fix-deploy
fix deploy
2 parents 4a1c9f0 + 875a760 commit 39cb110

7 files changed

Lines changed: 169 additions & 1 deletion

File tree

cmd/carapace-aws/cmd/botocore/aws.deploy.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ commands:
103103
--description=: A comment about the deployment.
104104
--file-exists-behavior=: Information about how CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.
105105
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
106+
--github-location=: Information about the location of the application revision in GitHub
106107
--ignore-application-stop-failures: If true, then if an `ApplicationStop`, `BeforeBlockTraffic`, or `AfterBlockTraffic` deployment lifecycle event to an instance fails, then the deployment continues to the next deployment lifecycle event.
107108
--no-ignore-application-stop-failures: If true, then if an `ApplicationStop`, `BeforeBlockTraffic`, or `AfterBlockTraffic` deployment lifecycle event to an instance fails, then the deployment continues to the next deployment lifecycle event.
108109
--no-update-outdated-instances-only: Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.
109110
--override-alarm-configuration=: Allows you to specify information about alarms associated with a deployment.
110111
--revision=: The type and location of the revision to deploy.
112+
--s3-location=: Information about the location of the application revision in Amazon S3
111113
--target-instances=: Information about the instances that belong to the replacement environment in a blue/green deployment.
112114
--update-outdated-instances-only: Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.
113115
completion:
@@ -200,6 +202,11 @@ commands:
200202
--cli-input-yaml=: Read arguments from the YAML string provided.
201203
--external-id=: The unique ID of an external resource (for example, a CloudFormation stack ID) that is linked to one or more CodeDeploy resources.
202204
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
205+
- name: deregister
206+
description: Removes any tags from the on-premises instance
207+
flags:
208+
--instance-name=!: The name of the on-premises instance
209+
--no-delete-iam-user: Do not delete the IAM user for the registered on-premises instance
203210
- name: deregister-on-premises-instance
204211
description: Deregisters an on-premises instance.
205212
flags:
@@ -221,7 +228,9 @@ commands:
221228
--cli-input-json=: Read arguments from the JSON string provided.
222229
--cli-input-yaml=: Read arguments from the YAML string provided.
223230
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
231+
--github-location=: Information about the location of the application revision in GitHub
224232
--revision=!: Information about the application revision to get, including type and location.
233+
--s3-location=: Information about the location of the application revision in Amazon S3
225234
- name: get-deployment
226235
description: Gets information about a deployment.
227236
flags:
@@ -267,6 +276,18 @@ commands:
267276
--cli-input-yaml=: Read arguments from the YAML string provided.
268277
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
269278
--instance-name=!: The name of the on-premises instance about which to get information.
279+
- name: install
280+
description: Configures and installs the AWS CodeDeploy Agent on the on-premises instance
281+
flags:
282+
--agent-installer=: The AWS CodeDeploy Agent installer file
283+
--config-file=!: The path to the on-premises instance configuration file
284+
--override-config: Overrides the on-premises instance configuration file
285+
completion:
286+
flag:
287+
agent-installer:
288+
- $files
289+
config-file:
290+
- $files
270291
- name: list-application-revisions
271292
description: Lists information about revisions for an application.
272293
flags:
@@ -393,6 +414,15 @@ commands:
393414
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
394415
--next-token=: An identifier returned from the previous `ListTagsForResource` call.
395416
--resource-arn=!: The ARN of a CodeDeploy resource.
417+
- name: push
418+
description: Bundles and uploads to Amazon Simple Storage Service (Amazon S3) an application revision
419+
flags:
420+
--application-name=!: The name of the AWS CodeDeploy application to be associated with the application revision
421+
--description=: A comment that summarizes the application revision
422+
--ignore-hidden-files: Set the –ignore-hidden-files flag to not bundle and upload hidden files to Amazon S3
423+
--no-ignore-hidden-files: Set the –ignore-hidden-files flag to not bundle and upload hidden files to Amazon S3
424+
--s3-location=!: Information about the location of the application revision to be uploaded to Amazon S3
425+
--source=: The location of the deployable content and the accompanying AppSpec file
396426
- name: put-lifecycle-event-hook-execution-status
397427
description: Sets the result of a Lambda validation function.
398428
flags:
@@ -411,6 +441,14 @@ commands:
411441
- Failed
412442
- Skipped
413443
- Unknown
444+
- name: register
445+
description: Creates an IAM user for the on-premises instance
446+
flags:
447+
--iam-user-arn=: The IAM user associated with the on-premises instance
448+
--instance-name=!: The name of the on-premises instance
449+
--tags=:
450+
description: The list of key/value pairs to tag the on-premises instance
451+
nargs: -1
414452
- name: register-application-revision
415453
description: Registers with CodeDeploy a revision for the specified application.
416454
flags:
@@ -419,7 +457,9 @@ commands:
419457
--cli-input-yaml=: Read arguments from the YAML string provided.
420458
--description=: A comment about the revision.
421459
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
460+
--github-location=: Information about the location of the application revision in GitHub
422461
--revision=!: Information about the application revision to register, including type and location.
462+
--s3-location=: Information about the location of the application revision in Amazon S3
423463
- name: register-on-premises-instance
424464
description: Registers an on-premises instance.
425465
flags:
@@ -461,6 +501,8 @@ commands:
461501
--generate-cli-skeleton: Prints a JSON skeleton to standard output without sending an API request.
462502
--resource-arn=!: The ARN of a resource, such as a CodeDeploy application or deployment group.
463503
--tags=!: A list of tags that `TagResource` associates with a resource.
504+
- name: uninstall
505+
description: Uninstalls the AWS CodeDeploy Agent from the on-premises instance.
464506
- name: untag-resource
465507
description: Disassociates a resource from a list of tags.
466508
flags:
Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,64 @@
11
package customizations
22

3-
import "github.com/carapace-sh/carapace-spec/pkg/command"
3+
import (
4+
_ "embed"
5+
6+
"github.com/carapace-sh/carapace-spec/pkg/command"
7+
"gopkg.in/yaml.v3"
8+
)
9+
10+
//go:embed deploy/aws.deploy.deregister.yaml
11+
var deploy_deregister []byte
12+
13+
//go:embed deploy/aws.deploy.install.yaml
14+
var deploy_install []byte
15+
16+
//go:embed deploy/aws.deploy.push.yaml
17+
var deploy_push []byte
18+
19+
//go:embed deploy/aws.deploy.register.yaml
20+
var deploy_register []byte
21+
22+
//go:embed deploy/aws.deploy.uninstall.yaml
23+
var deploy_uninstall []byte
424

525
func init() {
626
customizations["codedeploy"] = func(cmd *command.Command) error {
727
cmd.Name = "deploy"
28+
29+
for _, spec := range [][]byte{
30+
deploy_deregister,
31+
deploy_install,
32+
deploy_push,
33+
deploy_register,
34+
deploy_uninstall,
35+
} {
36+
var specCommand command.Command
37+
if err := yaml.Unmarshal(spec, &specCommand); err != nil {
38+
return err
39+
}
40+
cmd.Commands = append(cmd.Commands, specCommand)
41+
}
842
return nil
943
}
44+
45+
for _, operation := range []string{
46+
"codedeploy.create-deployment",
47+
"codedeploy.get-application-revision",
48+
"codedeploy.register-application-revision",
49+
} {
50+
customizations[operation] = func(cmd *command.Command) error {
51+
cmd.AddFlag(command.Flag{
52+
Longhand: "s3-location",
53+
Description: "Information about the location of the application revision in Amazon S3",
54+
Value: true,
55+
})
56+
cmd.AddFlag(command.Flag{
57+
Longhand: "github-location",
58+
Description: "Information about the location of the application revision in GitHub",
59+
Value: true,
60+
})
61+
return nil
62+
}
63+
}
1064
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
2+
name: deregister
3+
description: Removes any tags from the on-premises instance
4+
flags:
5+
--instance-name=!: The name of the on-premises instance
6+
--no-delete-iam-user: Do not delete the IAM user for the registered on-premises instance
7+
documentation:
8+
command: |
9+
Removes any tags from the on-premises instance;
10+
deregisters the on-premises instance from AWS CodeDeploy;
11+
and, unless requested otherwise, deletes the IAM user for the on-premises instance.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
2+
name: install
3+
description: Configures and installs the AWS CodeDeploy Agent on the on-premises instance
4+
flags:
5+
--config-file=!: The path to the on-premises instance configuration file
6+
--override-config: Overrides the on-premises instance configuration file
7+
--agent-installer=: The AWS CodeDeploy Agent installer file
8+
completion:
9+
flag:
10+
config-file: ["$files"]
11+
agent-installer: ["$files"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
2+
name: push
3+
description: Bundles and uploads to Amazon Simple Storage Service (Amazon S3) an application revision
4+
flags:
5+
--application-name=!: The name of the AWS CodeDeploy application to be associated with the application revision
6+
--s3-location=!: Information about the location of the application revision to be uploaded to Amazon S3
7+
--ignore-hidden-files: Set the –ignore-hidden-files flag to not bundle and upload hidden files to Amazon S3
8+
--no-ignore-hidden-files: Set the –ignore-hidden-files flag to not bundle and upload hidden files to Amazon S3
9+
--source=: The location of the deployable content and the accompanying AppSpec file
10+
--description=: A comment that summarizes the application revision
11+
documentation:
12+
command: |
13+
Bundles and uploads to Amazon Simple Storage Service (Amazon S3) an application revision,
14+
which is a zip archive file that contains deployable content
15+
and an accompanying Application Specification file (AppSpec file).
16+
If the upload is successful, a message is returned that describes how to call the create-deployment command
17+
to deploy the application revision from Amazon S3 to target Amazon Elastic Compute Cloud (Amazon EC2) instances.
18+
flag:
19+
application-name: |
20+
Required. The name of the AWS CodeDeploy application to be associated with the application revision.
21+
s3-location: |
22+
Required. Information about the location of the application revision to be uploaded to Amazon S3.
23+
You must specify both a bucket and a key that represent the Amazon S3 bucket name and the object key name.
24+
Content will be zipped before uploading. Use the format `s3:///`
25+
ignore-hidden-files: |
26+
Optional. Set the –ignore-hidden-files flag to not bundle and upload hidden files to Amazon S3;
27+
otherwise, set the –no-ignore-hidden-files flag (the default) to bundle and upload hidden files to Amazon S3.
28+
source: |
29+
Optional. The location of the deployable content and the accompanying AppSpec file on the development machine
30+
to be zipped and uploaded to Amazon S3. If not specified, the current directory is used.
31+
description: |
32+
Optional. A comment that summarizes the application revision.
33+
If not specified, the default string “Uploaded by AWS CLI ‘time’ UTC” is used,
34+
where ‘time’ is the current system time in Coordinated Universal Time (UTC).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
2+
name: register
3+
description: Creates an IAM user for the on-premises instance
4+
flags:
5+
--instance-name=!: The name of the on-premises instance
6+
--tags=: {description: "The list of key/value pairs to tag the on-premises instance", nargs: -1}
7+
--iam-user-arn=: The IAM user associated with the on-premises instance
8+
documentation:
9+
command: |
10+
Creates an IAM user for the on-premises instance, if not provided,
11+
and saves the user’s credentials to an on-premises instance configuration file;
12+
registers the on-premises instance with AWS CodeDeploy; and optionally adds tags to the on-premises instance.
13+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
2+
name: uninstall
3+
description: Uninstalls the AWS CodeDeploy Agent from the on-premises instance.

0 commit comments

Comments
 (0)