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: embed version in kubectl-retina with goreleaser #170

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

rbtr
Copy link
Collaborator

@rbtr rbtr commented Mar 28, 2024

Description

The ldflag needs to be the full module-aware path to the variable Version. This causes issues with kubectl-retina because that Version is used to set image versions for the k8s objects created to take captures.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documantation.
  • I signed and signed-off the commits (git commit -S -s ...)
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Testing

$ goreleaser build --clean --snapshot --single-target
...
  • building binaries
    • partial build                                  match=target=linux_amd64
    • building                                       binary=dist/retina_linux_amd64_v1/kubectl-retina-linux-amd64
...
$ ./dist/retina_linux_amd64_v1/kubectl-retina-linux-amd64 version
0.0.2-SNAPSHOT-027d383

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@rbtr rbtr requested a review from a team as a code owner March 28, 2024 19:10
@rbtr rbtr force-pushed the fix/kubectl-retina-version branch from 9902835 to 027d383 Compare March 28, 2024 19:11
@rbtr rbtr self-assigned this Mar 28, 2024
@rbtr rbtr added lang/go The Go Programming Language type/fix Fixes something priority/0 P0 labels Mar 28, 2024
@rbtr rbtr enabled auto-merge (squash) March 28, 2024 19:16
nddq
nddq previously approved these changes Mar 28, 2024
Copy link
Contributor

@anubhabMajumdar anubhabMajumdar left a comment

Choose a reason for hiding this comment

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

Can you also use the kubectl-retina to start a capture job and make sure the agent image is correct?

cli/cmd/version.go Outdated Show resolved Hide resolved
@rbtr
Copy link
Collaborator Author

rbtr commented Mar 28, 2024

Can you also use the kubectl-retina to start a capture job and make sure the agent image is correct?

@anubhabMajumdar I tagged v0.0.3 locally and created a capture. The version is correctly interpolated in for the Pod (but it obviously doesn't exist):

state:
 waiting:
   message: Back-off pulling image "ghcr.io/microsoft/retina/retina-agent:0.0.3"

@rbtr rbtr merged commit 635f4ef into microsoft:main Mar 28, 2024
15 checks passed
@rbtr rbtr deleted the fix/kubectl-retina-version branch March 28, 2024 20:32
hainenber pushed a commit to hainenber/retina that referenced this pull request Apr 4, 2024
# Description

The ldflag needs to be the full module-aware path to the variable
Version. This causes issues with kubectl-retina because that Version is
used to set image versions for the k8s objects created to take captures.

## Related Issue

If this pull request is related to any issue, please mention it here.
Additionally, make sure that the issue is assigned to you before
submitting this pull request.

## Checklist

- [ ] I have read the [contributing
documantation](https://retina.sh/docs/contributing).
- [ ] I signed and signed-off the commits (`git commit -S -s ...`)
- [ ] I have correctly attributed the author(s) of the code.
- [ ] I have tested the changes locally.
- [ ] I have followed the project's style guidelines.
- [ ] I have updated the documentation, if necessary.
- [ ] I have added tests, if applicable.

## Testing

```bash
$ goreleaser build --clean --snapshot --single-target
...
  • building binaries
    • partial build                                  match=target=linux_amd64
    • building                                       binary=dist/retina_linux_amd64_v1/kubectl-retina-linux-amd64
...
```

```bash
$ ./dist/retina_linux_amd64_v1/kubectl-retina-linux-amd64 version
0.0.2-SNAPSHOT-027d383
```

## Additional Notes

Add any additional notes or context about the pull request here.

---

Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more
information on how to contribute to this project.

Signed-off-by: Evan Baker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/go The Go Programming Language priority/0 P0 type/fix Fixes something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants