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

Add script to reproduce GitHub Actions runs locally #431

Closed
wants to merge 1 commit into from

Conversation

andreabedini
Copy link
Contributor

@andreabedini andreabedini commented Aug 7, 2023

This scripts should help troubleshooting CI failures when adding new packages.

Given a run id, the script does the following:

  1. It downloads the built-repo artifact from the CI
  2. It unpacks it in a temporary folder
  3. It obtains the commit hash that triggered the run
  4. It runs the same nix build; i.e.
nix build \
        "github:$REPO/${headSha}#allPackages" \
        --override-input CHaP "path:$ARTIFACT_TEMP_DIR/_repo" \
        --accept-flake-config true \
        --print-build-logs --show-trace

It is also possible to specify which derivation to build.

The scripts uses the GitHub CLI utility gh because one needs to authenticate to download artifacts. I added gh to the dev shell.

@andreabedini andreabedini self-assigned this Aug 7, 2023
@andreabedini andreabedini requested a review from a team as a code owner August 7, 2023 05:00
@michaelpj
Copy link
Contributor

I'm unsure if this is quite what we want? Maybe the default derivation should be allSmokeTestPackages? At the moment it will try to build everything, which isn't what you want. We'd need the reduced metadata file to get it to only build the new stuff, and I don't think that's in the repo artifact.

@andreabedini
Copy link
Contributor Author

@michaelpj you can specify a derivation attribute to build

usage() {
	echo "Usage: $0 [GHA RUN ID] [(DERIVATION=allPackages)]"
}

w.r.t. to allSmokeTestPackages vs allPackages the problem is that we don't know what failure the user is trying to troubleshoot (and perhaps they don't know either, the github action log is hard to read).

The metadata is also stored as an artifact and gets downloaded along with the built repo.

@michaelpj
Copy link
Contributor

w.r.t. to allSmokeTestPackages vs allPackages the problem is that we don't know what failure the user is trying to troubleshoot (and perhaps they don't know either, the github action log is hard to read).

Right, but if you blindly build allPackages then you'll a) spend a lot of time building irrelevant stuff, and b) get tons of failures since many of them don't build. Which also seems confusing!

The metadata is also stored as an artifact and gets downloaded along with the built repo.

Doesn't look like it gets moved into the repo folder which I think you need, though?

@andreabedini
Copy link
Contributor Author

Doesn't look like it gets moved into the repo folder which I think you need, though?

At the moment yeah, but it's there if we need to use it.

I don't know. I made this script as @disassembler requested but I am not sure it fits the use-case.

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.

2 participants