-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from a10waveracer/address_pr
Add command support for --cli-input-json
- Loading branch information
Showing
2 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -35,6 +35,28 @@ examples: | |
cluster-name: "${MY_APP_PREFIX}-cluster" | ||
container-image-name-updates: "container=${MY_APP_PREFIX}-service,tag=${CIRCLE_SHA1}" | ||
|
||
update-task-definition-from-json: | ||
description: | | ||
Use the AWS CLI and this orb to create a new ECS task definition | ||
based upon a local JSON file. | ||
usage: | ||
version: 2.1 | ||
|
||
orbs: | ||
aws-cli: circleci/[email protected] | ||
aws-ecs: circleci/[email protected] | ||
|
||
jobs: | ||
update-tag: | ||
docker: | ||
- image: circleci/python:3.7.1 | ||
steps: | ||
- aws-cli/install | ||
- aws-cli/configure: | ||
aws-access-key-id: "$AWS_ACCESS_KEY_ID" | ||
aws-region: "$AWS_REGION" | ||
- aws-ecs/update-task-definition-from-json: | ||
task-definition-json: "my-app-definition.json" | ||
update-service: | ||
description: | | ||
Use the AWS CLI and this orb to update an ECS service. | ||
|
@@ -352,6 +374,42 @@ jobs: | |
family: << parameters.family >> | ||
container-image-name-updates: << parameters.container-image-name-updates >> | ||
container-env-var-updates: << parameters.container-env-var-updates >> | ||
update-task-definition-from-json: | ||
docker: | ||
- image: << parameters.docker-image-for-job >> | ||
parameters: | ||
docker-image-for-job: | ||
description: | ||
"The docker image to be used for running this job on CircleCI." | ||
type: string | ||
default: circleci/python:3.7.1 | ||
aws-access-key-id: | ||
description: | | ||
AWS access key id for IAM role. Defaulted to $AWS_ACCESS_KEY_ID | ||
type: string | ||
default: $AWS_ACCESS_KEY_ID | ||
aws-secret-access-key: | ||
description: | | ||
AWS secret key for IAM role. Defaulted to $AWS_SECRET_ACCESS_KEY | ||
type: string | ||
default: $AWS_SECRET_ACCESS_KEY | ||
aws-region: | ||
description: | ||
AWS region to operate in. Defaulted to $AWS_REGION | ||
type: string | ||
default: $AWS_REGION | ||
task-definition-json: | ||
description: | | ||
Location of your .json task definition file (relative or absolute). | ||
type: string | ||
steps: | ||
- aws-cli/install | ||
- aws-cli/configure: | ||
aws-access-key-id: << parameters.aws-access-key-id >> | ||
aws-secret-access-key: << parameters.aws-secret-access-key >> | ||
aws-region: << parameters.aws-region >> | ||
- update-task-definition-from-json: | ||
task-definition-json: << parameters.task-definition-json >> | ||
run-task: | ||
docker: | ||
- image: << parameters.docker-image-for-job >> | ||
|
@@ -746,6 +804,27 @@ commands: | |
--query 'taskDefinition.taskDefinitionArn') | ||
echo "Registered task definition: ${REVISION}" | ||
echo "export CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN='${REVISION}'" >> $BASH_ENV | ||
update-task-definition-from-json: | ||
description: Registers a task definition based on a json file. | ||
parameters: | ||
task-definition-json: | ||
description: | | ||
Location of your .json task definition file (relative or absolute). | ||
type: string | ||
steps: | ||
- run: | ||
name: Register new task definition | ||
command: | | ||
TASK_DEFINITION_JSON="$(echo << parameters.task-definition-json >>)" | ||
if [ "${TASK_DEFINITION_JSON:0:1}" != "/" ]; then | ||
TASK_DEFINITION_JSON="$(pwd)/${TASK_DEFINITION_JSON}" | ||
fi | ||
REVISION=$(aws ecs register-task-definition \ | ||
--cli-input-json file://${TASK_DEFINITION_JSON} \ | ||
--output text \ | ||
--query 'taskDefinition.taskDefinitionArn') | ||
echo "Registered task definition: ${REVISION}" | ||
echo "export CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN='${REVISION}'" >> $BASH_ENV | ||
update-service: | ||
description: | | ||
Registers a task definition for the given ECS service and updates the service to | ||
|