nmattia / niv

Easy dependency management for Nix projects
https://github.com/nmattia/niv
MIT License
1.55k stars 77 forks source link

No longer works in Github CI #280

Closed anka-213 closed 3 years ago

anka-213 commented 3 years ago

Five days ago something changed. I'm not sure what: https://github.com/nix-dot-dev/getting-started-nix-template/actions?query=workflow%3A%22Update+niv%22

Now we're getting error messages like this:

  Package: gitignore.nix
  FATAL: Cannot get latest revision for branch 'master' (hercules-ci/gitignore.nix)
  The request failed: Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("server","GitHub.com"),("date","Fri, 11 Sep 2020 08:12:48 GMT"),("content-type","application/json; charset=utf-8"),("status","404 Not Found"),("x-github-media-type","github.v3; param=sha"),("access-control-expose-headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset"),("access-control-allow-origin","*"),("strict-transport-security","max-age=31536000; includeSubdomains; preload"),("x-frame-options","deny"),("x-content-type-options","nosniff"),("x-xss-protection","1; mode=block"),("referrer-policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("content-security-policy","default-src 'none'"),("vary","Accept-Encoding, Accept, X-Requested-With"),("content-encoding","gzip"),("X-Ratelimit-Limit","60"),("X-Ratelimit-Remaining","57"),("X-Ratelimit-Reset","1599815568"),("X-Ratelimit-Used","3"),("Content-Length","91"),("X-GitHub-Request-Id","07C0:4303:4B774F:83C930:5F5B3180")], responseBody = "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest\"}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
  NOTE: You may want to retry with an authentication token:

      GITHUB_TOKEN=... niv <cmd>

  For more information on rate-limiting, see

      https://developer.github.com/v3/#rate-limiting

  FATAL: One or more packages failed to update:

Adding a GITHUB_TOKEN doesn't help.

Do you have any idea what the problem is?

anka-213 commented 3 years ago

@domenkozar I opened an issue for it here instead of in your getting-started-nix-template repo, since I assumed it's an upstream issue. Is this correct?

domenkozar commented 3 years ago

I've been seeing this too, no idea yet what's going on.

nmattia commented 3 years ago

I think GitHub might have started using GITHUB_PATH, which is read by niv (and prepended to the HTTP path used when making API calls). Will need to investigate.

dhess commented 3 years ago

Same here.

nmattia commented 3 years ago

Can somebody try echoing or unseting GITHUB_PATH? I don't have a GitHub action workflow handy

domenkozar commented 3 years ago

Can confirm unsetting GITHUB_PATH makes it work again.

domenkozar commented 3 years ago

https://github.com/nix-dot-dev/getting-started-nix-template/pull/16

nmattia commented 3 years ago

Great, I'll work on the workaround.

dhess commented 3 years ago

@domenkozar It's a bit off-topic, but how do you test GitHub Actions? I don't know of a way to run them manually unless they've failed, and when you re-run those, it appears to use the same revision of the action that failed the first time, not any newer revision.

nmattia commented 3 years ago

@domenkozar mind having a quick look here, see if that makes sense? https://github.com/nmattia/niv/pull/281

nmattia commented 3 years ago

I've just release v0.2.18, feel free to re-open if the workaround is not applicable or if the problem persist!

anka-213 commented 3 years ago

@dhess The solution I used was to add "on: push" to the yaml file, so it runs every time you push new changes.

dhess commented 3 years ago

@anka-213 Ahh, that's clever, thanks!

anka-213 commented 3 years ago

Hmm, I've not gotten it to work yet. Neither unsetting GITHUB_TOKEN nor upgrading to latest version of niv helped for me. https://github.com/anka-213/cclaw-nix-stuff/actions?query=workflow%3A%22Update+niv%22

and I don't see any succeeding tests here either: https://github.com/nix-dot-dev/getting-started-nix-template/actions?query=workflow%3A%22Update+niv%22

dhess commented 3 years ago

Same, my GitHub Actions using niv are still failing after upgrading to this version of niv.

nmattia commented 3 years ago

Neither unsetting GITHUB_TOKEN

I think you mean GITHUB_PATH?

nor upgrading to latest version of niv helped for me.

How exactly are you pinning the version? Have you tried building from master (using the cache) like niv-updater-action? That one (niv-updater-action) is now running smoothly again.

EDIT: the tests here appear to be working; note the GITHUB_PATH=

dhess commented 3 years ago

Oh, do we still need to unset GITHUB_PATH to make this work with GitHub Actions?

nmattia commented 3 years ago

No, it should work out of the box with niv 0.2.18. Are you sure you're using that version?

dhess commented 3 years ago

I pinned the latest version in my sources.json, but didn't make it available in the shell in which the GitHub Action was running. Sorry, user error! Should be fixed now.

anka-213 commented 3 years ago

Neither unsetting GITHUB_TOKEN

I think you mean GITHUB_PATH?

Ah, right. That was the problem. I didn't notice the difference!

How exactly are you pinning the version?

Apparently in the wrong way. It was using the version from nixpkgs.

Thanks!