aws / aws-extensions-for-dotnet-cli

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Apache License 2.0
371 stars 87 forks source link

Support image tag property in `lambda package-ci` command #160

Open NickDarvey opened 3 years ago

NickDarvey commented 3 years ago

-it | --image-tag looks like it is supported in package but not package-ci. Is this as designed?

https://github.com/aws/aws-extensions-for-dotnet-cli/blob/9639f8f4902349d289491b290979a3a1671cc0a5/src/Amazon.Lambda.Tools/Commands/PackageCommand.cs#L31

https://github.com/aws/aws-extensions-for-dotnet-cli/blob/9639f8f4902349d289491b290979a3a1671cc0a5/src/Amazon.Lambda.Tools/Commands/PackageCICommand.cs#L26-L37

Describe the Feature

Allowing users to specify the tag for my Docker image using the --image-tag switch.

Is your Feature Request related to a problem?

The generated image tag (taken from the project name) might not be the one that's desired.

Proposed Solution

Unsure. Is this code base up to date with what is published as a dotnet tool?

Describe alternatives you've considered

Accepting life as-is. Edit: It appears to work when set in aws-lambda-tools.defaults.json.

Additional Context

Environment


This is a :rocket: Feature Request

ashishdhingra commented 3 years ago

Not sure if this is feasible and how the image tag could be specified in the serverless.template. Needs more investigation.

NickDarvey commented 3 years ago

I'm not sure I understand. Right now, by default, here's a name:tag combo being generated from the project name and used for the Docker image build and push. You can already manually set it using aws-lambda-tools-defaults.json, this feature is a request to an option to specify it via a command line parameter.

github-actions[bot] commented 2 years ago

We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

normj commented 1 year ago

Because the package-ci command is potentially packaging multiple .NET projects that referenced in the CloudFormation template you need to set the image tag in there as well. If we had an --image-tag switch for for the package-ci command it would use the same tag for all of the containers being built from the CloudFormation template overwriting each other. Here is an example of how to set the image tag in the template.

image

github-actions[bot] commented 1 year ago

This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

NickDarvey commented 1 year ago

@normj

If we had an --image-tag switch for for the package-ci command it would use the same tag for all of the containers being built from the CloudFormation template overwriting each other.

Is that what happens when you set it via aws-lambda-tools.defaults.json? Maybe the tool should error if it’s used with multiple projects when an image tag is set. Then an image tag switch could be added which would, similarly, error if used with multiple projects.

normj commented 1 year ago

@NickDarvey Interesting the image-tag being used from aws-lambda-tools.defaults.json is actually an accidental side effect since the package-ci command eventually forwards into the package command's code for each project it is bundling into an image. Although that image-tag isn't being used solely, the package-ci command does inject the CloudFormation resource name into the image tag to make it unique. Are you okay with the tag not being exactly as you entered. I guess what I'm asking is would you be okay if we exposed an image tag prefix/suffix switch but we still used our code to make sure the full tag name is unique?

NickDarvey commented 1 year ago

Interesting the image-tag being used from aws-lambda-tools.defaults.json is actually an accidental side effect since the package-ci command eventually forwards into the package command's code for each project it is bundling into an image.

Ahh I see.

I guess what I'm asking is would you be okay if we exposed an image tag prefix/suffix switch but we still used our code to make sure the full tag name is unique?

That would work for me :)