Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix broken exit code checks in rpm-ostree install #76

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions podman-image/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ RUN if [[ ${PODMAN_RPM_TYPE} == "dev" ]]; then \
--from repo="copr:copr.fedorainfracloud.org:rhcontainerbot:podman-next" \
aardvark-dns crun netavark podman containers-common containers-common-extra crun-wasm; \
else \
rm /etc/yum.repos.d/rhcontainerbot*.repo /etc/pki/rpm-gpg/rhcontainerbot*.gpg; \
rm /etc/yum.repos.d/rhcontainerbot*.repo /etc/pki/rpm-gpg/rhcontainerbot*.gpg && \
if [[ $(rpm -q podman) != "podman-${PODMAN_VERSION}-${PODMAN_RPM_RELEASE}.fc${FEDORA_RELEASE}.${ARCH}" ]]; then \
rpm-ostree override replace ${PODMAN_RPM_URL}; \
fi; \
fi; \
rpm-ostree override remove moby-engine containerd runc; \
rm -fr /var/cache && ostree container commit
fi \
fi && \
rpm-ostree override remove moby-engine containerd runc && \
rm -fr /var/cache && \
ostree container commit

# Install subscription-manager and enable service to refresh certificates
# Install qemu-user-static for bootc
# Install gvisor-tap-vsock-gvforwarder for hyperv
# Install ansible for post-install configuration
RUN rpm-ostree install subscription-manager gvisor-tap-vsock-gvforwarder qemu-user-static ansible-core && rm -fr /var/cache
RUN rpm-ostree install subscription-manager gvisor-tap-vsock-gvforwarder qemu-user-static ansible-core && \
rm -fr /var/cache && \
ostree container commit

RUN systemctl enable rhsmcertd.service
# Patching qemu backed binfmt configurations to use the actual executable's permissions and not the interpreter's
Expand Down
46 changes: 29 additions & 17 deletions verify/basic_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package verify

import (
"os"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
Expand Down Expand Up @@ -97,23 +100,32 @@ var _ = Describe("run basic podman commands", func() {
Expect(sshSession.outputToString()).To(And(ContainSubstring("ip_tables"), ContainSubstring("ip6_tables")))

// set by podman-rpm-info-vars.sh

// TODO: there is no 5.5 in the copr yet as podman main would need to be bumped.
// But in order to do that it needs working machine images, catch-22.
// Skip this check for now, we should consider only doing this check on release branches.
// if version := os.Getenv("PODMAN_VERSION"); version != "" {
// // version is x.y.z while image uses x.y, remove .z so we can match
// index := strings.LastIndex(version, ".")
// if index >= 0 {
// version = version[:index]
// }
// // verify the rpm-ostree image inside uses the proper podman image reference
// sshSession, err = mb.setCmd([]string{"machine", "ssh", machineName, "sudo rpm-ostree status --json | jq -r '.deployments[0].\"container-image-reference\"'"}).run()
// Expect(err).ToNot(HaveOccurred())
// Expect(sshSession).To(Exit(0))
// Expect(sshSession.outputToString()).
// To(Equal("ostree-remote-image:fedora:docker://quay.io/podman/machine-os:" + version))
// }
if version := os.Getenv("PODMAN_VERSION"); version != "" {
// When we have an rc package fedora uses "~rc" while the upstream version is "-rc".
// As such we have to replace it so we can match the real version below.
version = strings.ReplaceAll(version, "~", "-")
// version is x.y.z while image uses x.y, remove .z so we can match
imageVersion := version
index := strings.LastIndex(version, ".")
if index >= 0 {
imageVersion = version[:index]
}
// verify the rpm-ostree image inside uses the proper podman image reference
sshSession, err = mb.setCmd([]string{"machine", "ssh", machineName, "sudo rpm-ostree status --json | jq -r '.deployments[0].\"container-image-reference\"'"}).run()
Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0))
Expect(sshSession.outputToString()).
To(Equal("ostree-remote-image:fedora:docker://quay.io/podman/machine-os:" + imageVersion))

// TODO: there is no 5.5 in the copr yet as podman main would need to be bumped.
// But in order to do that it needs working machine images, catch-22.
// Skip this check for now, we should consider only doing this check on release branches.
// check the server version so we know we have the right version installed in the VM
// server, err := mb.setCmd([]string{"version", "--format", "{{.Server.Version}}"}).run()
// Expect(err).ToNot(HaveOccurred())
// Expect(server).To(Exit(0))
// Expect(server.outputToString()).To(Equal(version))
}
})

It("machine stop/start cycle", func() {
Expand Down