Merge ~cjwatson/turnip/+git/turnipcake:publish-swift-build-label into ~canonical-launchpad-branches/turnip/+git/turnipcake:master

Proposed by Colin Watson on 2020-07-21
Status: Merged
Approved by: Colin Watson on 2020-07-23
Approved revision: 27132bb9003ce04dfb4dd4cfc44834dc3637522f
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/turnip/+git/turnipcake:publish-swift-build-label
Merge into: ~canonical-launchpad-branches/turnip/+git/turnipcake:master
Diff against target: 47 lines (+11/-1)
2 files modified
Makefile (+1/-1)
publish-to-swift (+10/-0)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena 2020-07-21 Approve on 2020-07-23
Review via email: mp+387763@code.launchpad.net

Commit message

Publish last-successful-build-label.txt to Swift

Description of the change

This makes it easier for the Mojo spec to find the most recently-built revision, since it can't necessarily enumerate files in the Swift container.

Same as https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/387744, but for turnipcake.

To post a comment you must log in.
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index ce0d72f..6c87e2a 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -114,6 +114,6 @@ publish-tarball: build-tarball
6 [ ! -e ~/.config/swift/turnip ] || . ~/.config/swift/turnip; \
7 ./publish-to-swift --debug \
8 $(SWIFT_CONTAINER_NAME) $(SWIFT_OBJECT_PATH) \
9- $(TARBALL_BUILD_PATH)
10+ $(TARBALL_BUILD_PATH) turnipcake=$(TARBALL_BUILD_LABEL)
11
12 .PHONY: build check clean dist lint run migrate build-tarball publish-tarball
13diff --git a/publish-to-swift b/publish-to-swift
14index e5cfd59..5a86fe7 100755
15--- a/publish-to-swift
16+++ b/publish-to-swift
17@@ -7,6 +7,7 @@ import os
18 import re
19 import subprocess
20 import sys
21+import tempfile
22
23
24 def ensure_container_privs(container_name):
25@@ -75,6 +76,7 @@ def main():
26 parser.add_argument("container_name")
27 parser.add_argument("swift_object_path")
28 parser.add_argument("local_path")
29+ parser.add_argument("build_label")
30 args = parser.parse_args()
31
32 if args.debug:
33@@ -118,6 +120,14 @@ def main():
34 args.container_name, args.swift_object_path, args.local_path,
35 overwrite=overwrite)
36
37+ with tempfile.TemporaryDirectory() as tmpdir:
38+ filename = "last-successful-build-label.txt"
39+ with open(os.path.join(tmpdir, filename), "w") as f:
40+ f.write(args.build_label)
41+ publish_file_to_swift(
42+ args.container_name, filename, os.path.join(tmpdir, filename),
43+ overwrite=True)
44+
45
46 if __name__ == "__main__":
47 main()

Subscribers

People subscribed via source and target branches