diff options
-rw-r--r-- | .cirrus.yml | 2 | ||||
-rw-r--r-- | contrib/cirrus/packer/fedora_packaging.sh | 22 | ||||
-rw-r--r-- | contrib/cirrus/packer/ubuntu_packaging.sh | 28 | ||||
-rwxr-xr-x | contrib/cirrus/setup_environment.sh | 10 | ||||
-rw-r--r-- | pkg/domain/infra/abi/generate.go | 5 | ||||
-rw-r--r-- | test/e2e/generate_systemd_test.go | 12 |
6 files changed, 50 insertions, 29 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 22f84d7ec..cd122d39f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -39,7 +39,7 @@ env: UBUNTU_NAME: "ubuntu-20" PRIOR_UBUNTU_NAME: "ubuntu-19" - _BUILT_IMAGE_SUFFIX: "podman-6439450735542272" + _BUILT_IMAGE_SUFFIX: "podman-6530021898584064" FEDORA_CACHE_IMAGE_NAME: "${FEDORA_NAME}-${_BUILT_IMAGE_SUFFIX}" PRIOR_FEDORA_CACHE_IMAGE_NAME: "${PRIOR_FEDORA_NAME}-${_BUILT_IMAGE_SUFFIX}" UBUNTU_CACHE_IMAGE_NAME: "${UBUNTU_NAME}-${_BUILT_IMAGE_SUFFIX}" diff --git a/contrib/cirrus/packer/fedora_packaging.sh b/contrib/cirrus/packer/fedora_packaging.sh index f19932a9f..4a8f62e45 100644 --- a/contrib/cirrus/packer/fedora_packaging.sh +++ b/contrib/cirrus/packer/fedora_packaging.sh @@ -26,7 +26,7 @@ source /usr/share/automation/environment # Set this to 1 to NOT enable updates-testing repository DISABLE_UPDATES_TESTING=${DISABLE_UPDATES_TESTING:0} -# Do not enable update-stesting on the previous Fedora release +# Do not enable updates-testing on the previous Fedora release if ((DISABLE_UPDATES_TESTING!=0)); then warn "Enabling updates-testing repository for image based on $FEDORA_BASE_IMAGE" $LILTO $SUDO ooe.sh dnf install -y 'dnf-command(config-manager)' @@ -37,7 +37,15 @@ fi $BIGTO ooe.sh $SUDO dnf update -y +# Fedora, as of 31, uses cgroups v2 by default. runc does not support +# cgroups v2, only crun does. (As of 2020-07-30 runc support is +# forthcoming but not even close to ready yet). To ensure a reliable +# runtime environment, force-remove runc if it is present. +# However, because a few other repos. which use these images still need +# it, ensure the runc package is cached in $PACKAGE_DOWNLOAD_DIR so +# it may be swap it in when required. REMOVE_PACKAGES=(runc) + INSTALL_PACKAGES=(\ autoconf automake @@ -118,11 +126,12 @@ INSTALL_PACKAGES=(\ python2 python3-PyYAML python3-dateutil - python3-psutil - python3-pytoml - python3-libsemanage python3-libselinux + python3-libsemanage python3-libvirt + python3-psutil + python3-pytoml + python3-requests redhat-rpm-config rpcbind rsync @@ -163,7 +172,7 @@ $BIGTO ooe.sh $SUDO dnf install -y ${INSTALL_PACKAGES[@]} # $BIGTO ooe.sh $SUDO dnf --enablerepo=updates-testing -y upgrade crun [[ ${#REMOVE_PACKAGES[@]} -eq 0 ]] || \ - $LILTO ooe.sh $SUDO dnf erase -y ${REMOVE_PACKAGES[@]} + $LILTO ooe.sh $SUDO dnf erase -y "${REMOVE_PACKAGES[@]}" if [[ ${#DOWNLOAD_PACKAGES[@]} -gt 0 ]]; then echo "Downloading packages for optional installation at runtime, as needed." @@ -171,8 +180,7 @@ if [[ ${#DOWNLOAD_PACKAGES[@]} -gt 0 ]]; then ooe.sh $SUDO dnf -y module enable cri-o:$(get_kubernetes_version) $SUDO mkdir -p "$PACKAGE_DOWNLOAD_DIR" cd "$PACKAGE_DOWNLOAD_DIR" - $LILTO ooe.sh $SUDO dnf download -y --resolve ${DOWNLOAD_PACKAGES[@]} - ls -la "$PACKAGE_DOWNLOAD_DIR/" + $LILTO ooe.sh $SUDO dnf download -y --resolve "${DOWNLOAD_PACKAGES[@]}" fi echo "Installing runtime tooling" diff --git a/contrib/cirrus/packer/ubuntu_packaging.sh b/contrib/cirrus/packer/ubuntu_packaging.sh index d11c612c5..935e81147 100644 --- a/contrib/cirrus/packer/ubuntu_packaging.sh +++ b/contrib/cirrus/packer/ubuntu_packaging.sh @@ -65,7 +65,7 @@ INSTALL_PACKAGES=(\ gettext git go-md2man - golang + golang-1.14 iproute2 iptables jq @@ -101,12 +101,14 @@ INSTALL_PACKAGES=(\ podman protobuf-c-compiler protobuf-compiler + python-dateutil python-protobuf python2 python3-dateutil python3-pip python3-psutil python3-pytoml + python3-requests python3-setuptools rsync runc @@ -135,6 +137,10 @@ if [[ "$OS_RELEASE_VER" -le 19 ]]; then python-minimal yum-utils ) +else + INSTALL_PACKAGES+=(\ + python-is-python3 + ) fi # Do this at the last possible moment to avoid dpkg lock conflicts @@ -144,22 +150,26 @@ $BIGTO ooe.sh $SUDOAPTGET upgrade echo "Installing general testing and system dependencies" # Necessary to update cache of newly added repos $LILTO ooe.sh $SUDOAPTGET update -$BIGTO ooe.sh $SUDOAPTGET install ${INSTALL_PACKAGES[@]} +$BIGTO ooe.sh $SUDOAPTGET install "${INSTALL_PACKAGES[@]}" if [[ ${#DOWNLOAD_PACKAGES[@]} -gt 0 ]]; then echo "Downloading packages for optional installation at runtime, as needed." $SUDO ln -s /var/cache/apt/archives "$PACKAGE_DOWNLOAD_DIR" - $LILTO ooe.sh $SUDOAPTGET install --download-only ${DOWNLOAD_PACKAGES[@]} - ls -la "$PACKAGE_DOWNLOAD_DIR/" + $LILTO ooe.sh $SUDOAPTGET install --download-only "${DOWNLOAD_PACKAGES[@]}" fi -echo "Installing runtime tooling" -# Save some runtime by having these already available +echo "Configuring Go environment" +# There are multiple (otherwise conflicting) versions of golang available +# on Ubuntu. Being primarily localized by env. vars and defaults, dropping +# a symlink is the appropriate way to "install" a specific version system-wide. +$SUDO ln -sf /usr/lib/go-1.14/bin/go /usr/bin/go +# Initially go was not installed cd $GOSRC -# Required since initially go was not installed -source $GOSRC/$SCRIPT_BASE/lib.sh +source $SCRIPT_BASE/lib.sh echo "Go environment has been setup:" go env + +echo "Building/Installing runtime tooling" $SUDO hack/install_catatonit.sh $SUDO make install.libseccomp.sudo -$SUDO make install.tools +$SUDO make install.tools GO_BUILD='go build' # -mod=vendor breaks this diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh index e5f3168da..94169442b 100755 --- a/contrib/cirrus/setup_environment.sh +++ b/contrib/cirrus/setup_environment.sh @@ -39,16 +39,6 @@ done cd "${GOSRC}/" case "${OS_RELEASE_ID}" in ubuntu) - apt-get update - apt-get install -y containers-common - if [[ "$OS_RELEASE_VER" == "19" ]]; then - apt-get purge -y --auto-remove golang* - apt-get install -y golang-1.13 - ln -s /usr/lib/go-1.13/bin/go /usr/bin/go - fi - if [[ "$OS_RELEASE_VER" == "20" ]]; then - apt-get install -y python-is-python3 - fi ;; fedora) # All SELinux distros need this for systemd-in-a-container diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go index 93c4ede49..0b73ddd7e 100644 --- a/pkg/domain/infra/abi/generate.go +++ b/pkg/domain/infra/abi/generate.go @@ -20,9 +20,10 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string, if ctrErr == nil { // Generate the unit for the container. s, err := generate.ContainerUnit(ctr, options) - if err == nil { - return &entities.GenerateSystemdReport{Output: s}, nil + if err != nil { + return nil, err } + return &entities.GenerateSystemdReport{Output: s}, nil } // If it's not a container, we either have a pod or garbage. diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go index d114744c4..60d9162d1 100644 --- a/test/e2e/generate_systemd_test.go +++ b/test/e2e/generate_systemd_test.go @@ -53,6 +53,18 @@ var _ = Describe("Podman generate systemd", func() { Expect(session).To(ExitWithError()) }) + It("podman generate systemd bad restart-policy value", func() { + session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"generate", "systemd", "--restart-policy", "bogus", "foobar"}) + session.WaitWithDefaultTimeout() + Expect(session).To(ExitWithError()) + found, _ := session.ErrorGrepString("Error: bogus is not a valid restart policy") + Expect(found).Should(BeTrue()) + }) + It("podman generate systemd good timeout value", func() { session := podmanTest.Podman([]string{"create", "--name", "foobar", "alpine", "top"}) session.WaitWithDefaultTimeout() |