From 39fd9aa08445b24065d187231c35b6d296382b99 Mon Sep 17 00:00:00 2001 From: Matt Heon Date: Fri, 3 Mar 2023 13:41:29 -0500 Subject: [PATCH] Add SQLite job to CI Signed-off-by: Matt Heon --- .cirrus.yml | 10 ++++++++++ contrib/cirrus/lib.sh | 2 +- contrib/cirrus/setup_environment.sh | 20 ++++++++++++++++++++ pkg/specgenutil/util.go | 1 + test/e2e/common_test.go | 10 ++++++++-- test/utils/utils.go | 1 + 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8b4d933764..2a23f99b46 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -103,6 +103,16 @@ build_task: # ID for re-use of build output CI_DESIRED_RUNTIME: crun CI_DESIRED_NETWORK: netavark + CI_DESIRED_DATABASE: boltdb + - env: &sqliteenvvars + DISTRO_NV: ${FEDORA_NAME} + # Not used here, is used in other tasks + VM_IMAGE_NAME: ${FEDORA_CACHE_IMAGE_NAME} + CTR_FQIN: ${FEDORA_CONTAINER_FQIN} + # ID for re-use of build output + CI_DESIRED_RUNTIME: crun + CI_DESIRED_NETWORK: netavark + CI_DESIRED_DATABASE: sqlite - env: &priorfedora_envvars DISTRO_NV: ${PRIOR_FEDORA_NAME} VM_IMAGE_NAME: ${PRIOR_FEDORA_CACHE_IMAGE_NAME} diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh index edac709170..bd099825ff 100644 --- a/contrib/cirrus/lib.sh +++ b/contrib/cirrus/lib.sh @@ -93,7 +93,7 @@ EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA" # contexts, such as host->container or root->rootless user # # List of envariables which must be EXACT matches -PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE' +PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB' # List of envariable patterns which must match AT THE BEGINNING of the name. PASSTHROUGH_ENV_ATSTART='CI|TEST' diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh index dcdb65bf5e..01956a1d64 100755 --- a/contrib/cirrus/setup_environment.sh +++ b/contrib/cirrus/setup_environment.sh @@ -142,6 +142,26 @@ case "$CI_DESIRED_NETWORK" in *) die_unknown CI_DESIRED_NETWORK ;; esac +# Database: force SQLite or BoltDB as requested in .cirrus.yml. +# If unset, will default to BoltDB. +# shellcheck disable=SC2154 +case "$CI_DESIRED_DATABASE" in + sqlite) + warn "Forcing PODMAN_DB=sqlite" + echo "PODMAN_DB=sqlite" >> /etc/ci_environment + ;; + boltdb) + warn "Forcing PODMAN_DB=boltdb" + echo "PODMAN_DB=boltdb" >> /etc/ci_environment + ;; + "") + warn "Using default Podman database" + ;; + *) + die_unknown CI_DESIRED_DATABASE + ;; +esac + # Required to be defined by caller: The environment where primary testing happens # shellcheck disable=SC2154 case "$TEST_ENVIRON" in diff --git a/pkg/specgenutil/util.go b/pkg/specgenutil/util.go index 4e065347f5..1d7b3dee39 100644 --- a/pkg/specgenutil/util.go +++ b/pkg/specgenutil/util.go @@ -282,6 +282,7 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf "--network-config-dir", config.Network.NetworkConfigDir, "--network-backend", config.Network.NetworkBackend, "--volumepath", config.Engine.VolumePath, + "--db-backend", config.Engine.DBBackend, fmt.Sprintf("--transient-store=%t", storageConfig.TransientStore), } if config.Engine.OCIRuntime != "" { diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 92aba5a133..f5a24b75a8 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -249,6 +249,11 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration { } os.Setenv("DISABLE_HC_SYSTEMD", "true") + dbBackend := "boltdb" + if os.Getenv("PODMAN_DB") == "sqlite" { + dbBackend = "sqlite" + } + networkBackend := CNI networkConfigDir := "/etc/cni/net.d" if isRootless() { @@ -291,6 +296,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration { ImageCacheFS: storageFs, ImageCacheDir: ImageCacheDir, NetworkBackend: networkBackend, + DatabaseBackend: dbBackend, }, ConmonBinary: conmonBinary, QuadletBinary: quadletBinary, @@ -918,8 +924,8 @@ func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache boo eventsType = "none" } - podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s", - debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.NetworkConfigDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, eventsType), " ") + podmanOptions := strings.Split(fmt.Sprintf("%s--root %s --runroot %s --runtime %s --conmon %s --network-config-dir %s --network-backend %s --cgroup-manager %s --tmpdir %s --events-backend %s --db-backend %s", + debug, p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.NetworkConfigDir, p.NetworkBackend.ToString(), p.CgroupManager, p.TmpDir, eventsType, p.DatabaseBackend), " ") podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...) if !noCache { diff --git a/test/utils/utils.go b/test/utils/utils.go index aa0cb1a809..0ee754f094 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -65,6 +65,7 @@ type PodmanTest struct { ImageCacheDir string ImageCacheFS string NetworkBackend NetworkBackend + DatabaseBackend string PodmanBinary string PodmanMakeOptions func(args []string, noEvents, noCache bool) []string RemoteCommand *exec.Cmd