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

services: expose build version #986

Merged
merged 2 commits into from
Jul 6, 2023
Merged

Conversation

jkralik
Copy link
Member

@jkralik jkralik commented Jul 4, 2023

No description provided.

@jkralik jkralik force-pushed the jkralik/feature/exposeVersion branch 8 times, most recently from 1ba29a1 to c05f10f Compare July 6, 2023 07:15
@jkralik jkralik marked this pull request as ready for review July 6, 2023 07:59
@jkralik jkralik force-pushed the jkralik/feature/exposeVersion branch from c05f10f to 78205dd Compare July 6, 2023 07:59
#coap-gateway
ARG service=coap-gateway
WORKDIR $root_directory/$service
RUN go build -ldflags "-linkmode external -extldflags -static" -o /go/bin/$service ./cmd/service
RUN go build -ldflags "-linkmode external -extldflags -static -X github.com/plgd-dev/hub/v2/pkg/build.CommitDate=$COMMIT_DATE -X github.com/plgd-dev/hub/v2/pkg/build.CommitHash=$SHORT_COMMIT -X github.com/plgd-dev/hub/v2/pkg/build.BuildDate=$DATE -X github.com/plgd-dev/hub/v2/pkg/build.Version=$VERSION -X github.com/plgd-dev/hub/v2/pkg/build.ReleaseURL=$RELEASE_URL" -o /go/bin/$service ./cmd/service
Copy link
Member

@Danielius1922 Danielius1922 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happends when the ARG is not set by the caller of this Dockerfile?

For example: COMMIT_DATE is not be set, so it will call

`-X github.com/plgd-dev/hub/v2/pkg/build.CommitDate=`

which will write an empty string to CommitDate in build.go.

I guess that shouldn't break anything in the runtime of the services. Or should they always be filled? In that case we should add checks that the values are filled here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, They don't need to be filled. In this case UI doesn't get any information of the build. Same as it is before.

@jkralik jkralik force-pushed the jkralik/feature/exposeVersion branch from 78c3ee0 to 4aba148 Compare July 6, 2023 14:27
@sonarcloud
Copy link

sonarcloud bot commented Jul 6, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.9% 88.9% Coverage
15.3% 15.3% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@jkralik jkralik merged commit 80f395b into main Jul 6, 2023
26 of 27 checks passed
@jkralik jkralik deleted the jkralik/feature/exposeVersion branch July 6, 2023 16: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.

2 participants