-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add profile-name option to update-service orb #60
Conversation
Add newline escapes Use `default` profile instead of env var
description: | ||
AWS profile used for calls to aws api. | ||
type: string | ||
default: default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make it "" by default? Ideally, I would like --profile
to not be set when the value of profile-name
is ""
, to avoid conflicts with existing usage of the orb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update .circleci/config.yml
to add profile-name: default
to the aws-ecs/deploy-service-update
job at
aws-ecs-orb/.circleci/config.yml
Line 575 in 8626489
- aws-ecs/deploy-service-update: |
aws-ecs-orb/.circleci/config.yml
Line 806 in 8626489
- aws-ecs/deploy-service-update: |
@@ -564,17 +570,20 @@ commands: | |||
--cluster << parameters.cluster-name >> \ | |||
--services ${SERVICE_NAME} \ | |||
--output text \ | |||
--query 'services[0].deployments[].[taskDefinition, status]') | |||
--query 'services[0].deployments[].[taskDefinition, status]' \ | |||
--profile << parameters.profile-name >>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work as expected as the profile-name
parameter should also be defined in the command and the job should pass the parameter to the command. Additionally, I would like it if --profile
were not set if the value of profile-name
is "".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws-cli-orb creates the default profile. Couldn't we follow the same pattern ? @lokst can you explain your concern about having a profile name empty please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sylwit I'd like to avoid the chance of unintended effects on users as the orb's commands may not necessarily be used with the aws-cli orb. Hence, I'd rather --profile
not be set if the user did not specify a non-empty value.
NUM_DEPLOYMENTS=$(aws ecs describe-services \ | ||
--cluster << parameters.cluster-name >> \ | ||
--services ${SERVICE_NAME} \ | ||
--output text \ | ||
--query 'length(services[0].deployments)') | ||
--query 'length(services[0].deployments)' \ | ||
--profile << parameters.profile-name >>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be updated such that --profile will not be set if the value of profile-name is ""?
TARGET_REVISION=$(aws ecs describe-services \ | ||
--cluster << parameters.cluster-name >> \ | ||
--services ${SERVICE_NAME} \ | ||
--output text \ | ||
--query "services[0].deployments[?taskDefinition==\`<< parameters.task-definition-arn >>\` && runningCount == desiredCount && (status == \`PRIMARY\` || status == \`ACTIVE\`)][taskDefinition]") | ||
--query "services[0].deployments[?taskDefinition==\`<< parameters.task-definition-arn >>\` && runningCount == desiredCount && (status == \`PRIMARY\` || status == \`ACTIVE\`)][taskDefinition]" \ | ||
--profile << parameters.profile-name >>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be updated such that --profile will not be set if the value of profile-name is ""?
@@ -619,7 +628,7 @@ commands: | |||
- run: | |||
name: Retrieve previous task definition and prepare new task definition values | |||
command: | | |||
PREVIOUS_TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition << parameters.family >> --include TAGS) | |||
PREVIOUS_TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition << parameters.family >> --profile << parameters.profile-name >> --include TAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work as expected as the profile-name parameter should also be defined in the command and the job should pass the parameter to the command. Additionally, I would like it if --profile were not set if the value of profile-name is "".
@@ -716,7 +725,9 @@ commands: | |||
--container-definitions "${CCI_ORB_AWS_ECS_CONTAINER_DEFS}" \ | |||
"$@" \ | |||
--output text \ | |||
--query 'taskDefinition.taskDefinitionArn') | |||
--query 'taskDefinition.taskDefinitionArn' \ | |||
--profile << parameters.profile-name >>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be updated such that --profile will not be set if the value of profile-name is ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasnad27 Thank you for your awesome work! I left some comments and would love if you could review them!
I had similar reservations about making You can expect a follow up commit this weekend. Thanks for the quick turnaround on the review! |
Not quite "next weekend" Primarily due to social obligations and some re-prioritization at work, but... @lokst I wanted to get your take on this before I spend any more time getting the arguments to parse correctly. The most elegant way I could find to do this in bash (disclaimer: my bash skills are decidedly NOT elegant) was to build up an array with conditionals...
This almost works but I'm getting a jmespath error ( |
@lucasnad27 No worries and thanks so much for taking the time! 🙂 Regarding the approach, for consistency, I think we could use something similar to what is done in other parts of the orb, for optional parameters: Lines 680 to 682 in bff006f
Line 719 in bff006f
(If there are cases where |
I was working on the same "feature" when I found that you already have this PR. I'll be happy to help if you need @lucasnad27 |
Checklist
Motivation, issues
Please see #41 for detailed information on this patch
Description
add optional
profile-name
parameter todeploy-service-update