-
Notifications
You must be signed in to change notification settings - Fork 201
Generate PIPECD_VERSION before running the service #6239
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
base: master
Are you sure you want to change the base?
Generate PIPECD_VERSION before running the service #6239
Conversation
287fe2d to
d6f5c81
Compare
d6f5c81 to
46629ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@Warashi Can you try execute As evidence share in the PR's description, I see that the version is available at the top header, and also in the menu tab |
|
@linhdangduy Thanks for the patch 👍 ❯ docker run --rm -it --entrypoint /bin/sh ghcr.io/pipe-cd/piped:v0.54.0
/ $ piped version
Version: v0.54.0-dirty, GitCommit: 025ac2ec2d7b7edcc774a3cc548819e9c9fc9c6d, BuildDate: 20250916-063057I think it's caused by the Dockerignore, which makes Docker ignore files that are watched by git. |
|
I retried and got the same result. As far as I know, the |
|
@khanhtc1202 @Warashi Understood the root cause that Let's me check how can the issue be resolved. |
12edfa9 to
f726c0c
Compare
…)" (pipe-cd#6235)" This reverts commit 536a275. Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
81e889b to
989b9c7
Compare
Signed-off-by: Dan <[email protected]>
web/package.json
Outdated
| "build": "PIPECD_VERSION=${PIPECD_VERSION:-`git describe --tags --always --dirty --abbrev=7 --match 'v[0-9]*.*'`} webpack build --mode production --env htmlTemplate=./base.html --config ./webpack.config.js", | ||
| "dev": "PIPECD_VERSION=${PIPECD_VERSION:-`git describe --tags --always --dirty --abbrev=7 --match 'v[0-9]*.*'`} webpack serve --env htmlTemplate=./base.html --config ./webpack.config.dev.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@Warashi @khanhtc1202 @ffjlabo Please also refer to the PR's description and review when you have time 🙇🏼 |
| build-args: | | ||
| BUILD_VERSION=${{ env.PIPECD_VERSION }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There are arguments/variables named BUILD_VERSION and PIPECD_VERSION with the similar meaning. It's a bit confusing, so I want to use only either of them.
Makefile
Outdated
| run/pipecd: BUILD_LDFLAGS_PREFIX := -X github.com/pipe-cd/pipecd/pkg/version | ||
| run/pipecd: BUILD_OPTS ?= -ldflags "$(BUILD_LDFLAGS_PREFIX).version=$(BUILD_VERSION) $(BUILD_LDFLAGS_PREFIX).gitCommit=$(BUILD_COMMIT) $(BUILD_LDFLAGS_PREFIX).buildDate=$(BUILD_DATE) -w" | ||
| run/pipecd: CONTROL_PLANE_VALUES ?= ./quickstart/control-plane-values.yaml | ||
| run/pipecd: PIPECD_VERSION ?= $(shell git describe --tags --always --dirty --abbrev=7 --match 'v[0-9]*.*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the note below on L150-152. I think we can use BUILD_VERSION as --build-arg BUILD_VERSION=$(BUILD_VERSION) instead of defining PIPECD_VERSION
NOTE: previously
git describe --tagswas used to determine the version for running locally
However, this does not work on a forked branch, so the decision was made to hardcode at version 0.0.0
see: #4845
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Warashi Thanks for your comment.
I found the note below on L150-152. I think we can use BUILD_VERSION as --build-arg BUILD_VERSION=$(BUILD_VERSION) instead of defining PIPECD_VERSION
yeah, that is the reason I add PIPECD_VERSION here. Using the local BUILD_VERSION to pass to docker file is fine for me. I will fix it
There are arguments/variables named BUILD_VERSION and PIPECD_VERSION with the similar meaning. It's a bit confusing, so I want to use only either of them.
Understand your point. IMO, I prefer to use BUILD_VERSION than PIPECD_VERSION because: go backend code use BUILD_VERSION internally, and it is more general and can pass to any go build command (for pipectl / pided...)
But PIPECD_VERSION is also written in many places like:
So for now, there are 2 approaches:
- for the new code in the scope of PR, use the BUILD_VERSION variable, do not touch the existing place that have PIPECD_VERSION defined (and work on renaming later)
- OR change PIPECD_VERSION -> BUILD_VERSION as well
I'm thinking of going for first approach.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linhdangduy
Thank you for explaining.
I think it's good to going the first approach. Please doing so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local web access via http://localhost:8080 would become like this

fe2c365 to
1639e54
Compare
Signed-off-by: Dan <[email protected]>
Signed-off-by: Dan <[email protected]>
1639e54 to
ba6edda
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6239 +/- ##
===========================================
+ Coverage 28.83% 67.63% +38.79%
===========================================
Files 560 25 -535
Lines 59899 2283 -57616
===========================================
- Hits 17273 1544 -15729
+ Misses 41304 651 -40653
+ Partials 1322 88 -1234 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM







What this PR does:
make run/pipecdexecution speed (Improvemake run/pipecdexecution speed #6184)" (Revert "Improvemake run/pipecdexecution speed" #6235)"Makefile: build/web, run/pipecd.github/workflows/publish_image_chart.yaml: pass by build-args option provided bydocker/build-push-actiongithub action. Using the same tag value env.PIPECD_VERSION.github/workflows/publish_pipedv1_exp.yaml: add determine version same aspublish_image_chartcmd: receiving BUILD_VERSION and pass tomake build/goWhy we need it:
The reason
-dirtygot attached for the version on #6184 is:.dockerignoreto exclude unnecessary files from COPY command..gitwithin the image will consider that we have removed files so it's git status becomesdirty, that why whengit describe --tags --always --dirty...is executed,-dirtysuffix will be attached to the git tag version. Improvemake run/pipecdexecution speed #6184 (comment)To resolve above issue:
Just remove the😸-dirtyoption from git commandEvidence:
Which issue(s) this PR fixes:
Fixes #6184 (comment)
Does this PR introduce a user-facing change?:
What I have noticed but not do in this PR:
docker buildtime of other Dockerfile (launcher / pipectl / piped...) by copy only what necessary. But I decided to keep this PR as a fix of Improvemake run/pipecdexecution speed #6184, and make sure if we can go with this change and confirm it is worked