From b9499ec659f66ed973f11daaa588ea254ac34a78 Mon Sep 17 00:00:00 2001 From: git-hyagi <45576767+git-hyagi@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:50:10 -0300 Subject: [PATCH] Add a workflow to test OLM bundle upgrades closes: #986 --- .ci/scripts/kind_with_registry.sh | 83 +++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 46 +++++++++++++++++ CHANGES/986.misc | 1 + Makefile | 7 +-- 4 files changed, 134 insertions(+), 3 deletions(-) create mode 100755 .ci/scripts/kind_with_registry.sh create mode 100644 CHANGES/986.misc diff --git a/.ci/scripts/kind_with_registry.sh b/.ci/scripts/kind_with_registry.sh new file mode 100755 index 000000000..f94a6cfd8 --- /dev/null +++ b/.ci/scripts/kind_with_registry.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +### +### This script is based on https://kind.sigs.k8s.io/docs/user/local-registry/ +### the only addition is the node config patch "seccomp-default: false" +### + +set -o errexit + +# 1. Create registry container unless it already exists +reg_name='kind-registry' +reg_port='5001' +if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then + docker run \ + -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ + registry:2 +fi + +# 2. Create kind cluster with containerd registry config dir enabled +# TODO: kind will eventually enable this by default and this patch will +# be unnecessary. +# +# See: +# https://github.com/kubernetes-sigs/kind/issues/2875 +# https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration +# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md +# +# We had to set seccomp-default to false because olm catalog pods were crashing +# See: https://github.com/containers/skopeo/issues/1501 +# https://kubernetes.io/docs/tutorials/security/seccomp/ +cat < Dockerfile.cross - docker buildx create --name project-v3-builder @@ -268,6 +268,7 @@ SDK_BIN = $(LOCALBIN)/operator-sdk KUSTOMIZE_VERSION ?= v3.8.7 CONTROLLER_TOOLS_VERSION ?= v0.9.2 CRD_MARKDOWN_VERSION ?= v0.0.3 +OPERATOR_SDK_VERSION ?= v1.25.2 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize @@ -298,7 +299,7 @@ ifeq (,$(shell which operator-sdk 2>/dev/null)) set -e ;\ mkdir -p $(dir $(SDK_BIN)) ;\ OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ - curl -sSLo $(SDK_BIN) https://github.com/operator-framework/operator-sdk/releases/download/v1.25.2/operator-sdk_$${OS}_$${ARCH} ;\ + curl -sSLo $(SDK_BIN) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\ chmod +x $(SDK_BIN) ;\ } else