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

Compile time versioning #42

Merged
merged 3 commits into from
Aug 12, 2019
Merged

Compile time versioning #42

merged 3 commits into from
Aug 12, 2019

Conversation

CKarper
Copy link
Collaborator

@CKarper CKarper commented Aug 12, 2019

This will build a Docker image with compile time version info built in. It hooks into the build.sh, so local make will work as well.

I don't know how you're building in Codefresh, so this may or may not work there. But you can steal the basic idea, or tell me how to change this to get to where it needs to be.

Closes #35

@CKarper
Copy link
Collaborator Author

CKarper commented Aug 12, 2019

Is there a need to build this locally? I've changed the method to work around the codefresh/goreleaser method... But this Makefile could be tuned up to do better for local dev.

Alternately, we could use a Dockerfile for local dev, and make a Dockerfile.release that CI would refer to.

iris "$@"
Copy link
Owner

Choose a reason for hiding this comment

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

With ldflags we dont need that file anymore

Dockerfile Outdated

COPY dist/iris_linux_386/iris /usr/local/bin/
COPY hack/docker_entrypoint.sh /entrypoint.sh
COPY VERSION /VERSION

ENTRYPOINT ["sh", "entrypoint.sh"]
Copy link
Owner

Choose a reason for hiding this comment

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

Can now be just ENTRYPOINT [ "/usr/local/bin/iris" ]

Dockerfile Outdated
@@ -1,10 +1,9 @@
FROM alpine:3.8

RUN apk add --update ca-certificates
RUN apk --no-cache add --update ca-certificates

COPY dist/iris_linux_386/iris /usr/local/bin/
COPY hack/docker_entrypoint.sh /entrypoint.sh
Copy link
Owner

Choose a reason for hiding this comment

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

Irrelevant as well

@olegsu
Copy link
Owner

olegsu commented Aug 12, 2019

Thanks, wanted to update ldflags a long time ago
Just need to make sure the ${{IRIS_VERSION}} in codefesh.yaml is exported for the workflow

@CKarper CKarper marked this pull request as ready for review August 12, 2019 15:11
@CKarper CKarper changed the title WIP: Compile time versioning Compile time versioning Aug 12, 2019
image: alpine:3.8
stage: Integration
commands:
- apk add --no-cache curl jq python py-pip
- pip install yq
- sh ${{CF_VOLUME_PATH}}/iris/hack/.codefresh/push-helm.sh
# ^-- cfexports IRIS_VERSION from VERSION file
Copy link
Owner

Choose a reason for hiding this comment

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

cf_export IRIS_VERSION=$(cat VERSION) should do the job

Copy link
Collaborator Author

@CKarper CKarper Aug 12, 2019

Choose a reason for hiding this comment

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

No, that's just a comment explaining that the script exports that. It took me a while to find where IRIS_VERSION was coming from, so I added the comment pointing to that script.

https://github.com/olegsu/iris/blob/master/hack/.codefresh/push-helm.sh#L25

@olegsu
Copy link
Owner

olegsu commented Aug 12, 2019

lgtm

@CKarper CKarper merged commit 8289fa6 into olegsu:master Aug 12, 2019
@CKarper CKarper deleted the BuildVersion branch August 12, 2019 18:07
@CKarper
Copy link
Collaborator Author

CKarper commented Aug 12, 2019

image

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.

Use custom User Agent
2 participants