Skip to content

Commit

Permalink
automated commit
Browse files Browse the repository at this point in the history
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jun 20, 2024
1 parent 1aa2e04 commit 9679b73
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
22 changes: 22 additions & 0 deletions images/cert-manager/cmctl.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# As of cert-manager 1.15 onwards, cmctl is independently versioned, and only
# "latest" is supported
module "cmctl-config" {
source = "./config"
name = "cmctl"
}

module "cmctl" {
source = "../../tflib/publisher"

name = basename(path.module)
target_repository = "${var.target_repository}-cmctl"
config = module.cmctl-config.config
build-dev = true
main_package = "cert-manager-cmctl"
}

resource "oci_tag" "latest" {
depends_on = [module.test]
digest_ref = module.cmctl.image_ref
tag = "latest"
}
7 changes: 7 additions & 0 deletions images/cert-manager/generated.tf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 22 additions & 13 deletions images/cert-manager/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

variable "target_repository" {
description = "The docker repo into which the image and attestations should be published."
}
Expand All @@ -9,7 +15,7 @@ module "versions" {

locals {
// List of all components
components = toset(["acmesolver", "controller", "cainjector", "cmctl", "webhook"])
components = toset(["acmesolver", "controller", "cainjector", "webhook"])

// Version objects with version suffix added
versions = { for k, v in module.versions.versions : k => {
Expand All @@ -25,9 +31,7 @@ locals {
is_latest = v.is_latest
suffix = v.suffix
component = c

# Package name is "cert-manager-${component}" except for cmctl
main = c == "cmctl" ? "cmctl${v.suffix}" : "cert-manager${v.suffix}-${c}"
main = "cert-manager${v.suffix}-${c}"
}
}
]...)
Expand All @@ -42,15 +46,20 @@ module "config" {
}

module "versioned" {
for_each = local.component_versions
source = "../../tflib/publisher"
name = basename(path.module)
target_repository = "${var.target_repository}-${each.value.component}"
config = module.config[each.key].config
extra_dev_packages = ["cmctl${each.value.suffix}"]
build-dev = true
main_package = each.value.main
update-repo = each.value.is_latest
for_each = local.component_versions
source = "../../tflib/publisher"
name = basename(path.module)
target_repository = "${var.target_repository}-${each.value.component}"
config = module.config[each.key].config
extra_dev_packages = [
each.value.suffix == "" ? "cmctl" : (
# If the version is greater than 1.14, use the independently versioned cmctl package
tonumber(regex("^-(\\d+\\.\\d+)$", coalesce(each.value.suffix, "-1.99"))[0]) > 1.14 ? "cmctl" : "cmctl${each.value.suffix}"
)
]
build-dev = true
main_package = each.value.main
update-repo = each.value.is_latest
}

module "test" {
Expand Down

0 comments on commit 9679b73

Please sign in to comment.