fix(deploy-static-site): inject NOMAD_ADDR via runner, use shared nomad/jobs var

Remove hardcoded nomad-addr input — NOMAD_ADDR is now injected by the
Forgejo runner via container.options using host.docker.internal.

Switch Nomad Variable path from static-sites/s3 to nomad/jobs so all
jobs in the namespace can read it without explicit ACL policies.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Christopher Mühl 2026-02-19 01:15:08 +01:00
parent bcca32baae
commit b7ba4c1c0a
No known key found for this signature in database
GPG key ID: 925AC7D69955293F
2 changed files with 2 additions and 7 deletions

View file

@ -2,6 +2,7 @@ name: Deploy Static Site
description: Build site with Nix, push tarball to S3, deploy via Nomad with shared static-server image description: Build site with Nix, push tarball to S3, deploy via Nomad with shared static-server image
# Required env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, NOMAD_TOKEN # Required env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, NOMAD_TOKEN
# NOMAD_ADDR is injected by the Forgejo runner via container.options
# Optional env vars: NIX_SIGNING_KEY (if set, signs and pushes Nix closure to S3 binary cache) # Optional env vars: NIX_SIGNING_KEY (if set, signs and pushes Nix closure to S3 binary cache)
inputs: inputs:
@ -14,11 +15,6 @@ inputs:
required: false required: false
default: 'default' default: 'default'
nomad-addr:
description: 'Nomad API address'
required: false
default: 'http://172.17.0.1:4646'
server-image: server-image:
description: 'OCI image for the static server' description: 'OCI image for the static server'
required: false required: false
@ -85,7 +81,6 @@ runs:
--expr "import \"${{ github.action_path }}/nomad-job.nix\"" \ --expr "import \"${{ github.action_path }}/nomad-job.nix\"" \
| nomad job run -json - | nomad job run -json -
env: env:
NOMAD_ADDR: ${{ inputs.nomad-addr }}
DOMAIN: ${{ inputs.domain }} DOMAIN: ${{ inputs.domain }}
SITE_HASH: ${{ env.SITE_HASH }} SITE_HASH: ${{ env.SITE_HASH }}
SERVER_IMAGE: ${{ env.SERVER_IMAGE_PINNED }} SERVER_IMAGE: ${{ env.SERVER_IMAGE_PINNED }}

View file

@ -14,7 +14,7 @@ let
"exec static-web-server --port 8080 --root /var/www"; "exec static-web-server --port 8080 --root /var/www";
templateData = templateData =
"{{ with nomadVar \"static-sites/s3\" }}" + "{{ with nomadVar \"nomad/jobs\" }}" +
"AWS_ACCESS_KEY_ID={{ .access_key }}\n" + "AWS_ACCESS_KEY_ID={{ .access_key }}\n" +
"AWS_SECRET_ACCESS_KEY={{ .secret_key }}\n" + "AWS_SECRET_ACCESS_KEY={{ .secret_key }}\n" +
"AWS_ENDPOINT_URL={{ .endpoint }}\n" + "AWS_ENDPOINT_URL={{ .endpoint }}\n" +