Skip to content
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

fix: Add version ldflags for building manager-api in Dockerfile #1393

Merged
merged 2 commits into from Jan 29, 2021

Conversation

imjoey
Copy link
Member

@imjoey imjoey commented Jan 29, 2021

Signed-off-by: imjoey majunjie@apache.org

Please answer these questions before submitting a pull request

  • Why submit this pull request?

  • Bugfix

  • New feature provided

  • Improve performance

  • Backport patches

  • Related issues

Fixes #1350 .


Bugfix

  • Description

At previous manager-api build phase in Dockerfile, the ldflags of github.com/apisix/manager-api/cmd.Version and github.com/apisix/manager-api/cmd.GitHash are missing. This lead to the no Version output when running manager-api, as described in #1350 .

  • How to fix?

Add missing ldflags in Dockerfile. For simplicity, this PR is going to reuse the existing built script ./api/build.sh to compile out the binary.

In addition, this PR will also reduce the usage of RUN commands for smaller image size.

  • Additional

FYI, since there is no .githash or .git/ within the artifact downloaded from Github , the GitHash output is still missing.

Signed-off-by: imjoey <majunjie@apache.org>
@imjoey
Copy link
Member Author

imjoey commented Jan 29, 2021

ping @nic-chen @starsz @moonming for reviewing. Thanks.

@nic-chen
Copy link
Member

@imjoey thanks
we could run test for it,please refer https://github.com/apache/apisix-dashboard/blob/master/.github/workflows/deploy-with-docker.yml
but don't push the image

Signed-off-by: imjoey <majunjie@apache.org>
@codecov-io
Copy link

codecov-io commented Jan 29, 2021

Codecov Report

Merging #1393 (2aa8dd8) into master (619165a) will increase coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1393      +/-   ##
==========================================
+ Coverage   65.73%   65.87%   +0.13%     
==========================================
  Files          44       44              
  Lines        2948     2948              
==========================================
+ Hits         1938     1942       +4     
+ Misses        781      774       -7     
- Partials      229      232       +3     
Impacted Files Coverage Δ
api/internal/utils/closer.go 33.33% <0.00%> (ø)
api/internal/core/storage/etcd.go 48.48% <0.00%> (ø)
api/cmd/managerapi.go 60.29% <0.00%> (+5.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 619165a...2aa8dd8. Read the comment docs.

@imjoey
Copy link
Member Author

imjoey commented Jan 29, 2021

@imjoey thanks
we could run test for it,please refer https://github.com/apache/apisix-dashboard/blob/master/.github/workflows/deploy-with-docker.yml
but don't push the image

@nic-chen thanks for the direction. An additional CI test triggered on pull request is added for docker testing. Any feedback is welcome.

@imjoey imjoey changed the title fix: Add version ldflags for building manager-api fix: Add version ldflags for building manager-api in Dockerfile Jan 29, 2021
@imjoey imjoey requested a review from tokers January 29, 2021 14:51
@nic-chen
Copy link
Member

@imjoey thanks
we could run test for it,please refer https://github.com/apache/apisix-dashboard/blob/master/.github/workflows/deploy-with-docker.yml
but don't push the image

@nic-chen thanks for the direction. An additional CI test triggered on pull request is added for docker testing. Any feedback is welcome.

well done! thanks.

@juzhiyuan juzhiyuan merged commit bb50494 into apache:master Jan 29, 2021
@imjoey imjoey deleted the fix_no_version_docker branch January 29, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: starting the Manager API in docker does not display the version number
4 participants