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

use apko_build for the sandbox image #2562

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions images/tekton/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ resource "imagetest_feature" "basic" {

steps = [
{
name = "Install Tekton"
cmd = "/tests/test.sh"
name = "Install Tekton"
cmd = "/tests/test.sh"
retry = { attempts = 5, delay = "10s" }
},
{
name = "Wait for Tekton"
Expand Down
15 changes: 14 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ terraform {
backend "inmem" {}
}

provider "imagetest" {}
provider "imagetest" {
harnesses = {
k3s = {
sandbox = {
image = module.imagetest_k3s_sandbox_image.image_ref
}
}
}
}

module "imagetest_k3s_sandbox_image" {
source = "./tflib/imagetest/k3s-sandbox-image"
target_repository = "${var.target_repository}/imagetest"
}

variable "target_repository" {
type = string
Expand Down
38 changes: 38 additions & 0 deletions tflib/imagetest/k3s-sandbox-image/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
terraform {
required_providers {
apko = { source = "chainguard-dev/apko" }
oci = { source = "chainguard-dev/oci" }
}
}

variable "target_repository" {}

data "apko_config" "this" {
extra_packages = [
"apk-tools",
"busybox",
"bash",
"curl",
"helm",
"k9s",
"kubectl",
"kustomize",
]
config_contents = jsonencode({
accounts = {
"run-as" : 0
}
entrypoint = {
command = "tail -f /dev/null"
}
})
}

resource "apko_build" "this" {
repo = var.target_repository
config = data.apko_config.this.config
}

output "image_ref" {
value = apko_build.this.image_ref
}
Loading