Add support for building the site via nix.

This commit is contained in:
Tom Alexander
2026-07-11 18:32:38 -04:00
parent feb4b2c082
commit feb9f58a86
9 changed files with 372 additions and 98 deletions

View File

@@ -44,31 +44,6 @@ spec:
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(date +%s)" | tee $(results.unix-time.path)
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: report-pending
taskRef:
resolver: git
@@ -79,8 +54,6 @@ spec:
value: f914437a46978b95f325f68d791dcf1a35738f60
- name: pathInRepo
value: task/gitea-set-status/0.1/gitea-set-status.yaml
runAfter:
- fetch-repository
params:
- name: CONTEXT
value: "$(params.JOB_NAME)"
@@ -116,6 +89,31 @@ spec:
value: $(params.PULL_BASE_SHA)
- name: deleteExisting
value: "true"
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: build-image
taskRef:
resolver: git
@@ -123,7 +121,7 @@ spec:
- name: url
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
- name: revision
value: af22c87d0db59dece97d03e6b6a796d84010158f
value: 7d4b33528fef5f2e662d32d093566ce56eb4acd0
- name: pathInRepo
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
params:
@@ -144,6 +142,8 @@ spec:
- "type=registry,ref=$(params.image-name):buildcache,mode=max,compression=zstd,compression-level=22,rewrite-timestamp=true,image-manifest=true,oci-mediatypes=true"
- --opt
- build-arg:SOURCE_DATE_EPOCH=$(tasks.get-git-commit-time.results.unix-time)
- --secret
- id=cache_token,src=/workspace/nix-cache-creds/CACHE_GET_TOKEN
- name: BUILDKITD_TOML
value: |
debug = true
@@ -157,6 +157,8 @@ spec:
workspace: git-source
- name: dockerconfig
workspace: docker-credentials
- name: nix-cache-creds
workspace: nix-cache-creds
runAfter:
- fetch-repository
finally:
@@ -221,6 +223,7 @@ spec:
workspaces:
- name: git-source
- name: docker-credentials
- name: nix-cache-creds
workspaces:
- name: git-source
volumeClaimTemplate:
@@ -235,6 +238,9 @@ spec:
- name: docker-credentials
secret:
secretName: harbor-plain
- name: nix-cache-creds
secret:
secretName: nix-pull-through-cache
params:
- name: image-name
value: "harbor.fizz.buzz/private/homepage-staging"

View File

@@ -135,7 +135,7 @@ spec:
- name: url
value: https://code.fizz.buzz/talexander/personal_tekton_catalog.git
- name: revision
value: af22c87d0db59dece97d03e6b6a796d84010158f
value: 7d4b33528fef5f2e662d32d093566ce56eb4acd0
- name: pathInRepo
value: task/buildkit-rootless-daemonless/0.1/buildkit-rootless-daemonless.yaml
params: