Skip to content

Commit 2186e6d

Browse files
authored
Add tinkerbell (#649)
1 parent 799e06c commit 2186e6d

5 files changed

Lines changed: 98 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,6 +3386,7 @@
33863386
- "tailscale-operator"
33873387
- "tektoncd"
33883388
- "teleport-operator"
3389+
- "tinkerbell"
33893390
- "traefik"
33903391
- "triggermesh"
33913392
- "trust-manager"
@@ -3708,6 +3709,46 @@
37083709
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
37093710
"if": "steps.filter.outputs.workflows == 'true'"
37103711
"run": "make libs/teleport-operator"
3712+
"tinkerbell":
3713+
"name": "Generate tinkerbell Jsonnet library and docs"
3714+
"needs":
3715+
- "build"
3716+
- "repos"
3717+
"runs-on": "ubuntu-latest"
3718+
"steps":
3719+
- "uses": "actions/checkout@v4"
3720+
- "id": "filter"
3721+
"uses": "dorny/paths-filter@v3"
3722+
"with":
3723+
"filters": |
3724+
workflows:
3725+
- '.github/**'
3726+
- 'bin/**'
3727+
- 'Dockerfile'
3728+
- 'go.mod'
3729+
- 'go.sum'
3730+
- 'jsonnet/**'
3731+
- 'main.go'
3732+
- 'Makefile'
3733+
- 'pkg/**'
3734+
- 'scripts/**'
3735+
- 'tf/**'
3736+
- 'libs/tinkerbell/**'
3737+
- "if": "steps.filter.outputs.workflows == 'true'"
3738+
"uses": "actions/download-artifact@v4"
3739+
"with":
3740+
"name": "docker-artifact"
3741+
"path": "artifacts"
3742+
- "if": "steps.filter.outputs.workflows == 'true'"
3743+
"run": "make load"
3744+
- "env":
3745+
"DIFF": "true"
3746+
"GEN_COMMIT": "${{ github.ref == 'refs/heads/master' && github.repository == 'jsonnet-libs/k8s' }}"
3747+
"GIT_COMMITTER_EMAIL": "86770550+jsonnet-libs-bot@users.noreply.github.com"
3748+
"GIT_COMMITTER_NAME": "jsonnet-libs-bot"
3749+
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
3750+
"if": "steps.filter.outputs.workflows == 'true'"
3751+
"run": "make libs/tinkerbell"
37113752
"traefik":
37123753
"name": "Generate traefik Jsonnet library and docs"
37133754
"needs":

libs/tinkerbell/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2+
TMP:=$(shell mktemp -d)
3+
4+
all: update-version crds.libsonnet
5+
6+
.PHONY: update-version
7+
update-version:
8+
@NEW_VERSION=$$(gh release view --repo tinkerbell/tinkerbell --json tagName --jq '.tagName'); \
9+
if [ ! -f version ] || [ "$$(cat version)" != "$$NEW_VERSION" ]; then \
10+
echo "$$NEW_VERSION" > version; \
11+
echo "Updated version to $$NEW_VERSION"; \
12+
else \
13+
echo "Version unchanged: $$NEW_VERSION"; \
14+
fi
15+
16+
crds.libsonnet: version
17+
cd $(TMP) && \
18+
git clone --depth 1 --branch $(shell cat version) --filter=blob:none --sparse https://github.com/tinkerbell/tinkerbell.git && \
19+
cd tinkerbell && \
20+
git sparse-checkout set crd/bases && \
21+
echo '[' > $(ROOT_DIR)/crds.libsonnet && \
22+
cd crd/bases && \
23+
find . -type f -name '*.yaml' | sed 's|^\./||' | sort | xargs -I {} echo "'{}'," >> $(ROOT_DIR)/crds.libsonnet && \
24+
echo ']' >> $(ROOT_DIR)/crds.libsonnet && \
25+
jsonnetfmt -i $(ROOT_DIR)/crds.libsonnet && \
26+
rm -rf $(TMP) || \
27+
rm -rf $(TMP)

libs/tinkerbell/config.jsonnet

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local config = import 'jsonnet/config.jsonnet';
2+
3+
// Run `make` to get the latest version and regenerate `crds.libsonnet`
4+
local version = std.stripChars(importstr './version', ' \n');
5+
local crds = import './crds.libsonnet';
6+
7+
// Major.minor of the upstream tag (e.g. v0.23.0 -> 0.23) used as the output dir.
8+
local output = std.join('.', std.split(std.lstripChars(version, 'v'), '.')[0:2]);
9+
10+
config.new(
11+
name='tinkerbell',
12+
specs=[
13+
{
14+
output: output,
15+
prefix: '^org\\.tinkerbell\\..*',
16+
crds: ['https://raw.githubusercontent.com/tinkerbell/tinkerbell/%s/crd/bases/%s' % [version, crd] for crd in crds],
17+
localName: 'tinkerbell',
18+
},
19+
],
20+
)

libs/tinkerbell/crds.libsonnet

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
'bmc.tinkerbell.org_jobs.yaml',
3+
'bmc.tinkerbell.org_machines.yaml',
4+
'bmc.tinkerbell.org_tasks.yaml',
5+
'tinkerbell.org_hardware.yaml',
6+
'tinkerbell.org_templates.yaml',
7+
'tinkerbell.org_workflowrulesets.yaml',
8+
'tinkerbell.org_workflows.yaml',
9+
]

libs/tinkerbell/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.23.0

0 commit comments

Comments
 (0)