From: Jo-Philipp Wich Date: Mon, 24 Jun 2019 04:12:12 +0000 (+0200) Subject: phase1: add ability to clone feeds via SSH X-Git-Tag: v1~109 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=37dba2d714ad0edd41c582e4b4278c700065a1c4;p=buildbot.git phase1: add ability to clone feeds via SSH Signed-off-by: Jo-Philipp Wich --- diff --git a/phase1/config.ini.example b/phase1/config.ini.example index 47e454d..f1b677c 100644 --- a/phase1/config.ini.example +++ b/phase1/config.ini.example @@ -6,6 +6,7 @@ homedir = . expire = 1209600 port = 9989 cc_version = le 4.9 +git_ssh = true [status] bind = tcp:8010:interface=127.0.0.1 diff --git a/phase1/master.cfg b/phase1/master.cfg index d94b888..51c0262 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -101,6 +101,8 @@ cc_version = None cc_command = "gcc" cxx_command = "g++" +git_ssh = False + if ini.has_option("general", "expire"): tree_expire = ini.getint("general", "expire") @@ -112,6 +114,9 @@ if ini.has_option("general", "cc_version"): if len(cc_version) == 1: cc_version = ["eq", cc_version[0]] +if ini.has_option("general", "git_ssh"): + git_ssh = ini.getboolean("general", "git_ssh") + repo_url = ini.get("repo", "url") repo_branch = "master" @@ -605,15 +610,40 @@ for target in targets: mode = 0755, )) + # Git SSH + if git_ssh: + factory.addStep(FileDownload( + name = "dlgitclonekey", + mastersrc = "git-clone.key", + slavedest = "../git-clone.key", + mode = 0600, + )) + + factory.addStep(ShellCommand( + name = "patchfeedsconf", + description = "Patching feeds.conf", + command="sed -e 's#https://#ssh://git@#g' feeds.conf.default > feeds.conf", + haltOnFailure = True + )) + # feed factory.addStep(ShellCommand( name = "updatefeeds", description = "Updating feeds", command=["./scripts/feeds", "update"], - env = MakeEnv(tryccache=True), + env = MakeEnv(tryccache=True, overrides={'GIT_SSH_COMMAND': Interpolate("ssh -o IdentitiesOnly=yes -o IdentityFile=%(kw:cwd)s/git-clone.key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no", cwd=GetCwd)} if git_ssh else {}), haltOnFailure = True )) + # Git SSH + if git_ssh: + factory.addStep(ShellCommand( + name = "rmfeedsconf", + description = "Removing feeds.conf", + command=["rm", "feeds.conf"], + haltOnFailure = True + )) + # feed factory.addStep(ShellCommand( name = "installfeeds",