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

new image: gomplate #2936

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
38 changes: 38 additions & 0 deletions images/gomplate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--monopod:start-->
# gomplate
| | |
| - | - |
| **OCI Reference** | `cgr.dev/chainguard/gomplate` |


* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/gomplate/overview/)
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags.
* [Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.*

---
<!--monopod:end-->

<!--overview:start-->
Minimalist Wolfi-based gomplate image for template rendering.
<!--overview:end-->

<!--getting:start-->
## Download this Image
The image is available on `cgr.dev`:

```
docker pull cgr.dev/chainguard/gomplate:latest
```
<!--getting:end-->

<!--body:start-->
## Usage

Example usage

```
$ docker run --rm cgr.dev/chainguard/gomplate:latest -i 'the answer is: {{ mul 6 7 }}'
the answer is: 42
```

<!--body:end-->
19 changes: 19 additions & 0 deletions images/gomplate/config/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_providers {
apko = { source = "chainguard-dev/apko" }
}
}

variable "extra_packages" {
description = "The additional packages to install (e.g. gomplate)."
default = ["gomplate"]
}

data "apko_config" "this" {
config_contents = file("${path.module}/template.apko.yaml")
extra_packages = var.extra_packages
}

output "config" {
value = jsonencode(data.apko_config.this.config)
}
20 changes: 20 additions & 0 deletions images/gomplate/config/template.apko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
contents:
repositories:
- https://packages.wolfi.dev/os
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
packages:
- gomplate

accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 65532

entrypoint:
command: /usr/bin/gomplate
38 changes: 38 additions & 0 deletions images/gomplate/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

# Define any variables or resources related to the Gomplate image below

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

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

module "latest" {
source = "../../tflib/publisher"
name = basename(path.module)
target_repository = var.target_repository
config = module.latest-config.config
build-dev = true
}

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

resource "oci_tag" "latest" {
depends_on = [module.test-latest]
digest_ref = module.latest.image_ref
tag = "latest"
}

resource "oci_tag" "latest-dev" {
depends_on = [module.test-latest]
digest_ref = module.latest.dev_ref
tag = "latest-dev"
}
12 changes: 12 additions & 0 deletions images/gomplate/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: gomplate
image: cgr.dev/chainguard/gomplate
logo: https://storage.googleapis.com/chainguard-academy/logos/gomplate.svg
endoflife: ""
console_summary: ""
short_description: Minimalist Wolfi-based gomplate image for template rendering.
compatibility_notes: ""
readme_file: README.md
upstream_url: https://github.com/hairyhenderson/gomplate
keywords:
- application
- tools
5 changes: 5 additions & 0 deletions images/gomplate/tests/01-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o errtrace -o pipefail -x

docker run --rm "${IMAGE_NAME}" -i 'the answer is: {{ mul 6 7 }}'
14 changes: 14 additions & 0 deletions images/gomplate/tests/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

variable "digest" {
description = "The image digest to run tests over."
}

data "oci_exec_test" "template" {
digest = var.digest
script = "${path.module}/01-template.sh"
}
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ module "calico" {
target_repository = "${var.target_repository}/calico"
}

module "gomplate" {
source = "./images/gomplate"
target_repository = "${var.target_repository}/gomplate"
}

module "git" {
source = "./images/git"
target_repository = "${var.target_repository}/git"
Expand Down