Kuadrant / authorino-operator

Kubernetes Operator to manage Authorino instances
Apache License 2.0
9 stars 20 forks source link

Fix bugs in release workflow #161

Closed adam-cattermole closed 12 months ago

codecov-commenter commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (705a68d) 61.63% compared to head (a022b2c) 61.63%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #161 +/- ## ======================================= Coverage 61.63% 61.63% ======================================= Files 2 2 Lines 782 782 ======================================= Hits 482 482 Misses 249 249 Partials 51 51 ``` | [Flag](https://app.codecov.io/gh/Kuadrant/authorino-operator/pull/161/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Kuadrant) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/Kuadrant/authorino-operator/pull/161/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Kuadrant) | `61.63% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Kuadrant#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

guicassolato commented 1 year ago

Verification steps

Verify for latest

Generate the manifests:

make bundle VERSION=$(git rev-parse HEAD) IMAGE_TAG=$(git rev-parse HEAD)

Verify the manifests:

make verify-manifests verify-bundle VERSION=$(git rev-parse HEAD) IMAGE_TAG=$(git rev-parse HEAD)

Cleanup:

git reset --hard

Verify for a release

Prepare the release:

make prepare-release VERSION=0.10.0 AUTHORINO_VERSION=0.16.0 CHANNELS=stable DEFAULT_CHANNEL=stable

Check the manifests are correct:

git diff
diff --git a/bundle.Dockerfile b/bundle.Dockerfile
index 8fe9a64b..289359d2 100644
--- a/bundle.Dockerfile
+++ b/bundle.Dockerfile
@@ -5,7 +5,8 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 LABEL operators.operatorframework.io.bundle.package.v1=authorino-operator
-LABEL operators.operatorframework.io.bundle.channels.v1=alpha
+LABEL operators.operatorframework.io.bundle.channels.v1=stable
+LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
 LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0
 LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
 LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
diff --git a/bundle/manifests/authorino-operator.clusterserviceversion.yaml b/bundle/manifests/authorino-operator.clusterserviceversion.yaml
index d8cf8f64..e5db89e1 100644
--- a/bundle/manifests/authorino-operator.clusterserviceversion.yaml
+++ b/bundle/manifests/authorino-operator.clusterserviceversion.yaml
@@ -26,13 +26,13 @@ metadata:
       ]
     capabilities: Basic Install
     categories: Integration & Delivery
-    containerImage: quay.io/kuadrant/authorino-operator:latest
+    containerImage: quay.io/kuadrant/authorino-operator:v0.10.0
     createdAt: 2021-12-08T10-00-00Z
     operators.operatorframework.io/builder: operator-sdk-v1.22.0
     operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
     repository: https://github.com/Kuadrant/authorino-operator
     support: kuadrant
-  name: authorino-operator.v0.0.0
+  name: authorino-operator.v0.10.0
   namespace: placeholder
 spec:
   apiservicedefinitions: {}
@@ -256,7 +256,7 @@ spec:
                       - --leader-elect
                     command:
                       - /manager
-                    image: quay.io/kuadrant/authorino-operator:latest
+                    image: quay.io/kuadrant/authorino-operator:v0.10.0
                     livenessProbe:
                       httpGet:
                         path: /healthz
@@ -303,7 +303,7 @@ spec:
                   - command:
                       - authorino
                       - webhooks
-                    image: quay.io/kuadrant/authorino:latest
+                    image: quay.io/kuadrant/authorino:v0.16.0
                     name: webhooks
                     ports:
                       - containerPort: 9443
@@ -429,7 +429,7 @@ spec:
   minKubeVersion: 1.8.0
   provider:
     name: Red Hat
-  version: 0.0.0
+  version: 0.10.0
   webhookdefinitions:
     - admissionReviewVersions:
         - v1beta1
@@ -443,3 +443,4 @@ spec:
       targetPort: 9443
       type: ConversionWebhook
       webhookPath: /convert
+  replaces: authorino-operator.v0.9.0
diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml
index 118a56d0..e8e53507 100644
--- a/bundle/metadata/annotations.yaml
+++ b/bundle/metadata/annotations.yaml
@@ -4,7 +4,8 @@ annotations:
   operators.operatorframework.io.bundle.manifests.v1: manifests/
   operators.operatorframework.io.bundle.metadata.v1: metadata/
   operators.operatorframework.io.bundle.package.v1: authorino-operator
-  operators.operatorframework.io.bundle.channels.v1: alpha
+  operators.operatorframework.io.bundle.channels.v1: stable
+  operators.operatorframework.io.bundle.channel.default.v1: stable
   operators.operatorframework.io.metrics.builder: operator-sdk-v1.22.0
   operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
   operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
diff --git a/config/authorino/kustomization.yaml b/config/authorino/kustomization.yaml
index ef0ddde0..31af44ab 100644
--- a/config/authorino/kustomization.yaml
+++ b/config/authorino/kustomization.yaml
@@ -2,14 +2,14 @@ apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization

 resources:
