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

Reproducible Builds #157

Merged
merged 5 commits into from
Sep 30, 2021
Merged

Reproducible Builds #157

merged 5 commits into from
Sep 30, 2021

Conversation

tri-adam
Copy link
Member

@tri-adam tri-adam commented Sep 30, 2021

Refactor github.com/sylabs/sif/v2/internal/pkg/git to expose (*Description).CommitTime. Remove (*Description).Reference() and add (*Description).CommitHash() in its place.

Ensure builds are reproducible by:

  • Using (*Description).CommitTime as main.date for mage builds when the working directory is clean.
  • Disabling CGO in mage builds.
  • Use -trimpath in mage/goreleaser builds.

Harmonize linker flags used by mage/goreleaser by adding -s -w to mage build/install commands.

Use Date: rather than Built: in siftool version output to clarify semantics of this value (in clean builds, main.date is the commit date rather than the build date.

Closes #156

@tri-adam tri-adam self-assigned this Sep 30, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2021

Codecov Report

Merging #157 (d66d8b5) into master (8a9449e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #157   +/-   ##
=======================================
  Coverage   75.27%   75.27%           
=======================================
  Files          28       28           
  Lines        2419     2419           
=======================================
  Hits         1821     1821           
  Misses        459      459           
  Partials      139      139           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a9449e...d66d8b5. Read the comment docs.

Adam Hughes added 4 commits September 30, 2021 14:42
When working tree is clean, use commit time as date in version command
output.
Add '-s' and '-w' to linker flags set by mage build/install.
In clean builds, main.date is the commit date rather than the build
date. Display 'Date' rather than 'Built' heading for this field in human
readable output to make these semantics clearer.
@tri-adam tri-adam marked this pull request as ready for review September 30, 2021 14:55
Copy link
Member

@dtrudg dtrudg left a comment

Choose a reason for hiding this comment

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

Confirmed repeatable on my system. Since we are not static / CGO is in use, not repeatable across systems with different ld and basic libs.

@tri-adam
Copy link
Member Author

Confirmed repeatable on my system. Since we are not static / CGO is in use, not repeatable across systems with different ld and basic libs.

Good point. Since the goreleaser build is disabling CGO, I've gone ahead and done so for mage build and mage install.

@tri-adam tri-adam merged commit f9e58a4 into sylabs:master Sep 30, 2021
@tri-adam tri-adam deleted the reproducible-builds branch September 30, 2021 15:47
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.

Reproducible Builds
3 participants