Skip to content

Commit

Permalink
refactor wolfi-base to config format (#1669)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh authored Oct 18, 2023
1 parent 27eb421 commit bf86e68
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 30 deletions.
20 changes: 20 additions & 0 deletions images/wolfi-base/config/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "extra_packages" {
description = "Additional packages to install."
type = list(string)
default = ["wolfi-base"]
}

module "accts" {
source = "../../../tflib/accts"
run-as = 0
}

output "config" {
value = jsonencode({
contents = {
packages = var.extra_packages
}
accounts = module.accts.block
cmd = "/bin/sh -l"
})
}
14 changes: 0 additions & 14 deletions images/wolfi-base/configs/latest.apko.yaml

This file was deleted.

29 changes: 14 additions & 15 deletions images/wolfi-base/main.tf
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

variable "target_repository" {
description = "The docker repo into which the image and attestations should be published."
}

module "config" {
source = "./config"
}

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

name = basename(path.module)

target_repository = var.target_repository
config = file("${path.module}/configs/latest.apko.yaml")
}

module "version-tags" {
source = "../../tflib/version-tags"
package = "wolfi-base"
config = module.latest.config
config = module.config.config
}

module "test-latest" {
source = "./tests"
digest = module.latest.image_ref
}

module "tagger" {
source = "../../tflib/tagger"

depends_on = [module.test-latest]

tags = merge(
{ for t in toset(concat(["latest"], module.version-tags.tag_list)) : t => module.latest.image_ref },
)
resource "oci_tag" "latest" {
digest_ref = module.latest.image_ref
tag = "latest"
}
2 changes: 1 addition & 1 deletion images/wolfi-base/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ variable "digest" {

data "oci_exec_test" "runs" {
digest = var.digest
script = "${path.module}/01-runs.sh"
script = "${path.module}/runs.sh"
}
File renamed without changes.

0 comments on commit bf86e68

Please sign in to comment.