[buildbot] phase1: support creating tags on demand
LEDE Commits
lede-commits at lists.infradead.org
Mon Nov 28 11:26:01 PST 2016
jow pushed a commit to buildbot.git, branch master:
https://git.lede-project.org/4c5fdcbcca6065a2a7a986f8cb3d956165295309
commit 4c5fdcbcca6065a2a7a986f8cb3d956165295309
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Nov 28 19:36:18 2016 +0100
phase1: support creating tags on demand
If a build is forcibly invoked with a custom tag=x.y.z property, the builder
will prepare and push the appropriate Git repository tag.
Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
phase1/master.cfg | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/phase1/master.cfg b/phase1/master.cfg
index bbed054..f8b11df 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -174,6 +174,16 @@ def IsCleanRequested(pattern):
return CheckCleanProperty
+def IsTaggingRequested(step):
+ val = step.getProperty("tag")
+ if val and re.match("^[0-9]+\.[0-9]+\.[0-9]+$", val):
+ return True
+ else:
+ return False
+
+def IsNoTaggingRequested(step):
+ return not IsTaggingRequested(step)
+
c['builders'] = []
@@ -273,6 +283,26 @@ for target in targets:
doStepIf = IsCleanRequested(tuple[0])
))
+ factory.addStep(MasterShellCommand(
+ name = "maketag",
+ description = "Tagging Git repository",
+ command = [home_dir+'/maketag.sh', '-i', '-k', str(gpg_keyid or ''),
+ '-p', str(gpg_passfile or ''), '-v', WithProperties("%(tag:-)s")],
+ path = home_dir+'/source.git',
+ env = {'GNUPGHOME': gpg_home},
+ haltOnFailure = True,
+ doStepIf = IsTaggingRequested
+ ))
+
+ # switch to branch
+ factory.addStep(ShellCommand(
+ name = "switchbranch",
+ description = "Checking out Git branch",
+ command = ["git", "checkout", repo_branch],
+ haltOnFailure = True,
+ doStepIf = IsNoTaggingRequested
+ ))
+
# check out the source
factory.addStep(Git(
repourl = repo_url,
@@ -280,6 +310,24 @@ for target in targets:
mode = 'incremental',
method = 'clean'))
+ # fetch tags
+ factory.addStep(ShellCommand(
+ name = "fetchtag",
+ description = "Fetching Git tags",
+ command = ["git", "fetch", "--tags", "--", repo_url],
+ haltOnFailure = True,
+ doStepIf = IsTaggingRequested
+ ))
+
+ # switch to tag
+ factory.addStep(ShellCommand(
+ name = "switchtag",
+ description = "Checking out Git tag",
+ command = ["git", "checkout", WithProperties("tags/v%(tag:-)s")],
+ haltOnFailure = True,
+ doStepIf = IsTaggingRequested
+ ))
+
factory.addStep(ShellCommand(
name = "rmtmp",
description = "Remove tmp folder",
More information about the lede-commits
mailing list