diff --git a/Makefile b/Makefile index 947e9237b2..0655da68b2 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ export HANDLER_NAMESPACE ?= nmstate export OPERATOR_NAMESPACE ?= $(HANDLER_NAMESPACE) HANDLER_PULL_POLICY ?= Always OPERATOR_PULL_POLICY ?= Always -export IMAGE_BUILDER ?= docker +export IMAGE_BUILDER ?= $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi) WHAT ?= ./pkg/... ./controllers/... @@ -145,13 +145,13 @@ handler: SKIP_PUSH=true handler: push-handler push-handler: handler-manager - SKIP_PUSH=$(SKIP_PUSH) SKIP_IMAGE_BUILD=$(SKIP_IMAGE_BUILD) IMAGE=${HANDLER_IMAGE} hack/build-push-container.${IMAGE_BUILDER}.sh . -f build/$(HANDLER_DOCKERFILE) + SKIP_PUSH=$(SKIP_PUSH) SKIP_IMAGE_BUILD=$(SKIP_IMAGE_BUILD) IMAGE=${HANDLER_IMAGE} hack/build-push-container.${IMAGE_BUILDER}.sh -f build/$(HANDLER_DOCKERFILE) operator: SKIP_PUSH=true operator: push-operator push-operator: operator-manager - SKIP_PUSH=$(SKIP_PUSH) SKIP_IMAGE_BUILD=$(SKIP_IMAGE_BUILD) IMAGE=${OPERATOR_IMAGE} hack/build-push-container.${IMAGE_BUILDER}.sh . -f build/Dockerfile.operator + SKIP_PUSH=$(SKIP_PUSH) SKIP_IMAGE_BUILD=$(SKIP_IMAGE_BUILD) IMAGE=${OPERATOR_IMAGE} hack/build-push-container.${IMAGE_BUILDER}.sh -f build/Dockerfile.operator push: push-handler push-operator diff --git a/automation/check-patch.docs.sh b/automation/check-patch.docs.sh index c2e8a497a9..7bb2bb2daf 100755 --- a/automation/check-patch.docs.sh +++ b/automation/check-patch.docs.sh @@ -1,5 +1,7 @@ #!/bin/bash -xe +IMAGE_BUILDER=${IMAGE_BUILDER:-$(./hack/detect_cri.sh)} + # Change url to point to google storage url="https://storage.googleapis.com" baseurl="kubevirt-prow/pr-logs/pull/nmstate_kubernetes-nmstate/${PULL_NUMBER}/pull-kubernetes-nmstate-docs/${BUILD_ID}/artifacts/gh-pages/" @@ -7,7 +9,7 @@ sed -i "s#^url:.*#url: \"$url\"#" docs/_config.yaml sed -i "s#^baseurl:.*#baseurl: \"$baseurl\"#" docs/_config.yaml -docker run -v $(pwd)/docs:/docs/ ruby make -C docs install check +${IMAGE_BUILDER} run -v $(pwd)/docs:/docs/ ruby make -C docs install check # Copy the docs to the artifacts mkdir -p $ARTIFACTS/gh-pages diff --git a/automation/check-patch.e2e-k8s.sh b/automation/check-patch.e2e-k8s.sh index e28f6071ea..01d599a4a6 100755 --- a/automation/check-patch.e2e-k8s.sh +++ b/automation/check-patch.e2e-k8s.sh @@ -2,7 +2,7 @@ # This script should be able to execute functional tests against Kubernetes # cluster on any environment with basic dependencies listed in -# check-patch.packages installed and docker running. +# check-patch.packages installed and podman / docker running. # # yum -y install automation/check-patch.packages # automation/check-patch.e2e-k8s.sh diff --git a/automation/check-patch.e2e-operator-k8s.sh b/automation/check-patch.e2e-operator-k8s.sh index e0f8d68c69..66ff25da3a 100755 --- a/automation/check-patch.e2e-operator-k8s.sh +++ b/automation/check-patch.e2e-operator-k8s.sh @@ -2,7 +2,7 @@ # This script should be able to execute functional tests against Kubernetes # cluster on any environment with basic dependencies listed in -# check-patch.packages installed and docker running. +# check-patch.packages installed and podman / docker running. # # yum -y install automation/check-patch.packages # automation/check-patch.e2e-k8s.sh diff --git a/automation/check-patch.unit-test.sh b/automation/check-patch.unit-test.sh index 0ebcb17d93..1c01fa922e 100755 --- a/automation/check-patch.unit-test.sh +++ b/automation/check-patch.unit-test.sh @@ -2,7 +2,7 @@ # This script should be able to execute functional tests against Kubernetes # cluster on any environment with basic dependencies listed in -# check-patch.packages installed and docker running. +# check-patch.packages installed and podman / docker running. # # yum -y install automation/check-patch.packages # automation/check-patch.e2e-k8s.sh diff --git a/automation/publish.sh b/automation/publish.sh index a9a55f7fe6..1f5d9761ad 100755 --- a/automation/publish.sh +++ b/automation/publish.sh @@ -6,6 +6,8 @@ # IMAGE_REPO # To run it just do proper docker login and automation/publish.sh +IMAGE_BUILDER=${IMAGE_BUILDER:-$(./hack/detect_cri.sh)} + image_registry=${IMAGE_REGISTRY:-quay.io} image_repo=${IMAGE_REPO:-nmstate} @@ -23,7 +25,7 @@ push_knmstate_containers() { publish_docs() { # Update gh-pages branch with the generated documentation - docker run -v $(pwd)/docs:/docs/ ruby make -C /docs install build + ${IMAGE_BUILDER} run -v $(pwd)/docs:/docs/ ruby make -C /docs install build rm -rf /tmp/gh-pages git clone --single-branch http://github.com/nmstate/kubernetes-nmstate -b gh-pages /tmp/gh-pages rsync -rt --links --cvs-exclude docs/build/kubernetes-nmstate/* /tmp/gh-pages diff --git a/cluster/kubevirtci.sh b/cluster/kubevirtci.sh index 9ede303660..cfe4ff7d85 100644 --- a/cluster/kubevirtci.sh +++ b/cluster/kubevirtci.sh @@ -1,5 +1,5 @@ export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.23'} -export KUBEVIRTCI_TAG='2203222209-7c38b02' +export KUBEVIRTCI_TAG=2205030954-99bd4d1 KUBEVIRTCI_REPO='https://github.com/kubevirt/kubevirtci.git' KUBEVIRTCI_PATH="${PWD}/_kubevirtci" diff --git a/hack/build-push-container.docker.sh b/hack/build-push-container.docker.sh index ecfd261562..c483870af5 100755 --- a/hack/build-push-container.docker.sh +++ b/hack/build-push-container.docker.sh @@ -24,5 +24,5 @@ PUSH=--push if [ "$SKIP_PUSH" == "true" ]; then PUSH="" fi -docker buildx build --progress plain --platform ${PLATFORM} $@ -t ${IMAGE} $PUSH +docker buildx build --progress plain --platform ${PLATFORM} . $@ -t ${IMAGE} $PUSH diff --git a/hack/build-push-container.podman.sh b/hack/build-push-container.podman.sh index fb549ab8cd..787601a68c 100755 --- a/hack/build-push-container.podman.sh +++ b/hack/build-push-container.podman.sh @@ -14,19 +14,18 @@ fi ARCHS=${ARCHS:-$(go env GOARCH)} -podman rmi ${IMAGE} || true -podman manifest rm ${IMAGE} || true -podman manifest create ${IMAGE} +buildah rmi ${IMAGE} 2>/dev/null || true +buildah manifest rm ${IMAGE} 2>/dev/null || true +buildah manifest create ${IMAGE} IMAGES=${IMAGE} for arch in $ARCHS; do - podman build --arch $arch --build-arg TARGETARCH=$arch -t $IMAGE.$arch $@ - podman manifest add --tls-verify=$TLS_VERIFY ${IMAGE} docker://${IMAGE}.$arch - - if [ ! "$SKIP_PUSH" == "true" ]; then - podman push --tls-verify=$TLS_VERIFY ${IMAGE}.$arch - fi + buildah bud \ + --manifest ${IMAGE} \ + --arch ${arch} --build-arg TARGETARCH=${arch} $@ --tag ${IMAGE}.${arch} done if [ ! "$SKIP_PUSH" == "true" ]; then - podman manifest push --tls-verify=$TLS_VERIFY ${IMAGE} docker://${IMAGE} + buildah manifest push --all \ + ${IMAGE} \ + docker://${IMAGE} --tls-verify=${TLS_VERIFY} fi diff --git a/hack/detect_cri.sh b/hack/detect_cri.sh new file mode 100755 index 0000000000..ff07b64d54 --- /dev/null +++ b/hack/detect_cri.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +determine_cri_bin() { + if podman ps >/dev/null 2>&1; then + echo podman + elif docker ps >/dev/null 2>&1; then + echo docker + else + echo "" + fi +} + +determine_cri_bin