-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
hcp: init at 0.8.0 #370162
hcp: init at 0.8.0 #370162
Conversation
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.
Looks pretty good to me.
preCheck = '' | ||
export HOME=$TMPDIR | ||
''; | ||
|
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.
Try to add a versionCheckHook for basic binary testing
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 added the version check but I'm getting the below error. hcp version
outputs hcp v0.8.0 go1.23.4 amd64
. Is the "v" prefix the issue? Tried adding glibc
to nativeInstallCheckInputs
but that did not work.
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
versionCheckProgramArg = [ "version" ];
error: builder for '/nix/store/mkvvqzqmcn9xspbl4g5q1absgwnc0ikl-hcp-0.8.0.drv' failed with exit code 2;
last 25 log lines:
> ok github.com/hashicorp/hcp/internal/pkg/auth 0.002s [no tests to run]
> ok github.com/hashicorp/hcp/internal/pkg/cmd 0.005s
> ok github.com/hashicorp/hcp/internal/pkg/flagvalue 0.002s
> ok github.com/hashicorp/hcp/internal/pkg/format 0.002s
> ok github.com/hashicorp/hcp/internal/pkg/heredoc 0.003s
> ok github.com/hashicorp/hcp/internal/pkg/iostreams 0.001s
> ok github.com/hashicorp/hcp/internal/pkg/profile 0.004s
> ok github.com/hashicorp/hcp/internal/pkg/table 0.002s
> ok github.com/hashicorp/hcp/internal/pkg/testing/promptio 0.001s [no tests to run]
> ok github.com/hashicorp/hcp/internal/pkg/versioncheck 0.004s
> ok github.com/hashicorp/hcp/internal/pkg/waypoint/agent 0.005s
> Running phase: installPhase
> Running phase: fixupPhase
> shrinking RPATHs of ELF executables and libraries in /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0
> shrinking /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0/bin/hcp
> shrinking /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0/bin/gendocs
> shrinking /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0/bin/mvdocs
> checking for references to /build/ in /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0...
> patching script interpreter paths in /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0
> stripping (with command strip and flags -S -p) in /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0/bin
> Running phase: installCheckPhase
> Executing versionCheckPhase
> Did not find version 0.8.0 in the output of the command /nix/store/bfsl51gs7ml2fkry757n19hxgi3d2rky-hcp-0.8.0/bin/hcp version
> failed to configure version checker: failed expanding HCP config directory path "~/.config/hcp/version_check_state.json": exec: "getent": executable file not found in $PATH
> failed to instantiate HCP config: failed to resolve hcp's credential path: failed to resolve hcp's credential directory path: exec: "getent": executable file not found in $PATH
For full logs, run 'nix log /nix/store/mkvvqzqmcn9xspbl4g5q1absgwnc0ikl-hcp-0.8.0.drv'.
Checking $out/bin/hcp version
in postInstall
. It looks like it tries to check for newer versions.
> failed to check for new version: failed to list recent releases: Get "https://api.releases.hashicorp.com/v1/releases/hcp": dial tcp: lookup api.rele
ases.hashicorp.com on [::1]:53: read udp [::1]:40251->[::1]:53: read: connection refused
> hcp v0.8.0 go1.23.4 amd64
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.
Just patch it out
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.
The v doesn't change anything. It looks if the version is a substring in the output.
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.
Just patch it out
Could you please link some documentation or examples? Still new to Nix
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.
Basically you can either replace stuff with substituteInPlace
on postPatch or make a patch file and add to the patches list. It will be applied automatically. There are plenty of examples in nixpkgs.
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, I gave it a close look but that version checker is embedded in a lot of the code and I couldn't find a good way to patch it out. Happy to take any more suggestions, moving on from this otherwise
|
|
|
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.
|
pkgs/by-name/hc/hcp/package.nix
Outdated
repo = pname; | ||
rev = "v${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.
repo = pname; | |
rev = "v${version}"; | |
repo = "hcp"; | |
tag = "v${version}"; |
Avoid using pname here: #277994
tag
is the new recommended argument. rev
should only be used for specific commits.
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.
repo = pname;
did feel a bit awkward to me but it was suggested by another reviewer. Thanks for clearing it up with the linked issue.
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.
Yeah their two suggestions were exactly against current recommendations.
pkgs/by-name/hc/hcp/package.nix
Outdated
export HOME=$TMPDIR | ||
''; | ||
|
||
passthru.updateScript = gitUpdater { rev-prefix = "v"; }; |
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'm not sure, but I think the gitUpdater does not update the vendorHash.
Probably the nix-update-script could be used, I think it has a different parameter for version prefixes.
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.
Agreed, I think nix-update-script
is a better fit here after reading through the documentation.
pkgs/by-name/hc/hcp/package.nix
Outdated
meta = { | ||
description = "HCP Command-Line Interface"; | ||
homepage = "https://github.com/hashicorp/hcp"; | ||
changelog = "https://github.com/hashicorp/hcp/raw/v${version}/CHANGELOG.md"; |
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 is also https://github.com/hashicorp/hcp/releases/tag/v${version}
which is more common in nixpkgs.
One shows all changes, the other only changes in that version. Either is fine I 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.
Switched to https://github.com/hashicorp/hcp/releases/tag/v${version}
. Seems more concise anyway.
Adding HCP CLI, an official project from HashiCorp for interacting with HashiCorp Cloud Platform (HCP).
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.