-- github.com/Kuadrant/authorino/install?ref=main
+- github.com/Kuadrant/authorino/install?ref=v0.16.0
 - webhook

 # Configures the conversion webhook
 images:
 - name: AUTHORINO_IMAGE
   newName: quay.io/kuadrant/authorino
-  newTag: latest
+  newTag: v0.16.0

 patchesStrategicMerge:
 - webhook/patches/webhook_in_authconfigs.yaml
diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml
index 9c262bba..a7f28948 100644
--- a/config/deploy/manifests.yaml
+++ b/config/deploy/manifests.yaml
@@ -6150,7 +6150,7 @@ spec:
         - --leader-elect
         command:
         - /manager
-        image: quay.io/kuadrant/authorino-operator:latest
+        image: quay.io/kuadrant/authorino-operator:v0.10.0
         livenessProbe:
           httpGet:
             path: /healthz
@@ -6201,7 +6201,7 @@ spec:
       - command:
         - authorino
         - webhooks
-        image: quay.io/kuadrant/authorino:latest
+        image: quay.io/kuadrant/authorino:v0.16.0
         name: webhooks
         ports:
         - containerPort: 9443
diff --git a/config/manifests/bases/authorino-operator.clusterserviceversion.yaml b/config/manifests/bases/authorino-operator.clusterserviceversion.yaml
index 595b71ad..455682df 100644
--- a/config/manifests/bases/authorino-operator.clusterserviceversion.yaml
+++ b/config/manifests/bases/authorino-operator.clusterserviceversion.yaml
@@ -5,13 +5,13 @@ metadata:
     alm-examples: '[]'
     capabilities: Basic Install
     categories: Integration & Delivery
-    containerImage: quay.io/kuadrant/authorino-operator:latest
+    containerImage: quay.io/kuadrant/authorino-operator:v0.10.0
     createdAt: 2021-12-08T10-00-00Z
     operators.operatorframework.io/builder: operator-sdk-v1.9.0
     operators.operatorframework.io/project_layout: unknown
     repository: https://github.com/Kuadrant/authorino-operator
     support: kuadrant
-  name: authorino-operator.v0.0.0
+  name: authorino-operator.v0.10.0
   namespace: placeholder
 spec:
   apiservicedefinitions: {}
@@ -67,4 +67,4 @@ spec:
   minKubeVersion: 1.8.0
   provider:
     name: Red Hat
-  version: 0.0.0
+  version: 0.10.0

Commit the changes as if you were simulating the creation of the release branch:

git checkout -b simulation-v0.10.0
git add -Av
git commit -m "Simulate release v0.10.0"

Verify the manifests:

make verify-manifests VERSION=0.10.0 AUTHORINO_VERSION=0.16.0 CHANNELS=stable DEFAULT_CHANNEL=stable
[…]
git diff -I'^    containerImage:' -I'^        image:' --exit-code ./config
[ -z "$(git ls-files --other --exclude-standard --directory --no-empty-directory ./config)" ]
yq ea -e 'select([.][].kind == "Deployment") | select([.][].metadata.name == "authorino-operator").spec.template.spec.containers[0].image | . == "quay.io/kuadrant/authorino-operator:v0.10.0"' config/deploy/manifests.yaml
true
yq ea -e 'select([.][].kind == "Deployment") | select([.][].metadata.name == "authorino-webhooks").spec.template.spec.containers[0].image | . == "quay.io/kuadrant/authorino:v0.16.0"' config/deploy/manifests.yaml
true
yq e -e '.metadata.annotations.containerImage == "quay.io/kuadrant/authorino-operator:v0.10.0"' config/manifests/bases/authorino-operator.clusterserviceversion.yaml
true

Verify the bundle manifests:

make verify-bundle VERSION=0.10.0 AUTHORINO_VERSION=0.16.0 CHANNELS=stable DEFAULT_CHANNEL=stable
git diff -I'^    containerImage:' -I'^                image:' --exit-code ./bundle
[ -z "$(git ls-files --other --exclude-standard --directory --no-empty-directory ./bundle)" ]
yq e -e '.metadata.annotations.containerImage == "quay.io/kuadrant/authorino-operator:v0.10.0"' bundle/manifests/authorino-operator.clusterserviceversion.yaml
true
yq e -e '.spec.install.spec.deployments[0].spec.template.spec.containers[0].image == "quay.io/kuadrant/authorino-operator:v0.10.0"' bundle/manifests/authorino-operator.clusterserviceversion.yaml
true
yq e -e '.spec.install.spec.deployments[1].spec.template.spec.containers[0].image == "$(DEFAULT_AUTHORINO_IMAGE)"' bundle/manifests/authorino-operator.clusterserviceversion.yaml