awslabs / amazon-ecr-credential-helper

Automatically gets credentials for Amazon ECR on docker push/docker pull

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Release 0.7.1 reports incorrect version

volphy opened this issue · comments

Tested on the following static binaries:
https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com/0.7.1/darwin-amd64/docker-credential-ecr-login
https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com/0.7.1/linux-amd64/docker-credential-ecr-login

In both cases, version number is reported incorrectly:

$ ./docker-credential-ecr-login version
 (github.com/docker/docker-credential-helpers) v0.0.0+unknown

Is it a duplicate of:
#797
?

Hi @volphy thanks for submitting the issue. Here is my initial triage of the issue.

TL; DR

I have confirmed this issue is a duplicate of #432, resolved by #635, and will be included in the 0.8.0 release. You can follow #798 for updates on the release.

As a workaround, users can can do ./docker-credential-ecr-login -v which prints the correct version for the <0.8.0 releases.

Long version

I reproduced the issue by downloading the v0.7.1 credential helper artifact from S3.

localhost:~$ ./docker-credential-ecr-login version
 (github.com/docker/docker-credential-helpers) v0.0.0+unknown
localhost:~$ ./docker-credential-ecr-login -v
amazon-ecr-credential-helper
Version:    0.7.1
Git commit: adf1bafd791ae7d4ff098108b1e91f36a4da5404
localhost:~$ 

The confusion I had was the ECR credential helper does not create a version flag in its main function. Version information is reported via -v flag.

flag.BoolVar(&versionFlag, "v", false, "print version and exit")

After some investigation I found #635 which showed the version command is added by github.com/docker/docker-credential-helpers and fixed the issue for the version information to show correct with version command.
https://github.com/docker/docker-credential-helpers/blob/6b9df3ebb5da5aa22f722b25506bba1414519c6a/credentials/credentials.go#L24

Lastly, I confirmed the issue is resolved in the next release (0.8.0) by building a local artifact from github.com/awslabs/amazon-ecr-credential-helper/blob/staging and validating the version command is working correctly.

[amazon-ecr-credential-helper]$ ./bin/local/docker-credential-ecr-login version
docker-credential-ecr-login (github.com/awslabs/amazon-ecr-credential-helper/ecr-login) 0.8.0
[amazon-ecr-credential-helper]$ ./bin/local/docker-credential-ecr-login -v
amazon-ecr-credential-helper
Version:    0.8.0
Git commit: 388a708
[amazon-ecr-credential-helper]$ 

Unless there are any objections, I recommend to keep this issue open until the release is complete so the fix can be verified before closing.

Verified the issue is resolved with the 0.8.0 release. https://github.com/awslabs/amazon-ecr-credential-helper/releases/tag/v0.8.0

[~]$ ./docker-credential-ecr-login version
docker-credential-ecr-login (github.com/awslabs/amazon-ecr-credential-helper/ecr-login) 0.8.0
[~]$ ./docker-credential-ecr-login -v
amazon-ecr-credential-helper
Version:    0.8.0
Git commit: 388a708931c25b953eb88e6a40f4ef67cd0278fe