-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy authentication files in
GitLocalPrMerge
Signed-off-by: magic_rb <[email protected]>
- Loading branch information
Showing
4 changed files
with
51 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
from buildbot.locks import MasterLock | ||
from buildbot.plugins import schedulers, steps, util, worker | ||
from buildbot.process import buildstep, logobserver, remotecommand | ||
|
||
from buildbot.process.build import Build | ||
from buildbot.process.project import Project | ||
from buildbot.process.properties import Properties | ||
from buildbot.process.results import ALL_RESULTS, SUCCESS, statusToString, worst_status | ||
|
@@ -986,6 +988,7 @@ async def run_vc( | |
pr_head = build_props.getProperty("github.head.sha") or build_props.getProperty( | ||
"head_sha" | ||
) | ||
auth_workdir = self._get_auth_data_workdir() | ||
|
||
# Not a PR, fallback to default behavior | ||
if merge_base is None or pr_head is None: | ||
|
@@ -1005,33 +1008,42 @@ async def run_vc( | |
self.build.path_module.join(self.workdir, ".git") | ||
) | ||
|
||
if not has_git: | ||
await self._dovccmd(["clone", "--recurse-submodules", self.repourl, "."]) | ||
try: | ||
await self._git_auth.download_auth_files_if_needed(auth_workdir) | ||
|
||
patched = await self.sourcedirIsPatched() | ||
if not has_git: | ||
await self._dovccmd( | ||
["clone", "--recurse-submodules", self.repourl, "."] | ||
) | ||
|
||
if patched: | ||
await self._dovccmd(["clean", "-f", "-f", "-d", "-x"]) | ||
patched = await self.sourcedirIsPatched() | ||
|
||
await self._dovccmd(["fetch", "-f", "-t", self.repourl, merge_base, pr_head]) | ||
if patched: | ||
await self._dovccmd(["clean", "-f", "-f", "-d", "-x"]) | ||
|
||
await self._dovccmd(["checkout", "--detach", "-f", pr_head]) | ||
await self._dovccmd( | ||
["fetch", "-f", "-t", self.repourl, merge_base, pr_head] | ||
) | ||
|
||
await self._dovccmd( | ||
[ | ||
"-c", | ||
"[email protected]", | ||
"-c", | ||
"user.name=buildbot", | ||
"merge", | ||
"--no-ff", | ||
"-m", | ||
f"Merge {merge_base} into {pr_head}", | ||
merge_base, | ||
] | ||
) | ||
self.updateSourceProperty("got_revision", pr_head) | ||
return await self.parseCommitDescription() | ||
await self._dovccmd(["checkout", "--detach", "-f", pr_head]) | ||
|
||
await self._dovccmd( | ||
[ | ||
"-c", | ||
"[email protected]", | ||
"-c", | ||
"user.name=buildbot", | ||
"merge", | ||
"--no-ff", | ||
"-m", | ||
f"Merge {merge_base} into {pr_head}", | ||
merge_base, | ||
] | ||
) | ||
self.updateSourceProperty("got_revision", pr_head) | ||
return await self.parseCommitDescription() | ||
finally: | ||
await self._git_auth.remove_auth_files_if_needed(auth_workdir) | ||
|
||
|
||
def nix_eval_config( | ||
|
@@ -1058,8 +1070,12 @@ def nix_eval_config( | |
submodules=True, | ||
haltOnFailure=True, | ||
logEnviron=False, | ||
sshPrivateKey=project.private_key_path.read_text() if project.private_key_path else None, | ||
sshKnownHosts=project.known_hosts_path.read_text() if project.known_hosts_path else None, | ||
sshPrivateKey=project.private_key_path.read_text() | ||
if project.private_key_path | ||
else None, | ||
sshKnownHosts=project.known_hosts_path.read_text() | ||
if project.known_hosts_path | ||
else None, | ||
), | ||
) | ||
drv_gcroots_dir = util.Interpolate( | ||
|
@@ -1367,6 +1383,8 @@ def nix_skipped_build_config( | |
collapseRequests=False, | ||
env={}, | ||
factory=factory, | ||
do_build_if=lambda build: do_register_gcroot_if(build, branch_config_dict) | ||
and outputs_path is not None, | ||
) | ||
|
||
|
||
|
@@ -1416,8 +1434,12 @@ def buildbot_effects_config( | |
method="clean", | ||
submodules=True, | ||
haltOnFailure=True, | ||
sshPrivateKey=project.private_key_path.read_text() if project.private_key_path else None, | ||
sshKnownHosts=project.known_hosts_path.read_text() if project.known_hosts_path else None, | ||
sshPrivateKey=project.private_key_path.read_text() | ||
if project.private_key_path | ||
else None, | ||
sshKnownHosts=project.known_hosts_path.read_text() | ||
if project.known_hosts_path | ||
else None, | ||
), | ||
) | ||
secrets_list = [] | ||
|
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
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