summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2020-05-13 10:48:21 -0400
committerChris Evich <cevich@redhat.com>2020-05-14 15:00:34 -0400
commit8d54e4855c386e6805c8e84dc36330006e2d4787 (patch)
tree29462e59a3806394a282ca2ba5ae2a1ad5119787
parent6479b54f4101917bcb2a66d66ddac3103e0f0107 (diff)
downloadpodman-8d54e4855c386e6805c8e84dc36330006e2d4787.tar.gz
podman-8d54e4855c386e6805c8e84dc36330006e2d4787.tar.bz2
podman-8d54e4855c386e6805c8e84dc36330006e2d4787.zip
Cirrus: Fix image-name hints
This properly prints out image-name hints when executing the hack script without any arguments. It is required due to changes made by Ed for test-name beatification. An identical change was made and reviewed by Ed in the containers/storage repo. Signed-off-by: Chris Evich <cevich@redhat.com>
-rw-r--r--Dockerfile.ubuntu2
-rw-r--r--contrib/cirrus/lib.sh5
-rw-r--r--contrib/cirrus/packer/ubuntu_packaging.sh12
-rwxr-xr-xhack/get_ci_vm.sh34
4 files changed, 35 insertions, 18 deletions
diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
index 3a8f837b9..160c1469c 100644
--- a/Dockerfile.ubuntu
+++ b/Dockerfile.ubuntu
@@ -1,5 +1,5 @@
# Must resemble $UBUNTU_BASE_IMAGE in ./contrib/cirrus/lib.sh
-FROM ubuntu:latest
+FROM ubuntu:20.04
# This container image is intended for building and testing libpod
# from inside a container environment. It is assumed that the source
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index f1e542e74..cc5a3ffa7 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -63,8 +63,9 @@ CIRRUS_BUILD_ID=${CIRRUS_BUILD_ID:-$RANDOM$(date +%s)} # must be short and uniq
PACKER_VER="1.4.2"
# CSV of cache-image names to build (see $PACKER_BASE/libpod_images.json)
-# Base-images rarely change, define them here so they're out of the way.
-export PACKER_BUILDS="${PACKER_BUILDS:-ubuntu-18,ubuntu-19,fedora-32,fedora-31}"
+# List of cache imaes to build for 'CI:IMG' mode via build_vm_images.sh
+# Exists to support manual single-image building in case of emergency
+export PACKER_BUILDS="${PACKER_BUILDS:-ubuntu-20,ubuntu-19,fedora-32,fedora-31}"
# Google cloud provides these, we just make copies (see $SCRIPT_BASE/README.md) for use
export UBUNTU_BASE_IMAGE="ubuntu-2004-focal-v20200506"
export PRIOR_UBUNTU_BASE_IMAGE="ubuntu-1910-eoan-v20200211"
diff --git a/contrib/cirrus/packer/ubuntu_packaging.sh b/contrib/cirrus/packer/ubuntu_packaging.sh
index d9d212494..fd0280230 100644
--- a/contrib/cirrus/packer/ubuntu_packaging.sh
+++ b/contrib/cirrus/packer/ubuntu_packaging.sh
@@ -98,8 +98,6 @@ INSTALL_PACKAGES=(\
podman
protobuf-c-compiler
protobuf-compiler
- python-future
- python-minimal
python-protobuf
python3-dateutil
python3-pip
@@ -117,11 +115,19 @@ INSTALL_PACKAGES=(\
vim
wget
xz-utils
- yum-utils
zip
zlib1g-dev
)
+# These aren't resolvable on Ubuntu 20
+if [[ "$OS_RELEASE_VER" -le 19 ]]; then
+ INSTALL_PACKAGES+=(\
+ python-future
+ python-minimal
+ yum-utils
+ )
+fi
+
# Do this at the last possible moment to avoid dpkg lock conflicts
echo "Upgrading all packages"
$BIGTO ooe.sh $SUDOAPTGET upgrade
diff --git a/hack/get_ci_vm.sh b/hack/get_ci_vm.sh
index 7e31c19c6..1d48f0996 100755
--- a/hack/get_ci_vm.sh
+++ b/hack/get_ci_vm.sh
@@ -67,13 +67,6 @@ delvm() {
cleanup
}
-image_hints() {
- _BIS=$(egrep -m 1 '_BUILT_IMAGE_SUFFIX:[[:space:]+"[[:print:]]+"' "$LIBPODROOT/.cirrus.yml" | cut -d: -f 2 | tr -d '"[:blank:]')
- egrep '[[:space:]]+[[:alnum:]].+_CACHE_IMAGE_NAME:[[:space:]+"[[:print:]]+"' \
- "$LIBPODROOT/.cirrus.yml" | cut -d: -f 2 | tr -d '"[:blank:]' | \
- sed -r -e "s/\\\$[{]_BUILT_IMAGE_SUFFIX[}]/$_BIS/" | sort -u
-}
-
show_usage() {
echo -e "\n${RED}ERROR: $1${NOR}"
echo -e "${YEL}Usage: $(basename $0) [-m <SPECIALMODE>] [-u <ROOTLESS_USER> ] <image_name>${NOR}"
@@ -90,17 +83,34 @@ show_usage() {
}
get_env_vars() {
- python -c '
-import yaml
+ # Deal with both YAML and embedded shell-like substitutions in values
+ # if substitution fails, fall back to printing naked env. var as-is.
+ python3 -c '
+import yaml,re
env=yaml.load(open(".cirrus.yml"), Loader=yaml.SafeLoader)["env"]
-keys=[k for k in env if "ENCRYPTED" not in str(env[k])]
+dollar_env_var=re.compile(r"\$(\w+)")
+dollarcurly_env_var=re.compile(r"\$\{(\w+)\}")
+class ReIterKey(dict):
+ def __missing__(self, key):
+ # Cirrus-CI provides some runtime-only env. vars. Avoid
+ # breaking this hack-script if/when any are present in YAML
+ return "${0}".format(key)
+rep=r"{\1}" # Convert env vars markup to -> str.format_map(re_iter_key) markup
+out=ReIterKey()
for k,v in env.items():
v=str(v)
- if "ENCRYPTED" not in v and "ADD_SECOND_PARTITION" not in v:
- print("{0}=\"{1}\"".format(k, v)),
+ if "ENCRYPTED" not in v:
+ out[k]=dollar_env_var.sub(rep, dollarcurly_env_var.sub(rep, v))
+for k,v in out.items():
+ print("{0}=\"{1}\"".format(k, v.format_map(out)))
'
}
+image_hints() {
+ get_env_vars | fgrep '_CACHE_IMAGE_NAME' | awk -F "=" '{print $2}'
+}
+
+
parse_args(){
echo -e "$USAGE_WARNING"