Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in release workflow #161

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

adam-cattermole
Copy link
Member

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@           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 Coverage Δ
unit 61.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Makefile Outdated
@@ -312,7 +312,7 @@ verify-manifests: manifests $(YQ) ## Verify manifests update.
yq e -e '.metadata.annotations.containerImage == "$(OPERATOR_IMAGE)"' config/manifests/bases/authorino-operator.clusterserviceversion.yaml

.PHONY: verify-bundle
verify-bundle: bundle $(YQ) ## Verify bundle update.
verify-bundle: $(YQ) ## Verify bundle update.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This virtually makes running make verify-bundle locally almost completely useless, but that's OK. In the end, locally, one can always run make bundle and thus ensure that the manifests are correct and up to date. Because, otherwise, they have to be committed and included with the changes.

verify-bundle only checks if the latest committed bundle manifests need update, by re-running make bundle and checking if that leaves any unstaged diff. Perhaps this makes more sense in remote than to simply check locally if you didn't forget running make bundle before pushing your changes.

So let's make this target indicated for usage by the automated workflows only and not so much by devs locally.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Collaborator

@guicassolato guicassolato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, @adam-cattermole! Thank you so much!

I've left a couple minor suggestions.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@guicassolato
Copy link
Collaborator

guicassolato commented Nov 24, 2023

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

@adam-cattermole adam-cattermole force-pushed the fix-release-workflow branch 2 times, most recently from 34b789b to 8f9f420 Compare November 24, 2023 11:20
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@adam-cattermole adam-cattermole force-pushed the fix-release-workflow branch 3 times, most recently from 3859c55 to 6bb5d32 Compare November 24, 2023 14:21
Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Collaborator

@guicassolato guicassolato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent job, @adam-cattermole! Thank you!

@guicassolato guicassolato merged commit a3fa822 into Kuadrant:main Nov 24, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants