-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9806 from hercules-ci/fix-git-auth
Fix git auth
- Loading branch information
Showing
3 changed files
with
83 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ config, ... }: | ||
{ | ||
description = "can fetch a private git repo via http"; | ||
repo.private = true; | ||
script = '' | ||
# add a file to the repo | ||
client.succeed(f""" | ||
echo ${config.name /* to make the git tree and store path unique */} > {repo.path}/test-case \ | ||
&& echo lutyabrook > {repo.path}/new-york-state \ | ||
&& {repo.git} add test-case new-york-state \ | ||
&& {repo.git} commit -m 'commit1' | ||
""") | ||
# memoize the revision | ||
rev1 = client.succeed(f""" | ||
{repo.git} rev-parse HEAD | ||
""").strip() | ||
# push to the server | ||
client.succeed(f""" | ||
{repo.git} push origin main | ||
""") | ||
# fetch the repo via nix | ||
fetched1 = client.succeed(f""" | ||
nix eval --impure --raw --expr "(builtins.fetchGit {repo.remote}).outPath" | ||
""") | ||
# check if the committed file is there | ||
client.succeed(f""" | ||
test -f {fetched1}/new-york-state | ||
""") | ||
# check if the revision is the same | ||
rev1_fetched = client.succeed(f""" | ||
nix eval --impure --raw --expr "(builtins.fetchGit {repo.remote}).rev" | ||
""").strip() | ||
assert rev1 == rev1_fetched, f"rev1: {rev1} != rev1_fetched: {rev1_fetched}" | ||
''; | ||
} |
This file contains 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