Merge ~cjwatson/launchpad:version-info-outside-git into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: e13a5160434255d831c7ed8697c6d5fe72101126
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:version-info-outside-git
Merge into: launchpad:master
Diff against target: 38 lines (+7/-1)
3 files modified
.gitignore (+1/-0)
Makefile (+1/-1)
scripts/update-version-info.sh (+5/-0)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+412679@code.launchpad.net

Commit message

Cope with running outside a git tree

Description of the change

It would be useful to be able to produce Launchpad deployment artifacts that have their version information pregenerated and don't require a git working tree. This only requires a small number of tweaks: the main one is that we need to ensure that `talisker.config` has a usable strategy for discovering the current revision, which is just a matter of writing a `version-info.txt` file to go alongside `version-info.py`.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

#TIL: we use talisker

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 3b2e7d2..fe700ef 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -1,6 +1,7 @@
6 *.pyc
7 .tags
8 version-info.py
9+version-info.txt
10 logs/*
11 +*
12 /botmaster
13diff --git a/Makefile b/Makefile
14index 90a640e..8b00a2e 100644
15--- a/Makefile
16+++ b/Makefile
17@@ -314,7 +314,7 @@ compile: $(VENV_PYTHON)
18 $(PYTHON) utilities/link-system-packages.py \
19 "$(SITE_PACKAGES)" system-packages.txt
20 ${SHHH} bin/build-twisted-plugin-cache
21- scripts/update-version-info.sh
22+ [ ! -d .git ] || scripts/update-version-info.sh
23
24 .PHONY: test_build
25 test_build: build
26diff --git a/scripts/update-version-info.sh b/scripts/update-version-info.sh
27index f76b927..46c5d7c 100755
28--- a/scripts/update-version-info.sh
29+++ b/scripts/update-version-info.sh
30@@ -47,3 +47,8 @@ else
31 mv ${newfile} version-info.py
32 fi
33 fi
34+
35+# talisker.config uses version-info.txt instead, so update that too. We
36+# don't need to be particularly careful about file modification times here,
37+# since there are no Makefile dependencies on this.
38+echo "$revision_id" >version-info.txt

Subscribers

People subscribed via source and target branches

to status/vote changes: