Skip to content

Commit

Permalink
feat: zarf file (#39)
Browse files Browse the repository at this point in the history
* Adding a simple zarf file and corresponding uds task for building it

* revert change to version

* pinning version of sed, removing multi-arch build assumption

* task -> cmd

* add zarf build test

* adjusting builder image base, removing pinned sed

* Adding .vscode settings and some renovate config to track zarf/uds schema versions

* updating docs

* remove unused renovate config settings
  • Loading branch information
blancharda authored Apr 2, 2024
1 parent 47651d9 commit 3cc2ee7
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

jobs:
title_check:
docker_build:
runs-on: ubuntu-latest
name: Test Docker Build
permissions:
Expand All @@ -27,6 +27,23 @@ jobs:

- name: Test building the docker image
run: uds run dev-build

zarf_build:
runs-on: ubuntu-latest
name: Test Zarf Build
permissions:
pull-requests: read
contents: read

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@fc12e3a773580020a1d63e254525eab0f8b99fc8

- name: Test building a zarf package
run: uds run build-zarf-pkg

plugin_unit_tests:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ test.cer
test.csr
test.pem
*authorized_certs*
src/extra-jars/
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"yaml.schemas": {
"https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.9.2/tasks.schema.json": [
"tasks.yaml",
"tasks/**/*.yaml",
"src/**/validate.yaml"
],
"https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.9.2/zarf.schema.json": [
"zarf.yaml"
]
},
"cSpell.words": [
"alertmanager",
"Authservice",
"automount",
"controlplane",
"crds",
"distros",
"ironbank",
"Kiali",
"Kyverno",
"MITM",
"neuvector",
"opensource",
"promtail",
"Quarkus",
"Quickstart",
"seccomp",
"Sysctls",
"Velero"
],
"cSpell.enabled": true
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This repo builds the UDS Identity (Keycloak) Config image used by UDS Identity.
| Task Name | Task Description |
|---------------------|---------------------------------------------|
| build-and-publish | Build and publish the multi-arch image |
| build-zarf-pkg | Build the image locally and package it with Zarf |
| dev-build | Build the image locally for dev |
| dev-update-image | Build the image and import locally into k3d |
| dev-theme | Copy theme to Keycloak in dev cluster |
Expand Down
10 changes: 10 additions & 0 deletions docs/CUSTOMIZE.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,13 @@ RUN mvn clean package
#### Building New Image with Updates

Once satisfied with changes and tested that they work, see [Testing custom image in UDS Core](./CUSTOMIZE.md#testing-custom-image-in-uds-core) for building, publishing, and using the new image with `uds-core`.


## Transport Custom Image with Zarf
For convenience, a Zarf package definition has been included to simplify custom image transport and install in air-gapped systems.

#### Build the Zarf package
Use the included UDS task to build the custom image and package it with Zarf:
```
uds run build-zarf-pkg
```
10 changes: 10 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,15 @@
"matchPaths": [".github/**"],
"groupName": "GHA-DEPS"
}
],
"regexManagers":[
{
"fileMatch": ["^tasks.ya?ml$", "^tasks/.*\\.ya?ml$", "^\\.vscode/settings\\.json$"],
"matchStrings": [
"https:\\/\\/raw\\.githubusercontent\\.com\\/(?<depName>[^\\/]+\\/[^\\/]+)\\/(?<currentValue>[^\\/]+)"
],
"versioningTemplate": "semver-coerced",
"datasourceTemplate": "github-tags"
}
]
}
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ COPY extra-jars/* ./target/
# Build the Java truststore from DOD CAs #
# #
###################################################################################
FROM cgr.dev/chainguard/jdk:latest-dev as truststore
FROM amazoncorretto:21-alpine-jdk as truststore
USER root
RUN apk add openssl coreutils sed bash findutils

Expand Down
6 changes: 6 additions & 0 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ tasks:
description: "Build and publish the multi-arch image"
actions:
- cmd: docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ${IMAGE_NAME}:${VERSION} src

- name: build-zarf-pkg
description: "Build the custom docker image and the zarf package for transporting it"
actions:
- cmd: docker build --tag ${IMAGE_NAME}:${VERSION} src
- cmd: ./uds zarf package create . --set IDENTITY_CONFIG_IMG=${IMAGE_NAME}:${VERSION} --confirm

- name: dev-build
description: "Build the image locally for dev"
Expand Down
15 changes: 15 additions & 0 deletions zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: ZarfPackageConfig
metadata:
name: keycloak-identity-config
version: "0.0.1"

constants:
- name: IDENTIFY_CONFIG_IMG
description: "Image name and tag (MUST BE PROVIDED -- no default)"
value: '###ZARF_PKG_TMPL_IDENTITY_CONFIG_IMG###'

components:
- name: keycloak-config-wrapper
required: true
images:
- '###ZARF_PKG_TMPL_IDENTITY_CONFIG_IMG###'

0 comments on commit 3cc2ee7

Please sign in to comment.