GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pipelines: never upload .func to the cluster in direct remote deploy by gauron99 · Pull Request #3897 · knative/func

pipelines: never upload .func to the cluster in direct remote deploy #3897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
knative-prow merged 1 commit into knative:main from gauron99:push-oxqxllrmvrxq
Jun 18, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

pipelines: never upload .func to the cluster in direct remote deploy #3897

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
f69563b
pipelines: never upload .func to the cluster in remote builds
gauron99 Jun 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

20 changes: 13 additions & 7 deletions 20 pkg/pipelines/tekton/pipelines_provider.go
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,17 @@ func (pp *PipelinesProvider) Run(ctx context.Context, f fn.Function) (string, fn

// Creates tar stream with the function sources as they were in "./source" directory.
func sourcesAsTarStream(f fn.Function) *io.PipeReader {
ignored := func(p string) bool { return strings.HasPrefix(p, ".git") }
if gi, err := gitignore.CompileIgnoreFile(filepath.Join(f.Root, ".gitignore")); err == nil {
ignored = func(p string) bool {
if strings.HasPrefix(p, ".git") {
return true
}
return gi.MatchesPath(p)
// Apply the same ignore policy as local builds: fn.IsIgnored always excludes
// the DefaultIgnored plus the user's .funcignore patterns. This guarantees local
// runtime data under .func — scaffolding (regenerated on-cluster by the
// func-scaffold step)
userPatterns := fn.ParseFuncIgnore(f.Root)
gi, giErr := gitignore.CompileIgnoreFile(filepath.Join(f.Root, ".gitignore"))
ignored := func(p string) bool {
if fn.IsIgnored(p, userPatterns) {
Comment thread

@twoGiants twoGiants Jun 17, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit

You can inline userPatterns here, it's not called anywhere else:

		if fn.IsIgnored(p, fn.ParseFuncIgnore(f.Root)) {

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@gauron99 gauron99 Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

that would actually re-read .funcignore file every ignored function call inside the Walk below. Its extracted so that read is only fired once

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
return true
}
return giErr == nil && gi.MatchesPath(p)
}

pr, pw := io.Pipe()
Expand Down Expand Up @@ -327,6 +330,9 @@ func sourcesAsTarStream(f fn.Function) *io.PipeReader {
}

if ignored(relp) {
if fi.IsDir() {
return filepath.SkipDir
}
return nil
}

Expand Down
48 changes: 48 additions & 0 deletions 48 pkg/pipelines/tekton/pipelines_provider_test.go
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,54 @@ func TestSourcesAsTarStream(t *testing.T) {
}
}

// TestSourcesAsTarStream_ExcludesFuncDir ensures the local runtime directory
// (.func) is never uploaded to the cluster — most importantly the credential
// file .func/local.yaml — even when the function has NO .gitignore. The
// exclusion must come from the authoritative DefaultIgnored policy, not from a
// .gitignore happening to list it. Scaffolding under .func/build is regenerated
// on-cluster by the func-scaffold step, so it is not needed in the upload.
func TestSourcesAsTarStream_ExcludesFuncDir(t *testing.T) {
root := t.TempDir()
// deliberately NO .gitignore is written
mustWrite := func(rel, content string) {
p := filepath.Join(root, filepath.FromSlash(rel))
if err := os.MkdirAll(filepath.Dir(p), 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(p, []byte(content), 0600); err != nil {
t.Fatal(err)
}
}
mustWrite("app.js", "module.exports = () => {}\n") // a normal source file
mustWrite(".func/local.yaml", "auth:\n- cluster-url: https://secret\n user:\n token: SECRET\n")
mustWrite(".func/build/service/main.py", "# scaffolding\n")
mustWrite(".func/built-image", "example.com/img@sha256:deadbeef\n")

rc := sourcesAsTarStream(fn.Function{Root: root})
t.Cleanup(func() { _ = rc.Close() })

var appFound bool
tr := tar.NewReader(rc)
for {
hdr, err := tr.Next()
if err != nil {
if errors.Is(err, io.EOF) {
break
}
t.Fatal(err)
}
if strings.HasPrefix(hdr.Name, "source/.func") {
t.Errorf(".func entry leaked into the upload stream: %q", hdr.Name)
}
if hdr.Name == "source/app.js" {
appFound = true
}
}
if !appFound {
t.Error("the app.js source file is missing from the stream")
}
}

func Test_createPipelinePersistentVolumeClaim(t *testing.T) {
type mockType func(ctx context.Context, name, namespaceOverride string, labels map[string]string, annotations map[string]string, accessMode corev1.PersistentVolumeAccessMode, resourceRequest resource.Quantity, storageClass string) (err error)

Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.