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: agent version used in build so gha properly evaluates env var #201

Closed
wants to merge 14 commits into from

Conversation

JamieDanielson
Copy link
Contributor

@JamieDanielson JamieDanielson commented Sep 18, 2023

Which problem is this PR solving?

Short description of the changes

  • try changing RELEASE_VERSION variable to REL_VERSION in case it's being used already in GHA workflow somewhere.

How to verify that this has the expected result

Review the output in the action for docker-build on the PR. Search for "ldflags" and confirm the "-X main.Version=ca4d958" instead shows "-X main.Version=v0.0.14-alpha-6-gca4d958" instead of ca4d958.

(It should be v0.0.15-alpha but the previous tag was not annotated)

#16 [builder 7/7] RUN make build
#16 0.130 CGO_ENABLED=1 GOOS=linux \
#16 0.130 	go build \
#16 0.130 		--ldflags "-X main.Version=v0.0.14-alpha-6-gca4d958" \
#16 0.130 		-o hny-network-agent main.go
#16 DONE 86.4s

Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
@JamieDanielson JamieDanielson requested a review from a team as a code owner September 18, 2023 16:58
@JamieDanielson JamieDanielson self-assigned this Sep 18, 2023
@JamieDanielson JamieDanielson added the type: bug Something isn't working label Sep 18, 2023
JamieDanielson and others added 9 commits September 18, 2023 13:03
Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
if this somehow still doesnt work with i_made_this_up...

(╯°□°)╯︵ ┻━┻

Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
- take shell and git out of the equation
- make version uses variable with hardcoded string
- make build uses hardcoded string

Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
Adds RELEASE_VERISON as an optional build argument to the Dockerfile.

RELEASE_VERSION is still computed by the Makefile.

For the docker-build make target, pass in the version with --build-arg.

For the docker/build-and-publish GitHub Action in our Release workflow,
compute the RELEASE_VERSION with our make version target, set it in the
environment for the workflow per GitHub docs[1], and pass in the arg
with the build-args: key for the action.

[1] https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
@JamieDanielson JamieDanielson changed the title maint: try different variable in case gha uses it fix: fix agent version used in build so gha properly evaluates env var Sep 18, 2023
robbkidd and others added 4 commits September 18, 2023 15:34
JamieDanielson added a commit that referenced this pull request Sep 18, 2023
## Which problem is this PR solving?

- Reverts #186 
- Reverts #187 

## Short description of the changes

As seen in #192 (and attempted to fix in #201), GitHub Actions checkout
action doesn't include git tag history, so computing current version
from tags doesn't work at the moment.

We are temporarily reverting this to expedite a new release using
hardcoded version values, and will revisit this later.

## How to verify that this has the expected result

`honeycomb.agent_version` shows the `vX.Y.Z` version in use, in agent
container logs and telemetry.

---------

Co-authored-by: Robb Kidd <robbkidd@honeycomb.io>
push: false
platforms: linux/amd64
# platforms: linux/amd64,linux/arm64 - don't build arm64 on PRs for now
cache-from: type=gha
Copy link
Contributor

Choose a reason for hiding this comment

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

This disables docker layer caching between builds - does this prevent git tags being detected correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this doesn't seem to be related to our issue. Was just trying different settings to try to determine why the tag wasn't rendering as expected. I've set this PR back to draft as we'll be putting it down for now after removing the build interpreting version in #206

@JamieDanielson JamieDanielson marked this pull request as draft September 19, 2023 21:42
@robbkidd robbkidd changed the title fix: fix agent version used in build so gha properly evaluates env var fix: 🧊 fix agent version used in build so gha properly evaluates env var Sep 19, 2023
@robbkidd robbkidd changed the title fix: 🧊 fix agent version used in build so gha properly evaluates env var fix: 🧊 agent version used in build so gha properly evaluates env var Sep 19, 2023
@robbkidd robbkidd changed the title fix: 🧊 agent version used in build so gha properly evaluates env var fix: agent version used in build so gha properly evaluates env var Sep 19, 2023
@JamieDanielson
Copy link
Contributor Author

I'm going to close this PR because it's a bit distracting right now as an open PR; the issue is still open and this can be picked back up when it makes sense to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compute agent build version from release tags
3 participants