Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ concurrency:

jobs:
lint-and-build:
# Template-only. Every repo generated from this template receives this
# workflow verbatim (the platform force-pushes template branches), and
# running the full web lint+build in each of them burned self-hosted
# runners without gating anything a Work owner acts on. Gated rather than
# deleted so the template keeps its own CI and a sync can never "restore"
# a version that runs everywhere. Instance default branches are
# unprotected, so a skipped job cannot leave a required check pending.
if: github.repository == 'ever-works/directory-web-template'
name: Lint and Build Web
runs-on: ${{ vars.RUNNER_LINUX_X64_4 || 'ubuntu-latest' }}

Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/k8s-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ jobs:
strategy:
fail-fast: false
matrix:
# REPO-AGNOSTIC on purpose. `suffix` (not a literal image name) is what
# keeps this file correct after the platform force-pushes it verbatim
# into every Work repo — the image is always the repo's OWN package,
# which is the only one that repo's GITHUB_TOKEN can write.
include:
- image: directory-web-template
- suffix: ''
dockerfile: Dockerfile
context: .
- image: directory-web-template-docs
- suffix: '-docs'
dockerfile: apps/docs/Dockerfile
context: .
steps:
Expand All @@ -38,13 +42,24 @@ jobs:
main|master) echo "tag=prod" >> "$GITHUB_OUTPUT" ;;
*) echo "tag=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT" ;;
esac
# Not every repo generated from this template carries apps/docs, so the
# `-docs` matrix leg must skip cleanly rather than fail the workflow.
- id: present
run: |
if [ -f "${{ matrix.dockerfile }}" ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "found=false" >> "$GITHUB_OUTPUT"
echo "No ${{ matrix.dockerfile }} in this repo — skipping this image."
fi
- uses: docker/build-push-action@v7
if: steps.present.outputs.found == 'true'
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ steps.t.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:sha-${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:buildcache,mode=max
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}${{ matrix.suffix }}:${{ steps.t.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}${{ matrix.suffix }}:sha-${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}${{ matrix.suffix }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}${{ matrix.suffix }}:buildcache,mode=max
Comment on lines +62 to +65

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Repository casing breaks GHCR references

The image tags and registry cache references interpolate github.repository_owner and github.event.repository.name without normalization. A generated repository whose owner or name includes uppercase characters produces invalid ghcr.io/... repository references, so the build cannot publish its images or use its registry cache. Lowercase these components once and use the normalized value consistently for tags, cache-from, and cache-to.

Artifacts

Focused GHCR uppercase-reference validation source

  • The executed Go source reconstructs the workflow’s two tag and shared cache-reference templates, then validates them with the Docker Distribution reference parser; it demonstrates the exact focused check.

Uppercase GHCR workflow references rejected

  • Captured output of the executed original-template run with uppercase owner and repository values; all image and cache references are rejected because the repository name must be lowercase.

Lowercased GHCR workflow references accepted

  • Captured output of the executed comparison run after lowercasing the owner and repository values; all equivalent image and cache references are accepted, confirming normalization resolves the failure.

View artifacts

T-Rex Ran code and verified through T-Rex

Loading