-
Notifications
You must be signed in to change notification settings - Fork 154
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 pipecd builtin tags to ECS resources #4140
Conversation
@@ -105,7 +105,7 @@ func rollback(ctx context.Context, in *executor.Input, platformProviderName stri | |||
// Re-register TaskDef to get TaskDefArn. | |||
// Consider using DescribeServices and get services[0].taskSets[0].taskDefinition (taskDefinition of PRIMARY taskSet) | |||
// then store it in metadata store and use for rollback instead. | |||
td, err := client.RegisterTaskDefinition(ctx, taskDefinition) | |||
td, err := client.RegisterTaskDefinition(ctx, taskDefinition, serviceDefinition.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 think we only care about the cluster/service/task thus we don't need to tag the taskDefinition, since it isn't a part of the application anyway. wdyt?
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 can also get TaskDef from Task, and it certainly seems unnecessary...
Since TaskDef can also be retrieved from Task, it certainly seems unnecessary to tag the taskDef.
I'll give it some more thought and fix it!🙇
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.
Any besides, we should check whether tags which are added to the service is automatically added to the tasks which are controlled by service or not as well 👀
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.
The --propagateTags
parameter can be used to copy tags from a task definition or service to a task in the service🚀
"github.com/aws/aws-sdk-go-v2/service/ecs/types" | ||
"go.uber.org/zap" | ||
"golang.org/x/sync/singleflight" | ||
|
||
"github.com/pipe-cd/pipecd/pkg/config" | ||
) | ||
|
||
const ( | ||
LabelApplication string = "pipecd-dev-application" // The application this resource belongs to. |
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 add more builtin tags for ECS resources. For instant, in case of CloudRun, we have as below
https://github.com/pipe-cd/pipecd/blob/master/pkg/app/piped/platformprovider/cloudrun/cloudrun.go#L86-L93
I think we should also have: TagManagedBy (value will be piped in all cases), LabelPiped, LabelCommitHash as the PipeCD builtin tags for ECS resources.
@@ -109,3 +119,11 @@ var defaultRegistry = ®istry{ | |||
func DefaultRegistry() Registry { | |||
return defaultRegistry | |||
} | |||
|
|||
func CreateTags(keyValue map[string]string) []types.Tag { |
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.
func CreateTags(keyValue map[string]string) []types.Tag { | |
func MakeTags(tags map[string]string) []types.Tag { |
nits
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.
Nice work 👍
pkg/app/piped/executor/ecs/ecs.go
Outdated
if serviceDefinition.PropagateTags == "" { | ||
serviceDefinition.PropagateTags = types.PropagateTagsService | ||
} |
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.
Sorry, I missed this part. I think we should always propagate the tags from the service to its tasks due to tags contains out builtin tags as well. So it's better to set the value to CreateServiceInput.PropagateTags directly in CreateService method. WDYT?
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 agree.
I think we should always propagate tags from the service to its tasks.
So, set the value directly to CreateServiceInput.PropagateTags in the CreateService method.
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.
Here you go 🙌
* Add tags to aws resources. * Small fix * Small fix * Fix initial slice length. * Add TagResource function * Fix deploy process * Add tags to aws resources. * Small fix * Small fix * Fix initial slice length. * Add TagResource function * Fix deploy process * Delete Unnecessary blank lines * Change how to add task's tags * Delete TagResource method * Fix based on linter * Apply review * add builtin-labels * Add tagResource func * Set default value of PropagateTags * Apply review * Apply review
#4157 #4161 (#4163) * Templating commit message used by Event watcher (#4120) * Added ability to teplate eventWatcher.gitRepos.commitMessage * parse template in the eventWatcher handler side * Parse template in the eventWatcher handler side * Fix html/template to text/template * There was a useless process when retrieving rules, so I omitted it. * Delete html/template * Update pkg/app/piped/eventwatcher/eventwatcher.go Co-authored-by: Khanh Tran <[email protected]> * Update pkg/app/piped/eventwatcher/eventwatcher.go Co-authored-by: Khanh Tran <[email protected]> * Using template variables are only Value and EventName. * Update pkg/app/piped/eventwatcher/eventwatcher.go Co-authored-by: knanao <[email protected]> * Update pkg/app/piped/eventwatcher/eventwatcher.go Co-authored-by: knanao <[email protected]> * Fix syntax error * Update pkg/app/piped/eventwatcher/eventwatcher.go Co-authored-by: Khanh Tran <[email protected]> Co-authored-by: Khanh Tran <[email protected]> Co-authored-by: knanao <[email protected]> * Add environment variable expire web session (#4127) * add field session-ttl to project * edit values * reflect ttl config to session * return values * add field in document * return config * change variable name * modify document and manifest * modify docs * change minites tp hours * regen * Change build tag every time when make run/pipecd (#4130) * add unix time to tail of build tag * modify assigning * change variable name * change type pf assign * Fix docs wrong params name (#4132) * Fix pod config for envoy upstreaming termination error (#4134) * add lifecycle * add preStop to api server's manifest * return makefile * Fix Fix parseComitMsg's comment (#4135) * Add kubectl version to stage log (#4137) * Add kubectl version to stage log * Update pkg/app/piped/executor/kubernetes/kubernetes.go Co-authored-by: knanao <[email protected]> Co-authored-by: knanao <[email protected]> * Add pipecd builtin tags to ECS resources (#4140) * Add tags to aws resources. * Small fix * Small fix * Fix initial slice length. * Add TagResource function * Fix deploy process * Add tags to aws resources. * Small fix * Small fix * Fix initial slice length. * Add TagResource function * Fix deploy process * Delete Unnecessary blank lines * Change how to add task's tags * Delete TagResource method * Fix based on linter * Apply review * add builtin-labels * Add tagResource func * Set default value of PropagateTags * Apply review * Apply review * Add upgrade a release method for helm (#4143) * tool: Replace set-output with GITHUB_OUTPUT (#4155) * Make all changes that not be listed in ignores but placed under appDir considered as touched commit (#4157) * Release v0.41.4 (#4161) * Release v0.41.4 * Update the release note --------- Co-authored-by: funera1 <[email protected]> Co-authored-by: Khanh Tran <[email protected]> Co-authored-by: kevin55156 <[email protected]> Co-authored-by: Tomoki Hori <[email protected]> Co-authored-by: Naoki Kanatani <[email protected]>
What this PR does / why we need it:
Add PipeCD builtin tags for ECS resources.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: