From 6af499f7c02233dcb55583a44bd2fd4dabb16468 Mon Sep 17 00:00:00 2001 From: Patrick Nelsen <55818910+nelsen129@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:04:04 -0700 Subject: [PATCH] Add tinkerbell --- .github/workflows/main.yml | 41 ++++++++++++++++++++++++++++++++++ libs/tinkerbell/Makefile | 27 ++++++++++++++++++++++ libs/tinkerbell/config.jsonnet | 20 +++++++++++++++++ libs/tinkerbell/crds.libsonnet | 9 ++++++++ libs/tinkerbell/version | 1 + 5 files changed, 98 insertions(+) create mode 100644 libs/tinkerbell/Makefile create mode 100644 libs/tinkerbell/config.jsonnet create mode 100644 libs/tinkerbell/crds.libsonnet create mode 100644 libs/tinkerbell/version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 745fd798..f6a15123 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3386,6 +3386,7 @@ - "tailscale-operator" - "tektoncd" - "teleport-operator" + - "tinkerbell" - "traefik" - "triggermesh" - "trust-manager" @@ -3708,6 +3709,46 @@ "SSH_KEY": "${{ secrets.DEPLOY_KEY }}" "if": "steps.filter.outputs.workflows == 'true'" "run": "make libs/teleport-operator" + "tinkerbell": + "name": "Generate tinkerbell Jsonnet library and docs" + "needs": + - "build" + - "repos" + "runs-on": "ubuntu-latest" + "steps": + - "uses": "actions/checkout@v4" + - "id": "filter" + "uses": "dorny/paths-filter@v3" + "with": + "filters": | + workflows: + - '.github/**' + - 'bin/**' + - 'Dockerfile' + - 'go.mod' + - 'go.sum' + - 'jsonnet/**' + - 'main.go' + - 'Makefile' + - 'pkg/**' + - 'scripts/**' + - 'tf/**' + - 'libs/tinkerbell/**' + - "if": "steps.filter.outputs.workflows == 'true'" + "uses": "actions/download-artifact@v4" + "with": + "name": "docker-artifact" + "path": "artifacts" + - "if": "steps.filter.outputs.workflows == 'true'" + "run": "make load" + - "env": + "DIFF": "true" + "GEN_COMMIT": "${{ github.ref == 'refs/heads/master' && github.repository == 'jsonnet-libs/k8s' }}" + "GIT_COMMITTER_EMAIL": "86770550+jsonnet-libs-bot@users.noreply.github.com" + "GIT_COMMITTER_NAME": "jsonnet-libs-bot" + "SSH_KEY": "${{ secrets.DEPLOY_KEY }}" + "if": "steps.filter.outputs.workflows == 'true'" + "run": "make libs/tinkerbell" "traefik": "name": "Generate traefik Jsonnet library and docs" "needs": diff --git a/libs/tinkerbell/Makefile b/libs/tinkerbell/Makefile new file mode 100644 index 00000000..f6d65d9f --- /dev/null +++ b/libs/tinkerbell/Makefile @@ -0,0 +1,27 @@ +ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +TMP:=$(shell mktemp -d) + +all: update-version crds.libsonnet + +.PHONY: update-version +update-version: + @NEW_VERSION=$$(gh release view --repo tinkerbell/tinkerbell --json tagName --jq '.tagName'); \ + if [ ! -f version ] || [ "$$(cat version)" != "$$NEW_VERSION" ]; then \ + echo "$$NEW_VERSION" > version; \ + echo "Updated version to $$NEW_VERSION"; \ + else \ + echo "Version unchanged: $$NEW_VERSION"; \ + fi + +crds.libsonnet: version + cd $(TMP) && \ + git clone --depth 1 --branch $(shell cat version) --filter=blob:none --sparse https://github.com/tinkerbell/tinkerbell.git && \ + cd tinkerbell && \ + git sparse-checkout set crd/bases && \ + echo '[' > $(ROOT_DIR)/crds.libsonnet && \ + cd crd/bases && \ + find . -type f -name '*.yaml' | sed 's|^\./||' | sort | xargs -I {} echo "'{}'," >> $(ROOT_DIR)/crds.libsonnet && \ + echo ']' >> $(ROOT_DIR)/crds.libsonnet && \ + jsonnetfmt -i $(ROOT_DIR)/crds.libsonnet && \ + rm -rf $(TMP) || \ + rm -rf $(TMP) diff --git a/libs/tinkerbell/config.jsonnet b/libs/tinkerbell/config.jsonnet new file mode 100644 index 00000000..98f34cd2 --- /dev/null +++ b/libs/tinkerbell/config.jsonnet @@ -0,0 +1,20 @@ +local config = import 'jsonnet/config.jsonnet'; + +// Run `make` to get the latest version and regenerate `crds.libsonnet` +local version = std.stripChars(importstr './version', ' \n'); +local crds = import './crds.libsonnet'; + +// Major.minor of the upstream tag (e.g. v0.23.0 -> 0.23) used as the output dir. +local output = std.join('.', std.split(std.lstripChars(version, 'v'), '.')[0:2]); + +config.new( + name='tinkerbell', + specs=[ + { + output: output, + prefix: '^org\\.tinkerbell\\..*', + crds: ['https://raw.githubusercontent.com/tinkerbell/tinkerbell/%s/crd/bases/%s' % [version, crd] for crd in crds], + localName: 'tinkerbell', + }, + ], +) diff --git a/libs/tinkerbell/crds.libsonnet b/libs/tinkerbell/crds.libsonnet new file mode 100644 index 00000000..d28589cd --- /dev/null +++ b/libs/tinkerbell/crds.libsonnet @@ -0,0 +1,9 @@ +[ + 'bmc.tinkerbell.org_jobs.yaml', + 'bmc.tinkerbell.org_machines.yaml', + 'bmc.tinkerbell.org_tasks.yaml', + 'tinkerbell.org_hardware.yaml', + 'tinkerbell.org_templates.yaml', + 'tinkerbell.org_workflowrulesets.yaml', + 'tinkerbell.org_workflows.yaml', +] diff --git a/libs/tinkerbell/version b/libs/tinkerbell/version new file mode 100644 index 00000000..0c2a959e --- /dev/null +++ b/libs/tinkerbell/version @@ -0,0 +1 @@ +v0.23.0