Reproducible generation script#136
Open
josedahlquist wants to merge 4 commits into
Open
Conversation
This commits proposes a script to automatically create reproducible builds for rskj and/or powpeg-node using existing tags. This is done through a single js script that allows to create the repro and allows others to validate them as well. The script interacts with Github and Docker.
No real logic change
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a zero-dependency (Node-only) toolchain under scripts/ to (1) scaffold and build new reproducible-build folders from existing templates and (2) validate reproducible-build PRs by re-building and comparing declared vs reproduced artifact hashes.
Changes:
- Added
scripts/generate-build.js: a CLI to generate reproducible-build folders from the newest existing template, compute hashes via Docker, commit/push a branch, and open a PR; also includes avalidatemode to rebuild a PR and comment hash verification results. - Added
scripts/lib.js: pure logic for tag parsing, component conventions, version substitution, sha-block parsing/injection, and PR URL/build-folder detection. - Added
scripts/lib.test.jsandscripts/README.md: unit tests for the pure logic plus documentation for usage and safety behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| scripts/README.md | Documents the new generator/validator workflow, requirements, and usage. |
| scripts/lib.test.js | Adds Node test-runner unit tests covering the pure helper logic. |
| scripts/lib.js | Implements deterministic parsing/substitution/hash-block utilities used by the CLI. |
| scripts/generate-build.js | Implements the main generation + validation flows (git/Docker/GitHub interactions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+85
to
+90
| const die = (msg, code = 2) => { | ||
| console.error(c.red('error: ') + msg); | ||
| process.exit(code); | ||
| }; | ||
| const step = (msg) => console.log(c.cyan('• ') + c.bold(msg)); | ||
|
|
Comment on lines
+396
to
+399
| // Create the branch BEFORE writing any files into the repo, so a clean tree | ||
| // is checked out and there are no untracked files to collide with. | ||
| step(`Creating branch ${branch} off ${remote}/${base}`); | ||
| git(['checkout', '-B', branch, `${remote}/${base}`], repoDir); |
Comment on lines
+27
to
+30
| 2. **Verifies the git tag exists** in the source repo (fail fast before the long build). The | ||
| tag — not a GitHub release — is the reference, because the release is published *after* the | ||
| reproducible build is accepted. Source integrity is then enforced inside the build itself | ||
| (the Dockerfile GPG-verifies `SHA256SUMS` for the checked-out source). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes are proposing a script to automatically create reproducible builds for rskj and/or powpeg-node using existing tags. This is done through a set of js scripts that allow to create the repro and allows others to validate them as well.
The script interacts with Github and Docker.