Skip to content

fix: write baked manifest into the workspace - #289

Merged
Suneha Bose (bosesuneha) merged 1 commit into
Azure:mainfrom
bosesuneha:fix/bake-output-into-workspace
Aug 6, 2026
Merged

fix: write baked manifest into the workspace#289
Suneha Bose (bosesuneha) merged 1 commit into
Azure:mainfrom
bosesuneha:fix/bake-output-into-workspace

Conversation

@bosesuneha

Copy link
Copy Markdown
Member

Fixes #286

Problem

k8s-deploy v7 rejects manifests that resolve outside GITHUB_WORKSPACE. Bake writes to RUNNER_TEMP, which is a sibling of the workspace on hosted runners, so the bake -> deploy chain fails and there is no way to override the location.

/home/runner/work/
├── _temp/        <- bake output
└── my-repo/
    └── my-repo/  <- GITHUB_WORKSPACE

Change

Output goes to $GITHUB_WORKSPACE/.k8s-bake/, falling back to RUNNER_TEMP with a warning when there is no workspace. A post-job step removes the manifest it generated, and the directory if that leaves it empty.

Applies to all three render engines through the shared getTemplatePath hook.

Breaking: the output location changes. Workflows reading ${{ steps.bake.outputs.manifestsBundle }} need no changes. k8s-deploy needs no changes.

Notes

Cleanup deletes only the filename the main step recorded, never a path from step state, and refuses symlinks. A pre-existing .k8s-bake directory or unrelated files in it are left alone.

Test plan

  • npm test, 119 tests
  • npm run build, tsc --noEmit, prettier --check
  • End to end with the built bundle: output lands in the workspace, RUNNER_TEMP stays empty, post step leaves the checkout clean
  • Baked output accepted by unmodified k8s-deploy v7
  • Two bake steps in one job: each removes its own manifest, last one removes the directory
  • Pre-existing .k8s-bake/user-file.txt and .k8s-bake/baked-template-123.yaml survive cleanup

Version bump and changelog follow in a separate release PR.

k8s-deploy v7 rejects manifests that resolve outside GITHUB_WORKSPACE.
Bake wrote to RUNNER_TEMP, which is a sibling of the workspace on hosted
runners, so the bake -> deploy chain no longer worked and there was no way
to override the location.

Output now goes to $GITHUB_WORKSPACE/.k8s-bake/, falling back to
RUNNER_TEMP with a warning when there is no workspace. A post-job step
removes the manifest it generated, and the directory if that leaves it
empty. Consumers reading the manifestsBundle output need no changes.
@bosesuneha
Suneha Bose (bosesuneha) requested a review from a team as a code owner August 4, 2026 02:48

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@bosesuneha
Suneha Bose (bosesuneha) merged commit 98490d0 into Azure:main Aug 6, 2026
8 checks passed
David Gamero (davidgamero) pushed a commit that referenced this pull request Aug 11, 2026
Every example pinned actions that are one to three majors behind, and two
were actively misleading:

- actions/checkout@master resolved to a branch frozen at 2020-07-13, so
  the end-to-end example shipped six-year-old checkout code. master is a
  real branch in that repo, not a redirect to main.
- Azure/k8s-deploy@v4 paired with bake output no longer reflects reality.
  Since k8s-deploy v7 confines manifests to GITHUB_WORKSPACE and bake
  v4.1.1 writes there (#289), the example should show the combination
  that actually works.

Bumped to current majors:

  azure/k8s-bake            v3      -> v4   (4 examples)
  actions/checkout          master  -> v7
  Azure/docker-login        v1      -> v2
  Azure/k8s-set-context     v3      -> v5
  Azure/k8s-create-secret   v4      -> v6
  Azure/k8s-deploy          v4      -> v7

Verified every input used in the examples still exists at the new major,
so the snippets remain runnable. k8s-set-context v5 defaults method to
kubeconfig and cluster-type to generic, so the kubeconfig-only example is
unchanged in behavior.

Also repointed the action metadata link from blob/master to blob/main.
The old URL only worked via redirect.
David Gamero (davidgamero) pushed a commit to Azure/k8s-deploy that referenced this pull request Aug 11, 2026
The bake example paired azure/k8s-bake@v3 with Azure/k8s-deploy@v7, which
cannot work. Since v7, assertPathWithinWorkspace rejects manifests that
resolve outside GITHUB_WORKSPACE, and k8s-bake before v4.1.1 wrote the
baked manifest to RUNNER_TEMP, a sibling of the workspace on hosted
runners. Copying the documented example produced:

  manifest path /home/runner/work/_temp/baked-template-<ts>.yaml resolves
  to ..., which is outside the workspace /home/runner/work/repo/repo

k8s-bake v4.1.1 writes into $GITHUB_WORKSPACE/.k8s-bake/ instead
(Azure/k8s-bake#289), so the chain works again with no change on the
k8s-deploy side. Bump the example to @v4 and state the minimum version,
since nothing in this repo currently tells users the bake upgrade is the
fix.

Refs #553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

k8s-deploy demands manifests needs to be inside workspace

2 participants