-
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c006e82
Add tags to aws resources.
TonkyH 13fc5bc
Small fix
TonkyH a973d11
Small fix
TonkyH ca0a60d
Fix initial slice length.
TonkyH b2ce287
Add TagResource function
TonkyH c2a85d1
Fix deploy process
TonkyH 9a9ee5b
Add tags to aws resources.
TonkyH 74c29dc
Small fix
TonkyH 9643e01
Small fix
TonkyH b072278
Fix initial slice length.
TonkyH 09a423a
Add TagResource function
TonkyH 33831eb
Fix deploy process
TonkyH 1297a75
Merge branch 'ecs-tag' of github.com:TonkyH/pipecd into ecs-tag
TonkyH c4ae0f5
Delete Unnecessary blank lines
TonkyH 5882609
Change how to add task's tags
TonkyH 14954a7
Delete TagResource method
TonkyH 9b8a215
Fix based on linter
TonkyH 17697c3
Apply review
TonkyH defc1ba
add builtin-labels
TonkyH d517e33
Add tagResource func
TonkyH c7970b4
Merge branch 'master' of github.com:TonkyH/pipecd into ecs-tag
TonkyH 6669ad1
Set default value of PropagateTags
TonkyH 9833e37
Apply review
TonkyH 94c3ba1
Apply review
TonkyH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -19,13 +19,18 @@ import ( | |||||
"path/filepath" | ||||||
"sync" | ||||||
|
||||||
"github.com/aws/aws-sdk-go-v2/aws" | ||||||
"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. | ||||||
) | ||||||
|
||||||
// Client is wrapper of ECS client. | ||||||
type Client interface { | ||||||
ECS | ||||||
|
@@ -37,7 +42,7 @@ type ECS interface { | |||||
CreateService(ctx context.Context, service types.Service) (*types.Service, error) | ||||||
UpdateService(ctx context.Context, service types.Service) (*types.Service, error) | ||||||
RegisterTaskDefinition(ctx context.Context, taskDefinition types.TaskDefinition) (*types.TaskDefinition, error) | ||||||
RunTask(ctx context.Context, taskDefinition types.TaskDefinition, clusterArn string, launchType string, awsVpcConfiguration *config.ECSVpcConfiguration) error | ||||||
RunTask(ctx context.Context, taskDefinition types.TaskDefinition, clusterArn string, launchType string, awsVpcConfiguration *config.ECSVpcConfiguration, tags []types.Tag) error | ||||||
GetPrimaryTaskSet(ctx context.Context, service types.Service) (*types.TaskSet, error) | ||||||
CreateTaskSet(ctx context.Context, service types.Service, taskDefinition types.TaskDefinition, targetGroup *types.LoadBalancer, scale int) (*types.TaskSet, error) | ||||||
DeleteTaskSet(ctx context.Context, service types.Service, taskSetArn string) error | ||||||
|
@@ -109,3 +114,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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
nits |
||||||
tags := make([]types.Tag, 0, len(keyValue)) | ||||||
for key, value := range keyValue { | ||||||
tags = append(tags, types.Tag{Key: aws.String(key), Value: aws.String(value)}) | ||||||
} | ||||||
return tags | ||||||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.