From dd46fb3d3218ba01bb6f49bd7af051857af340fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 25 Apr 2021 15:11:20 +0200 Subject: [PATCH 1/2] MAPG-228 check if the Release* tag is signed and verified --- scripts/deploy-to-multiple-worktrees.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/deploy-to-multiple-worktrees.py b/scripts/deploy-to-multiple-worktrees.py index 7d24ec9..813fb56 100755 --- a/scripts/deploy-to-multiple-worktrees.py +++ b/scripts/deploy-to-multiple-worktrees.py @@ -59,7 +59,22 @@ def getRevisionForRef(ref): return subprocess.check_output(["git", "rev-list", "-1", ref], cwd=REPO).decode().strip() def getLatestReleaseTag(): - return subprocess.check_output(["git", "for-each-ref", "refs/tags/Release*", "--count=1", "--sort=-creatordate", "--format=%(refname:short)"], cwd=REPO).decode().strip() + process = subprocess.Popen(["git", "for-each-ref", "refs/tags/Release*", "--sort=-creatordate", "--format=%(refname:short)"], stdout=subprocess.PIPE, cwd=REPO) + + for line in process.stdout: + tag = line.decode().rstrip() + + if isTagVerified(tag): + return tag + + print(f"[WARNING] Tag '{tag}' is not verified, skipping.") + + raise Exception("No verified 'Release*' tag found!") + +def isTagVerified(tag): + process = subprocess.run(["git", "tag", "--verify", tag], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=REPO) + + return process.returncode == 0 def updateRepoFromRemote(): subprocess.call(["git", "fetch", "origin", "--prune"], cwd=REPO) -- 2.45.2 From 9d1fc8b60c595d7e8be77d5e16171e4635bc7434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 25 Apr 2021 15:11:49 +0200 Subject: [PATCH 2/2] MAPG-228 prune local tags when fetching --- scripts/deploy-to-multiple-worktrees.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy-to-multiple-worktrees.py b/scripts/deploy-to-multiple-worktrees.py index 813fb56..2ef97f6 100755 --- a/scripts/deploy-to-multiple-worktrees.py +++ b/scripts/deploy-to-multiple-worktrees.py @@ -77,7 +77,7 @@ def isTagVerified(tag): return process.returncode == 0 def updateRepoFromRemote(): - subprocess.call(["git", "fetch", "origin", "--prune"], cwd=REPO) + subprocess.call(["git", "fetch", "origin", "--prune", "--prune-tags"], cwd=REPO) def checkoutWorktree(worktreePath, ref): subprocess.call(["git", "checkout", "-f", ref], cwd=worktreePath) -- 2.45.2