Skip to content
Closed
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
6 changes: 6 additions & 0 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@echo "(re)installing $(GOBIN)/golangci-lint-v2.8.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v2.8.0 "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"

KIND := $(GOBIN)/kind-v0.31.0
$(KIND): $(BINGO_DIR)/kind.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/kind-v0.31.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=kind.mod -o=$(GOBIN)/kind-v0.31.0 "sigs.k8s.io/kind"

5 changes: 5 additions & 0 deletions .bingo/kind.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.26.5

require sigs.k8s.io/kind v0.31.0
35 changes: 35 additions & 0 deletions .bingo/kind.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
al.essio.dev/pkg/shellescape v1.5.1 h1:86HrALUujYS/h+GtqoB26SBEdkWfmMI6FubjXlsXyho=
al.essio.dev/pkg/shellescape v1.5.1/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
sigs.k8s.io/kind v0.29.0 h1:3TpCsyh908IkXXpcSnsMjWdwdWjIl7o9IMZImZCWFnI=
sigs.k8s.io/kind v0.29.0/go.mod h1:ldWQisw2NYyM6k64o/tkZng/1qQW7OlzcN5a8geJX3o=
sigs.k8s.io/kind v0.31.0 h1:UcT4nzm+YM7YEbqiAKECk+b6dsvc/HRZZu9U0FolL1g=
sigs.k8s.io/kind v0.31.0/go.mod h1:FSqriGaoTPruiXWfRnUXNykF8r2t+fHtK0P0m1AbGF8=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
2 changes: 2 additions & 0 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ GO_APIDIFF="${GOBIN}/go-apidiff-v0.8.3"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v2.8.0"

KIND="${GOBIN}/kind-v0.31.0"

103 changes: 103 additions & 0 deletions .github/workflows/migration-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: migration-test

on:
workflow_dispatch:
pull_request:
merge_group:
push:
branches:
- main

jobs:
unit-coverage:
name: migration unit coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Run unit tests with coverage
run: make migration/test-coverage
- name: Upload unit coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: migration-unit-coverage
path: artifacts/coverage
if-no-files-found: ignore

fixture:
name: migration fixture E2E
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Set up fixture cluster
run: make migration/e2e-fixture-setup
- name: Run fixture migration tests
run: make migration/test-e2e-fixture-matrix
- name: Tear down fixture cluster
if: always()
run: E2E_CLUSTER_NAME=library-olm-fixture-e2e make migration/e2e-teardown
- name: Upload fixture diagnostics and coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: migration-fixture-e2e-artifacts
path: artifacts/e2e
if-no-files-found: ignore

coverage:
name: migration total coverage
needs: [unit-coverage, fixture, live]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Download unit coverage
uses: actions/download-artifact@v8
with:
name: migration-unit-coverage
path: artifacts/coverage
- name: Download fixture E2E coverage
uses: actions/download-artifact@v8
with:
name: migration-fixture-e2e-artifacts
path: artifacts/e2e
- name: Download live E2E coverage
uses: actions/download-artifact@v8
with:
name: migration-live-e2e-artifacts
path: artifacts/e2e
- name: Display combined coverage
run: make migration/report-coverage-all

live:
name: migration live-operator E2E
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Set up live cluster
run: make migration/e2e-setup
- name: Run live-operator migration tests
run: make migration/test-e2e-live-matrix
- name: Tear down live cluster
if: always()
run: make migration/e2e-teardown
- name: Upload live diagnostics and coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: migration-live-e2e-artifacts
path: artifacts/e2e
if-no-files-found: ignore
20 changes: 0 additions & 20 deletions .github/workflows/unit-test.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ go.work.sum
# Editor/IDE
# .idea/
# .vscode/
# Kind-generated kubeconfigs contain cluster credentials.
.kubeconfig/

# Locally built CLIs and E2E diagnostics.
bin/
artifacts/
36 changes: 6 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,22 @@ GOLANG_VERSION := $(shell sed -En 's/^go (.*)$$/\1/p' "go.mod")
# bingo manages consistent tooling versions.
include .bingo/Variables.mk

# Output paths for compiled CLI binaries
MIGRATE_OPERATORS_BIN := $(BIN_DIR)/migrate-operators-v0-to-v1
MIGRATE_CATALOGS_BIN := $(BIN_DIR)/migrate-catalogs-v0-to-v1
# Migration-specific build and test targets live separately so this Makefile
# remains the home for repository-wide targets.
include $(ROOT_DIR)/migration.mk

##@ General

.PHONY: help
help: ## Display this help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-28s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9\/-]+:.*?##/ { printf " \033[36m%-36s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Build

.PHONY: build
build: build-migrate-operators build-migrate-catalogs ## Build both CLI binaries into bin/

.PHONY: build-migrate-operators
build-migrate-operators: ## Build migrate-operators-v0-to-v1 into bin/
@mkdir -p $(BIN_DIR)
go build -o $(MIGRATE_OPERATORS_BIN) ./migration/examples/cmd/migrate-operators-v0-to-v1

.PHONY: build-migrate-catalogs
build-migrate-catalogs: ## Build migrate-catalogs-v0-to-v1 into bin/
@mkdir -p $(BIN_DIR)
go build -o $(MIGRATE_CATALOGS_BIN) ./migration/examples/cmd/migrate-catalogs-v0-to-v1
##@ Repository Build

.PHONY: build-all
build-all: ## Build and verify all packages (library + CLIs)
go build ./...

##@ Test

.PHONY: test
test: ## Run unit tests
go test ./... -count=1

.PHONY: test-verbose
test-verbose: ## Run unit tests with verbose output
go test ./... -v -count=1

##@ Lint & Verify

.PHONY: lint
Expand Down Expand Up @@ -77,5 +54,4 @@ api-diff: $(GO_APIDIFF) ## Check for breaking API changes against origin/main
##@ Clean

.PHONY: clean
clean: ## Remove built binaries from bin/
rm -f $(MIGRATE_OPERATORS_BIN) $(MIGRATE_CATALOGS_BIN)
clean: migration/clean ## Remove generated repository artifacts
11 changes: 11 additions & 0 deletions e2e/migration/fixtures/operatorhubio-catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Fixture clusters deliberately omit the OLMv0 controllers. The migrated
# Subscription snapshots still reference this source, so retain the source
# object as committed fixture input for catalog migration and resolution.
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: operatorhubio-catalog
namespace: olm
spec:
sourceType: grpc
image: quay.io/operatorhubio/catalog@sha256:e7a14e472319e3a72ff7b65941e07712b988970bc02e79d35aef70c0cbf50b7f
Loading