Skip to content

fix(deploy): don't write func.yaml before remote pipeline runs (#3679)#3779

Open
Sofiyan-Shaikh wants to merge 1 commit into
knative:mainfrom
Sofiyan-Shaikh:fix/3679-remote-deploy-dirty-worktree
Open

fix(deploy): don't write func.yaml before remote pipeline runs (#3679)#3779
Sofiyan-Shaikh wants to merge 1 commit into
knative:mainfrom
Sofiyan-Shaikh:fix/3679-remote-deploy-dirty-worktree

Conversation

@Sofiyan-Shaikh
Copy link
Copy Markdown

Changes

  • 🐛 Fix func deploy --remote dirtying the working tree by writing func.yaml to disk before the pipeline runs (regression from fix: write func.yaml before remote deploy upload #3663)
  • 🧹 Add Function.MarshalYAML as the single source of truth for func.yaml bytes, shared by Write and the remote source upload
  • 🧹 Inject the in-memory func.yaml (with CLI overrides applied) into the source-upload tar stream instead of pre-writing it to disk; revert the premature f.Write() in cmd/deploy.go

This restores the documented invariant that func.yaml reflects deployed
state, not last-attempt state. A failed remote deploy no longer leaves the
working tree dirty, so users can retry with different one-off flags (e.g.
--image-pull-secret) without first reverting func.yaml. Local and remote
deploys are symmetric again. The #3663 bug fix (CLI flags reaching the
on-cluster deploy step) is preserved — the in-memory function is serialized
into the upload tar stream, so the on-cluster step still sees the latest
config without touching disk until a successful deploy.

Scope is limited to the non-git, direct-PVC-upload path
(sourcesAsTarStream). The git-path flow is tracked separately in #3768.

Tests: reproduction/regression test asserting a failed remote deploy leaves
func.yaml byte-identical on disk; tar-stream tests covering in-memory
override injection (with and without an on-disk func.yaml) and no disk
mutation; rewrote the #3663 test to assert the flag reaches the pipeline
in-memory while disk stays untouched pre-pipeline.

/kind bug

Fixes #3679

Release Note

Fixed a regression where `func deploy --remote` wrote `func.yaml` to disk before the build/deploy pipeline ran, leaving the working tree dirty if the deploy failed. `func.yaml` is now only persisted after a successful deploy, consistent with local deploys.

@knative-prow knative-prow Bot added the kind/bug Bugs label May 18, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 18, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sofiyan-Shaikh
Once this PR has been reviewed and has the lgtm label, please assign matejvasek for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 18, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Sofiyan-Shaikh / name: Sofiyan-Shaikh (a5bfb4b)

@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 18, 2026 01:29
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 18, 2026

Welcome @Sofiyan-Shaikh! It looks like this is your first PR to knative/func 🎉

@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label May 18, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 18, 2026

Hi @Sofiyan-Shaikh. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label May 18, 2026
@lkingland
Copy link
Copy Markdown
Member

/ok-to-test

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels May 18, 2026
@lkingland
Copy link
Copy Markdown
Member

Thanks @Sofiyan-Shaikh! This implements Solution B from the #3679 body — exactly what we hoped for. Heads up: the CLA bot is flagging that the CLA isn't signed yet. Please sign it via the link in the bot's comment above so CI can run.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 71.66667% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.09%. Comparing base (0209813) to head (a5bfb4b).
⚠️ Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
pkg/pipelines/tekton/pipelines_provider.go 69.04% 9 Missing and 4 partials ⚠️
pkg/functions/function.go 69.23% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3779      +/-   ##
==========================================
+ Coverage   56.90%   57.09%   +0.18%     
==========================================
  Files         181      182       +1     
  Lines       20933    21418     +485     
==========================================
+ Hits        11912    12228     +316     
- Misses       7811     7954     +143     
- Partials     1210     1236      +26     
Flag Coverage Δ
e2e 35.82% <45.00%> (-0.34%) ⬇️
e2e go 31.48% <64.10%> (-1.27%) ⬇️
e2e node 27.33% <64.10%> (-1.16%) ⬇️
e2e python 31.85% <64.10%> (-1.27%) ⬇️
e2e quarkus 27.45% <64.10%> (-1.18%) ⬇️
e2e rust 26.86% <64.10%> (-1.16%) ⬇️
e2e springboot 25.39% <64.10%> (-1.11%) ⬇️
e2e typescript 27.43% <64.10%> (-1.18%) ⬇️
e2e-config-ci 28.10% <17.94%> (+10.22%) ⬆️
integration 17.28% <64.10%> (-0.15%) ⬇️
unit macos-14 45.17% <69.23%> (+0.18%) ⬆️
unit macos-latest 45.17% <69.23%> (+0.18%) ⬆️
unit ubuntu-24.04-arm 45.42% <71.66%> (+0.25%) ⬆️
unit ubuntu-latest 46.11% <69.23%> (+0.27%) ⬆️
unit windows-latest 45.21% <69.23%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

kind/bug Bugs ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote deploy dirties working tree by writing func.yaml before pipeline runs

2 participants