Skip to content

Commit ebf0262

Browse files
committed
cmd-build-with-buildah: rework version handling
I think it's still useful to have a `dev` marker in the version string for development builds. The versionary script recently learned a new `--dev` switch which will spit out a development version string. Let's tweak the logic so that: - by default, if `--versionary` is not passed, we call `versionary --dev` to get a development version string - if `--versionary` is passed, we _don't_ pass `--dev` to get a production version string - if `--version` is passed, it always wins This is a bit confusing of course. E.g. ideally the `--versionary` switch would be called `--prod-versionary` or something. But the intent is to replicate the UX that exists today with `cosa build` so that this becomes a drop-in replacement for it in the pipeline. Once we cut over and don't need to support both, we could tweak things.
1 parent 2cc6644 commit ebf0262

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/cmd-build-with-buildah

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ Usage: coreos-assembler build-with-buildah
1515
1616
The following options are supported:
1717
--version=VERSION Use the given version instead of using versionary.
18+
--versionary Generate non-development version using versionary.
1819
--direct Run buildah directly rather than within supermin.
1920
EOF
2021
}
2122

2223
VERSION=
24+
VERSIONARY=
2325
DIRECT=
2426
rc=0
25-
options=$(getopt --options h,v,d --longoptions help,version:,direct -- "$@") || rc=$?
27+
options=$(getopt --options h,d --longoptions help,version:,versionary,direct -- "$@") || rc=$?
2628
[ $rc -eq 0 ] || {
2729
print_help
2830
exit 1
@@ -34,10 +36,13 @@ while true; do
3436
print_help
3537
exit 0
3638
;;
37-
-v | --version)
39+
--version)
3840
shift
3941
VERSION=$1
4042
;;
43+
--versionary)
44+
VERSIONARY=1
45+
;;
4146
-d | --direct)
4247
DIRECT=1
4348
;;
@@ -57,7 +62,11 @@ done
5762

5863
if [ -z "${VERSION}" ]; then
5964
# let error out if file does not exist
60-
VERSION=$(src/config/versionary)
65+
if [ -z "${VERSIONARY}" ]; then
66+
VERSION=$(src/config/versionary --dev)
67+
else
68+
VERSION=$(src/config/versionary)
69+
fi
6170
fi
6271

6372
build_with_buildah() {
@@ -112,4 +121,4 @@ build_with_buildah() {
112121
rm -rf "${tempdir}"
113122
}
114123

115-
build_with_buildah
124+
build_with_buildah

0 commit comments

Comments
 (0)