-
Notifications
You must be signed in to change notification settings - Fork 104
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
feat: add go releaser #309
Conversation
✅ Deploy Preview for kamaji-documentation ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks for picking up this, @dierbei!
Kamaji is using Go's ldflag
to embed some information about itself version:
Lines 148 to 169 in 4db8230
# Get information about git current status | |
GIT_HEAD_COMMIT ?= $$(git rev-parse --short HEAD) | |
GIT_TAG_COMMIT ?= $$(git rev-parse --short v$(VERSION)) | |
GIT_MODIFIED_1 ?= $$(git diff $(GIT_HEAD_COMMIT) $(GIT_TAG_COMMIT) --quiet && echo "" || echo ".dev") | |
GIT_MODIFIED_2 ?= $$(git diff --quiet && echo "" || echo ".dirty") | |
GIT_MODIFIED ?= $$(echo "$(GIT_MODIFIED_1)$(GIT_MODIFIED_2)") | |
GIT_REPO ?= $$(git config --get remote.origin.url) | |
BUILD_DATE ?= $$(git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%dT%H:%M:%S) | |
build: generate fmt vet ## Build manager binary. | |
go build -o bin/manager main.go | |
run: manifests generate fmt vet ## Run a controller from your host. | |
go run ./main.go | |
docker-build: ## Build docker image with the manager. | |
docker build -t ${IMG} . --build-arg GIT_HEAD_COMMIT=$(GIT_HEAD_COMMIT) \ | |
--build-arg GIT_TAG_COMMIT=$(GIT_TAG_COMMIT) \ | |
--build-arg GIT_MODIFIED=$(GIT_MODIFIED) \ | |
--build-arg GIT_REPO=$(GIT_REPO) \ | |
--build-arg GIT_LAST_TAG=$(VERSION) \ | |
--build-arg BUILD_DATE=$(BUILD_DATE) |
Are you aware if we can pass custom values as we're doing with regular Go builds?
Line 30 in 4db8230
-ldflags "-X github.com/clastix/kamaji/internal.GitRepo=$GIT_REPO -X github.com/clastix/kamaji/internal.GitTag=$GIT_LAST_TAG -X github.com/clastix/kamaji/internal.GitCommit=$GIT_HEAD_COMMIT -X github.com/clastix/kamaji/internal.GitDirty=$GIT_MODIFIED -X github.com/clastix/kamaji/internal.BuildTime=$BUILD_DATE" \ |
Thanks for your suggestion, I will try it later. |
I encountered another problem. When I tried to use make build to build the program, I encountered that I tried adding the following code in the Makefile, do I need to fix this problem?
|
b44a12a
to
7eb1a05
Compare
After testing, it is already possible to pass parameters in the build process through ldflags. Can you review it for me? |
@@ -171,6 +171,24 @@ docker-build: ## Build docker image with the manager. | |||
docker-push: ## Push docker image with the manager. | |||
docker push ${IMG} | |||
|
|||
create-tag: # Add a tag to the current commit and push it to the remote repository. | |||
@git tag -a v$(VERSION) -m "Welcome to kamoji version $(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.
Hey @dierbei thank you! There's a typo here in kamaji version
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
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.
Hi @dierbei, about releasing also the manifests we can use the release.extra_files
to include with a glob pattern manifest files expected to be released to install Kamaji from bare manifets.
Then, update the checksum
with the same extra_files
content. What do you think?
In any case @prometherion, we should have in place (also generated from the pipeline with GitHub actions), a manifest that contain CRDs and Kamaji plus default DataStore (or CRDs and deployments separated).
Hi @dierbei, did you have the chance to look into the suggestions? |
Sorry, I've been busy with grad school exams lately. May not have much time. |
Closing this due to inactivity, sorry for the small support we've been able to provide 😞 |
Fix #292