aws-extensions-for-dotnet-cli icon indicating copy to clipboard operation
aws-extensions-for-dotnet-cli copied to clipboard

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

Open NickDarvey opened this issue 3 years ago • 8 comments

-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

  • [ ] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

NickDarvey avatar Mar 04 '21 12:03 NickDarvey

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

ashishdhingra avatar Mar 04 '21 22:03 ashishdhingra

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.

NickDarvey avatar Mar 04 '21 23:03 NickDarvey

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.

github-actions[bot] avatar Aug 13 '22 00:08 github-actions[bot]

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

normj avatar Apr 21 '23 21:04 normj

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.

github-actions[bot] avatar Apr 27 '23 00:04 github-actions[bot]

@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.

NickDarvey avatar Apr 27 '23 22:04 NickDarvey

@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?

normj avatar May 06 '23 00:05 normj

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 :)

NickDarvey avatar May 08 '23 04:05 NickDarvey