Skip to content

Commit

Permalink
feat!: v4.0 (#201)
Browse files Browse the repository at this point in the history
* chore: update variable names

* feat: add default executor

* refactor: replace image with default executor

* fix: remove unnecessary parameter

* test: debugging

* chore: fix typo

* fix: update variable names

* fix: resolve more pr comments

* fix: resolve lint errors

* fix: typos

* fix: correct variable name
  • Loading branch information
brivu authored Jul 28, 2023
1 parent 9a7f618 commit 64e67ad
Show file tree
Hide file tree
Showing 30 changed files with 242 additions and 232 deletions.
5 changes: 0 additions & 5 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ workflows:
- aws-cli/setup:
role_arn: "arn:aws:iam::122211685980:role/CPE_ECS_OIDC_TEST"
profile_name: "ECS_TEST_PROFILE"
docker_image_for_job: cimg/python:3.10.4
filters: *filters
requires:
- fargate_test-update_service-command
Expand All @@ -499,7 +498,6 @@ workflows:
- aws-cli/setup:
role_arn: "arn:aws:iam::122211685980:role/CPE_ECS_OIDC_TEST"
profile_name: "ECS_TEST_PROFILE"
docker_image_for_job: cimg/python:3.10.4
filters: *filters
requires:
- fargate_test-update_service-job
Expand Down Expand Up @@ -600,7 +598,6 @@ workflows:
role_arn: "arn:aws:iam::122211685980:role/CPE_ECS_OIDC_TEST"
profile_name: "ECS_TEST_PROFILE"
profile_name: "ECS_TEST_PROFILE"
docker_image_for_job: cimg/python:3.10.4
context: [CPE-OIDC]
filters: *filters
requires:
Expand Down Expand Up @@ -672,7 +669,6 @@ workflows:
auth:
- aws-cli/setup:
role_arn: "arn:aws:iam::122211685980:role/CPE_ECS_OIDC_TEST"
docker_image_for_job: cimg/python:3.10.4
filters: *filters
requires:
- codedeploy_fargate_test-update_service-command
Expand Down Expand Up @@ -704,7 +700,6 @@ workflows:
auth:
- aws-cli/setup:
role_arn: "arn:aws:iam::122211685980:role/CPE_ECS_OIDC_TEST"
docker_image_for_job: cimg/python:3.10.4
context: [CPE-OIDC]
filters: *filters
requires:
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deploy_ecs_scheduled_task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ steps:
- run:
name: Deploy rule with updated task definition
environment:
ORB_EVAL_RULE_NAME: <<parameters.rule_name>>
ORB_STR_RULE_NAME: <<parameters.rule_name>>
command: <<include(scripts/deploy_ecs_scheduled_task.sh)>>
4 changes: 2 additions & 2 deletions src/commands/install_ecs_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ steps:
- run:
name: Install AWS ECS CLI
environment:
ORB_EVAL_VERSION: <<parameters.version>>
ORB_STR_VERSION: <<parameters.version>>
ORB_EVAL_INSTALL_DIR: <<parameters.install_dir>>
ORB_VAL_OVERRIDE_INSTALLED: <<parameters.override_installed>>
ORB_BOOL_OVERRIDE_INSTALLED: <<parameters.override_installed>>
command: <<include(scripts/install_ecs_cli.sh)>>
38 changes: 19 additions & 19 deletions src/commands/run_task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ steps:
name: Run Task
command: <<include(scripts/run_task.sh)>>
environment:
ORB_EVAL_CLUSTER_NAME: <<parameters.cluster>>
ORB_EVAL_TASK_DEF: <<parameters.task_definition>>
ORB_VAL_COUNT: <<parameters.count>>
ORB_EVAL_STARTED_BY: <<parameters.started_by>>
ORB_EVAL_GROUP: <<parameters.group>>
ORB_EVAL_PLACEMENT_CONSTRAINTS: <<parameters.placement_constraints>>
ORB_EVAL_PLACEMENT_STRATEGY: <<parameters.placement_strategy>>
ORB_STR_CLUSTER_NAME: <<parameters.cluster>>
ORB_STR_TASK_DEF: <<parameters.task_definition>>
ORB_INT_COUNT: <<parameters.count>>
ORB_STR_STARTED_BY: <<parameters.started_by>>
ORB_STR_GROUP: <<parameters.group>>
ORB_STR_PLACEMENT_CONSTRAINTS: <<parameters.placement_constraints>>
ORB_STR_PLACEMENT_STRATEGY: <<parameters.placement_strategy>>
ORB_VAL_LAUNCH_TYPE: <<parameters.launch_type>>
ORB_EVAL_PLATFORM_VERSION: <<parameters.platform_version>>
ORB_VAL_AWSVPC: <<parameters.awsvpc>>
ORB_EVAL_SUBNET_ID: <<parameters.subnet_ids>>
ORB_EVAL_SEC_GROUP_ID: <<parameters.security_group_ids>>
ORB_VAL_ASSIGN_PUB_IP: <<parameters.assign_public_ip>>
ORB_EVAL_OVERRIDES: <<parameters.overrides>>
ORB_EVAL_TAGS: <<parameters.tags>>
ORB_VAL_ENABLE_ECS_MANAGED_TAGS: <<parameters.enable_ecs_managed_tags>>
ORB_VAL_PROPAGATE_TAGS: <<parameters.propagate_tags>>
ORB_EVAL_CD_CAPACITY_PROVIDER_STRATEGY: <<parameters.capacity_provider_strategy>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_EVAL_RUN_TASK_OUTPUT: <<parameters.run_task_output>>
ORB_STR_PLATFORM_VERSION: <<parameters.platform_version>>
ORB_BOOL_AWSVPC: <<parameters.awsvpc>>
ORB_STR_SUBNET_ID: <<parameters.subnet_ids>>
ORB_STR_SEC_GROUP_ID: <<parameters.security_group_ids>>
ORB_STR_ASSIGN_PUB_IP: <<parameters.assign_public_ip>>
ORB_STR_OVERRIDES: <<parameters.overrides>>
ORB_STR_TAGS: <<parameters.tags>>
ORB_BOOL_ENABLE_ECS_MANAGED_TAGS: <<parameters.enable_ecs_managed_tags>>
ORB_BOOL_PROPAGATE_TAGS: <<parameters.propagate_tags>>
ORB_STR_CD_CAPACITY_PROVIDER_STRATEGY: <<parameters.capacity_provider_strategy>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
ORB_STR_RUN_TASK_OUTPUT: <<parameters.run_task_output>>
34 changes: 17 additions & 17 deletions src/commands/update_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,17 @@ steps:
no_output_timeout: << parameters.verification_timeout >>
environment:
DEPLOYMENT_CONTROLLER: <<parameters.deployment_controller>>
ORB_EVAL_CD_APP_NAME: <<parameters.codedeploy_application_name>>
ORB_EVAL_CD_DEPLOY_GROUP_NAME: <<parameters.codedeploy_deployment_group_name>>
ORB_EVAL_CD_LOAD_BALANCED_CONTAINER_NAME: <<parameters.codedeploy_load_balanced_container_name>>
ORB_VAL_CD_LOAD_BALANCED_CONTAINER_PORT: <<parameters.codedeploy_load_balanced_container_port>>
ORB_VAL_VERIFY_REV_DEPLOY: <<parameters.verify_revision_is_deployed>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_VAL_ENABLE_CIRCUIT_BREAKER: <<parameters.enable_circuit_breaker>>
ORB_EVAL_CD_CAPACITY_PROVIDER_NAME: <<parameters.codedeploy_capacity_provider_name>>
ORB_EVAL_CD_CAPACITY_PROVIDER_WEIGHT: <<parameters.codedeploy_capacity_provider_weight>>
ORB_EVAL_CD_CAPACITY_PROVIDER_BASE: <<parameters.codedeploy_capacity_provider_base>>
ORB_EVAL_CD_DEPLOYMENT_CONFIG_NAME: <<parameters.deployment_config_name>>
ORB_STR_CD_APP_NAME: <<parameters.codedeploy_application_name>>
ORB_STR_CD_DEPLOY_GROUP_NAME: <<parameters.codedeploy_deployment_group_name>>
ORB_STR_CD_LOAD_BALANCED_CONTAINER_NAME: <<parameters.codedeploy_load_balanced_container_name>>
ORB_INT_CD_LOAD_BALANCED_CONTAINER_PORT: <<parameters.codedeploy_load_balanced_container_port>>
ORB_BOOL_VERIFY_REV_DEPLOY: <<parameters.verify_revision_is_deployed>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
ORB_BOOL_ENABLE_CIRCUIT_BREAKER: <<parameters.enable_circuit_breaker>>
ORB_STR_CD_CAPACITY_PROVIDER_NAME: <<parameters.codedeploy_capacity_provider_name>>
ORB_STR_CD_CAPACITY_PROVIDER_WEIGHT: <<parameters.codedeploy_capacity_provider_weight>>
ORB_STR_CD_CAPACITY_PROVIDER_BASE: <<parameters.codedeploy_capacity_provider_base>>
ORB_STR_CD_DEPLOYMENT_CONFIG_NAME: <<parameters.deployment_config_name>>

- when:
condition:
Expand All @@ -252,12 +252,12 @@ steps:
name: Update service with registered task definition
command: <<include(scripts/update_service_via_task_def.sh)>>
environment:
ORB_EVAL_SERVICE_NAME: <<parameters.service_name>>
ORB_EVAL_FAMILY: <<parameters.family>>
ORB_VAL_FORCE_NEW_DEPLOY: <<parameters.force_new_deployment>>
ORB_EVAL_CLUSTER_NAME: <<parameters.cluster>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_VAL_ENABLE_CIRCUIT_BREAKER: <<parameters.enable_circuit_breaker>>
ORB_STR_SERVICE_NAME: <<parameters.service_name>>
ORB_STR_FAMILY: <<parameters.family>>
ORB_BOOL_FORCE_NEW_DEPLOY: <<parameters.force_new_deployment>>
ORB_STR_CLUSTER_NAME: <<parameters.cluster>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
ORB_BOOL_ENABLE_CIRCUIT_BREAKER: <<parameters.enable_circuit_breaker>>

- when:
condition:
Expand Down
22 changes: 11 additions & 11 deletions src/commands/update_task_definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ steps:
name: Retrieve previous task definition and prepare new task definition values
command: <<include(scripts/get_prev_task.sh)>>
environment:
ORB_EVAL_FAMILY: <<parameters.family>>
ORB_EVAL_CONTAINER_IMAGE_NAME_UPDATES: <<parameters.container_image_name_updates>>
ORB_EVAL_CONTAINER_ENV_VAR_UPDATE: <<parameters.container_env_var_updates>>
ECS_SCRIPT_UPDATE_CONTAINER_DEFS: <<include(scripts/update_container_defs.py)>>
ECS_SCRIPT_GET_TASK_DFN_VAL: <<include(scripts/get_task_dfn_val.py)>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_EVAL_PREVIOUS_REVISION_NUMBER: <<parameters.previous_revision_number>>
ORB_EVAL_CONTAINER_SECRET_UPDATES: <<parameters.container_secret_updates>>
ORB_EVAL_CONTAINER_DOCKER_LABEL_UPDATES: << parameters.container_docker_label_updates >>
ORB_STR_FAMILY: <<parameters.family>>
ORB_STR_CONTAINER_IMAGE_NAME_UPDATES: <<parameters.container_image_name_updates>>
ORB_STR_CONTAINER_ENV_VAR_UPDATE: <<parameters.container_env_var_updates>>
ORB_SCRIPT_UPDATE_CONTAINER_DEFS: <<include(scripts/update_container_defs.py)>>
ORB_SCRIPT_GET_TASK_DFN_VAL: <<include(scripts/get_task_dfn_val.py)>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
ORB_STR_PREVIOUS_REVISION_NUMBER: <<parameters.previous_revision_number>>
ORB_STR_CONTAINER_SECRET_UPDATES: <<parameters.container_secret_updates>>
ORB_STR_CONTAINER_DOCKER_LABEL_UPDATES: << parameters.container_docker_label_updates >>
- run:
name: Register new task definition
command: <<include(scripts/register_new_task_def.sh)>>
environment:
ORB_EVAL_FAMILY: <<parameters.family>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_STR_FAMILY: <<parameters.family>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
4 changes: 2 additions & 2 deletions src/commands/update_task_definition_from_json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ steps:
name: Register new task definition
command: <<include(scripts/update_task_definition_from_json.sh)>>
environment:
ORB_EVAL_TASK_DEFINITION_JSON: <<parameters.task_definition_json>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_STR_TASK_DEFINITION_JSON: <<parameters.task_definition_json>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
10 changes: 5 additions & 5 deletions src/commands/verify_revision_is_deployed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ steps:
Poll the deployment status at intervals till the given task definition revision has reached its desired running task count and is the only one deployed for the service.
command: <<include(scripts/verify_revision_is_deployed.sh)>>
environment:
ORB_EVAL_SERVICE_NAME: <<parameters.service_name>>
ORB_EVAL_FAMILY: <<parameters.family>>
ORB_EVAL_TASK_DEF_ARN: <<parameters.task_definition_arn>>
ORB_STR_SERVICE_NAME: <<parameters.service_name>>
ORB_STR_FAMILY: <<parameters.family>>
ORB_STR_TASK_DEF_ARN: <<parameters.task_definition_arn>>
ORB_VAL_MAX_POLL_ATTEMPTS: <<parameters.max_poll_attempts>>
ORB_EVAL_CLUSTER_NAME: <<parameters.cluster>>
ORB_STR_CLUSTER_NAME: <<parameters.cluster>>
ORB_VAL_POLL_INTERVAL: <<parameters.poll_interval>>
ORB_VAL_FAIL_ON_VERIFY_TIMEOUT: <<parameters.fail_on_verification_timeout>>
ORB_EVAL_PROFILE_NAME: <<parameters.profile_name>>
ORB_STR_PROFILE_NAME: <<parameters.profile_name>>
4 changes: 2 additions & 2 deletions src/examples/deploy_ecs_scheduled_task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
usage:
version: 2.1
orbs:
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
aws-ecs: circleci/[email protected]
jobs:
deploy_scheduled_task:
Expand All @@ -13,7 +13,7 @@ usage:
steps:
- aws-cli/setup:
# This example uses CircleCI's OpenID Connect Token to generate temporary AWS keys
role-arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
role_arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
region: AWS_REGION
profile_name: "OIDC-PROFILE"
session-duration: 3600
Expand Down
8 changes: 4 additions & 4 deletions src/examples/deploy_service_update.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
description: |
Update an ECS service using OIDC for authentication.
Import the aws-cli orb and authenticate using the aws-cli/setup command with a valid role-arn for OIDC authentication.
Import the aws-cli orb and authenticate using the aws-cli/setup command with a valid role_arn for OIDC authentication.
usage:
version: 2.1
orbs:
aws-ecr: circleci/[email protected]
aws-ecs: circleci/[email protected]
# Importing aws-cli orb is required for authentication
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
workflows:
build-and-deploy:
jobs:
Expand All @@ -16,7 +16,7 @@ usage:
# Add authentication step with OIDC using aws-cli/setup command
- aws-cli/setup:
profile: "OIDC-USER"
role-arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECR_ROLE"
role_arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECR_ROLE"
# Must use same profile configured in aws-cli/setup command
profile: "OIDC-USER"
registry-id: AWS_ECR_REGISTRY_ID
Expand All @@ -28,7 +28,7 @@ usage:
# Add authentication step with OIDC using aws-cli/setup command
- aws-cli/setup:
profile: "OIDC-USER"
role-arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
role_arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
# Must use same profile configured in aws-cli/setup command
profile: "OIDC-USER"
requires:
Expand Down
4 changes: 2 additions & 2 deletions src/examples/run_task_ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ usage:
version: 2.1
orbs:
aws-ecs: circleci/[email protected]
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
jobs:
run_task:
docker:
- image: cimg/python:3.10
steps:
- aws-cli/setup:
profile: "OIDC-USER"
role-arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
role_arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
- aws-ecs/run_task:
cluster: cluster1
task_definition: myapp
Expand Down
2 changes: 1 addition & 1 deletion src/examples/run_task_fargate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage:
steps:
- aws-cli/setup:
profile: "OIDC-USER"
role-arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
role_arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
- aws-ecs/run_task:
cluster: cluster1
task_definition: myapp
Expand Down
2 changes: 1 addition & 1 deletion src/examples/run_task_fargate_spot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ usage:
steps:
- aws-cli/setup:
profile: "OIDC-USER"
role-arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
role_arn: "arn:aws:iam::123456789012:role/VALID_OIDC_ECS_ROLE"
- aws-ecs/run_task:
cluster: $CLUSTER_NAME
capacity_provider_strategy: capacityProvider=FARGATE,weight=1 capacityProvider=FARGATE_SPOT,weight=1
Expand Down
4 changes: 2 additions & 2 deletions src/examples/update_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
usage:
version: 2.1
orbs:
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
aws-ecs: circleci/[email protected]
jobs:
update-tag:
Expand All @@ -13,7 +13,7 @@ usage:
steps:
- aws-cli/setup:
# This example uses CircleCI's OpenID Connect Token to generate temporary AWS keys
role-arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
role_arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
region: AWS_REGION
profile_name: "OIDC-PROFILE"
session-duration: 3600
Expand Down
4 changes: 2 additions & 2 deletions src/examples/update_task_definition_from_json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ description: Use the AWS CLI and this orb to create a new ECS task definition ba
usage:
version: 2.1
orbs:
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
aws-ecs: circleci/[email protected]
jobs:
update-tag:
Expand All @@ -11,7 +11,7 @@ usage:
steps:
- aws-cli/setup:
# This example uses CircleCI's OpenID Connect Token to generate temporary AWS keys
role-arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
role_arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
region: AWS_REGION
profile_name: "OIDC-PROFILE"
session-duration: 3600
Expand Down
4 changes: 2 additions & 2 deletions src/examples/verify_revision_deplopyment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ description: Verify the deployment of an ECS revision.
usage:
version: 2.1
orbs:
aws-cli: circleci/aws-cli@3.1
aws-cli: circleci/aws-cli@4.0
aws-ecs: circleci/[email protected]
jobs:
verify-deployment:
Expand All @@ -11,7 +11,7 @@ usage:
steps:
- aws-cli/setup:
# This example uses CircleCI's OpenID Connect Token to generate temporary AWS keys
role-arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
role_arn: "arn:aws:iam::123456789012:role/OIDC_ARN"
region: AWS_REGION
profile_name: "OIDC-PROFILE"
session-duration: 3600
Expand Down
17 changes: 17 additions & 0 deletions src/executors/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
A Python Docker image built to run on CircleCI that contains python installed with pyenv and packaging tools pip, pipenv, and poetry.
parameters:
tag:
description: >
Select any of the available tags here: https://circleci.com/developer/images/image/cimg/python.
type: string
default: "3.10.4"
resource_class:
description: Configure the executor resource class
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge", "2xlarge", "2xlarge+"]
default: "medium"

docker:
- image: cimg/python:<<parameters.tag>>
resource_class: <<parameters.resource_class>>
12 changes: 5 additions & 7 deletions src/jobs/deploy_service_update.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
description: >
Install AWS CLI and update the ECS service with the registered task definition.
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: 'cimg/python:3.10.4'
region:
description: AWS region to operate in. Set this to the name of the environment variable you will use to hold this value, i.e. AWS_DEFAULT_REGION.
type: string
Expand Down Expand Up @@ -228,7 +222,11 @@ parameters:
The authentication method used to access your AWS account. Import the aws-cli orb in your config and
provide the aws-cli/setup command to authenticate with your preferred method. View examples for more information.
type: steps

executor:
description: The executor to use for this job. By default, this will use the "default" executor provided by this orb.
type: executor
default: default
executor: << parameters.executor >>
steps:
- steps: << parameters.auth >>
- update_service:
Expand Down
Loading

0 comments on commit 64e67ad

Please sign in to comment.