Skip to content

Commit

Permalink
Use single source for cert-manager version
Browse files Browse the repository at this point in the history
deploy.py now outputs an informative error message if `CERT_MANAGER_VERSION` not set
  • Loading branch information
manics committed Jun 13, 2023
1 parent 8a1515d commit 09ad123
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ env:
# updating.
#
HELM_VERSION: "v3.12.0"
# cert-mangaer versions at https://cert-manager.io/docs/release-notes/, update
# to latest when updating and make sure to read upgrade notes. "kubectl apply"
# will be done on CRDs but sometimes more is needed.
#
# NOTE: Updates to CERT_MANAGER_VERSION should also be done in the
# test-helm-template.yaml workflow.
#
CERT_MANAGER_VERSION: "v1.12.0"

# These variables influence git directly
# https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test-helm-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
#
name: Test helm template --validate

env:
# NOTE: Updates to CERT_MANAGER_VERSION should also be done in the cd.yaml
# workflow.
#
CERT_MANAGER_VERSION: "v1.8.0"

on:
pull_request:
paths:
Expand Down Expand Up @@ -74,10 +68,13 @@ jobs:
# from cert-manager.
#
- name: Install cert-manager CRDs
run: kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.crds.yaml
run: |
. cert-manager.env
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.crds.yaml
- name: "helm template --validate (cert-manager chart)"
run: |
. cert-manager.env
echo "cert-manager version: ${CERT_MANAGER_VERSION}"
helm template --validate cert-manager cert-manager \
Expand Down
5 changes: 5 additions & 0 deletions cert-manager.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# cert-manager versions at https://cert-manager.io/docs/release-notes/, update
# to latest when updating and make sure to read upgrade notes. "kubectl apply"
# will be done on CRDs but sometimes more is needed.

export CERT_MANAGER_VERSION=v1.12.0
4 changes: 3 additions & 1 deletion deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def setup_certmanager():
additional upgrade notes, see https://cert-manager.io/docs/release-notes/
before you upgrade to a new version.
"""
version = os.environ["CERT_MANAGER_VERSION"]
version = os.getenv("CERT_MANAGER_VERSION")
if not version:
raise RuntimeError("CERT_MANAGER_VERSION not set. Source cert-manager.env")

manifest_url = f"https://github.com/jetstack/cert-manager/releases/download/{version}/cert-manager.crds.yaml"
print(BOLD + GREEN + f"Installing cert-manager CRDs {version}" + NC, flush=True)
Expand Down

0 comments on commit 09ad123

Please sign in to comment.