-
Notifications
You must be signed in to change notification settings - Fork 773
[tooling] Simplify avalanchego build script #3861
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
Conversation
"$AVALANCHE_PATH"/scripts/build_avalanche.sh $build_args | ||
|
||
# Exit build successfully if the AvalancheGo binary is created successfully | ||
if [[ -f "$avalanchego_path" ]]; then |
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.
This conditional block was not working as intended - the path could have been populated from a previous invocation, and set -e
ensures that an error would result in an exit before this conditional would be evaluated.
Previously the `scripts/build.sh` script delegated responsibility for actually building avalanchego to `scripts/build_avalanche.sh`. This change incorporates build_avalanchego.sh into build.sh to simplify maintenance.
a1c91ff
to
dc5f943
Compare
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.
Given that it's a no-op change, I shouldn't be critic here, so I'll approve it as is.
However, I'd like to provide few notes I've taken while reviewing this. There notes might be controversial, so please take these as a "open ended remarks":
- could we add the ability for the script to work from non-avalanche-path ? i.e. change directory to where we want to be, and then pop directory when we're done.
- When building the “*.go” isn’t needed, since a package is being built anyway.
- Why does the “go mod download” is even needed ? Wouldn’t the go build automatically do that ?
- When building, we’re writing out the go version with which we’ve built the binary. That’s perfectly fine. However, if it’s meaningful enough for us to print this out, shouldn’t we also embed that into the binary itself ( same as with the git commit hash ). I also think that we might want to embed the platform and build date & time into the binary ( for telemetry )
afaict this script can be invoked from any path. Is there an issue I'm missing with discovering the repo root from the script path? Note that task will enable building (via
Fair point, I'll fix.
For sure,
My intention in writing out the go version was mainly to give developers an indication of what version they are using since it is common to install different golang versions (i.e. to kick the tires on features of newer versions). It probably does make sense to embed the golang version used to compile for similar reasons. Edit: The go version is already included in the version string:
For our release binaries and images we can always find out when they were built and with what version since we only build in CI for release with the version in go.mod and CI provides traceability for when a job ran. So while potentially useful, I'm not sure there's a non-devel need for more traceability. As far as embedding the platform, do you mean the host or target arch/os? I'm not entirely sure of the value of providing the host details, and I'm even less sure of the value of the target given that it wouldn't be possible to run a binary on an os/arch that it wasn't built for. |
Why this should be merged
Previously the
scripts/build.sh
script delegated responsibility for actually building avalanchego toscripts/build_avalanche.sh
. This change incorporates build_avalanchego.sh into build.sh to simplify maintenance.How this was tested
CI
Need to be documented in RELEASES.md?
N/A