Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0db26d7
OCPBUGS-78787: fix(operator-controller): clean up orphaned temp dirs …
tmshort Mar 20, 2026
5b9e0e6
:seedling: Bump platformdirs from 4.9.2 to 4.9.4 (#2584)
dependabot[bot] Mar 20, 2026
a307a6d
:seedling: Bump charset-normalizer from 3.4.4 to 3.4.5 (#2583)
dependabot[bot] Mar 20, 2026
efd1ca3
Merge branch 'main' into synchronize
Mar 23, 2026
6634a96
UPSTREAM: <carry>: Add OpenShift specific files
dtfranz Oct 26, 2023
82d4bb8
UPSTREAM: <carry>: Add new tests for single/own namespaces install modes
camilamacedo86 Oct 6, 2025
48a85af
UPSTREAM: <carry>: Upgrade OCP image from 4.20 to 4.21
camilamacedo86 Oct 13, 2025
7187403
UPSTREAM: <carry>: [Default Catalog Tests] - Change logic to get ocp …
camilamacedo86 Oct 13, 2025
ec76c0b
UPSTREAM: <carry>: Update OCP catalogs to v4.21
tmshort Oct 13, 2025
41c9f4a
UPSTREAM: <carry>: support singleown cases in disconnected
kuiwang02 Oct 16, 2025
a05f994
UPSTREAM: <carry>: fix cases 81696 and 74618 for product code changes
kuiwang02 Oct 17, 2025
a131a78
UPSTREAM: <carry>: Define Default timeouts and apply their usage accr…
camilamacedo86 Oct 22, 2025
5e52455
UPSTREAM: <carry>: Update to new feature-gate options in helm
tmshort Oct 22, 2025
6cfdda4
UPSTREAM: <carry>: Fix flake for single/own ns tests by ensuring uniq…
camilamacedo86 Oct 22, 2025
700afab
UPSTREAM: <carry>: [OTE]: Enhance single/own ns based on review comme…
camilamacedo86 Oct 24, 2025
903490a
UPSTREAM: <carry>: Update OwnSingle template to use spec.config.inlin…
kuiwang02 Nov 3, 2025
cb83824
UPSTREAM: <carry>: [OTE]: Add webhook cleanup validation on extension…
camilamacedo86 Nov 4, 2025
d19bc91
UPSTREAM: <carry>: Add [OTP] to migrated cases
kuiwang02 Nov 7, 2025
4035f5d
UPSTREAM: <carry>: [OTE]: Upgrade dependencies used
camilamacedo86 Nov 5, 2025
a648858
UPSTREAM: <carry>: fix(OTE): fix OpenShift Kubernetes replace version…
camilamacedo86 Nov 10, 2025
7499dd3
UPSTREAM: <carry>: [Default Catalog Tests] Upgrade go 1.24.6 and depe…
camilamacedo86 Nov 11, 2025
d549256
UPSTREAM: <carry>: add disconnected environment support with custom p…
kuiwang02 Nov 12, 2025
1371c3e
UPSTREAM: <carry>: migrate jiazha test cases to OTE
jianzhangbjz Nov 14, 2025
09243e9
UPSTREAM: <carry>: migrate clustercatalog case to ote
Xia-Zhao-rh Oct 17, 2025
f236f81
UPSTREAM: <carry>: migrate olmv1 QE stress cases
kuiwang02 Nov 20, 2025
de0e401
UPSTREAM: <carry>: Use busybox/httpd to simulate probes
tmshort Nov 25, 2025
c4d6d2d
UPSTREAM: <carry>: migrate olmv1 QE cases
Xia-Zhao-rh Nov 25, 2025
58aacf6
UPSTREAM: <carry>: add agent for olmv1 qe cases
kuiwang02 Oct 21, 2025
8141f93
UPSTREAM: <carry>: Disable upstream PodDisruptionBudget
tmshort Dec 3, 2025
e1e77b6
UPSTREAM: <carry>: Add AGENTS.md for AI code contributions
rashmigottipati Dec 11, 2025
29fa979
UPSTREAM: <carry>: address review comments through addl prompts
rashmigottipati Dec 11, 2025
23da569
UPSTREAM: <carry>: addressing some more review comments
rashmigottipati Dec 11, 2025
4e4dc36
UPSTREAM: <carry>: remove DCO line
rashmigottipati Dec 11, 2025
c747c9d
UPSTREAM: <carry>: migrate bandrade test cases to OTE
bandrade Nov 18, 2025
28cf1d9
UPSTREAM: <carry>: update metadata
bandrade Dec 3, 2025
26897c8
UPSTREAM: <carry>: remove originalName
bandrade Dec 3, 2025
422ffdd
UPSTREAM: <carry>: update 80458's timeout to 180s
jianzhangbjz Dec 8, 2025
2de2ee0
UPSTREAM: <carry>: update 83026 to specify the clustercatalog
jianzhangbjz Dec 15, 2025
45fa47e
UPSTREAM: <carry>: Update to golang 1.25 and ocp 4.22
oceanc80 Dec 18, 2025
bed5db2
UPSTREAM: <carry>: Use oc client for running e2e tests
pedjak Jan 13, 2026
753668b
UPSTREAM: <carry>: Run upstream e2e tests tagged with `@catalogd-update`
pedjak Jan 14, 2026
bb75d2e
UPSTREAM: <carry>: enhance case to make it more stable
kuiwang02 Jan 6, 2026
2f8638b
UPSTREAM: <carry>: add service account to curl job
ehearne-redhat Jan 7, 2026
99ffef0
UPSTREAM: <carry>: move sa creation out of buildCurlJob()
ehearne-redhat Jan 8, 2026
4dcd1c0
UPSTREAM: <carry>: comment out delete service account
ehearne-redhat Jan 9, 2026
71d88e2
UPSTREAM: <carry>: move defercleanup for sa for LIFO
ehearne-redhat Jan 9, 2026
14c3609
UPSTREAM: <carry>: add polling so job fully deleted before proceed
ehearne-redhat Jan 12, 2026
3742cde
UPSTREAM: <carry>: Revert "Merge pull request #594 from ehearne-redha…
sosiouxme Jan 20, 2026
4e29c56
UPSTREAM: <carry>: Remove openshift-redhat-marketplace catalog tests
camilamacedo86 Jan 8, 2026
041bb8d
UPSTREAM: <carry>: config watchnamespace cases
kuiwang02 Jan 6, 2026
b29dc08
UPSTREAM: <carry>: enhance ocp-79770
Xia-Zhao-rh Jan 26, 2026
352f877
UPSTREAM: <carry>: upgrade version support case
kuiwang02 Jan 28, 2026
93b8739
UPSTREAM: <carry>: Remove installed condition check from auth preflig…
Jan 30, 2026
a780239
UPSTREAM: <carry>: Add openshift/api dependency
Jan 30, 2026
96cff6d
UPSTREAM: <carry>: Add boxcutter specific preflight auth test
Jan 30, 2026
cbd1a44
UPSTREAM: <carry>: adjust watchnamespace case based on change
kuiwang02 Feb 2, 2026
46427e1
UPSTREAM: <carry>: fix(ote): Use as operator-controller dep from root…
camilamacedo86 Feb 3, 2026
c80587b
UPSTREAM: <carry>: add 83979 automation
bandrade Feb 2, 2026
6c137b8
UPSTREAM: <carry>: add 85889 automation
bandrade Feb 2, 2026
d674d70
UPSTREAM: <carry>: Update test-operator startup script to fix pod pro…
Feb 4, 2026
64e51f2
UPSTREAM: <carry>: Fix up own-namespace invalid configuration test
Feb 7, 2026
8e1794e
UPSTREAM: <carry>: Preflight tests use in-cluster catalog and bundles…
camilamacedo86 Feb 24, 2026
cae9a48
UPSTREAM: <carry>: adjust sa and permission test cases per new change…
kuiwang02 Feb 2, 2026
37b43d6
UPSTREAM: <carry>: Update OCP catalogs to v4.22
camilamacedo86 Feb 3, 2026
47d26fe
UPSTREAM: <carry>: chore(OTE and Default Catalog Tests) Update go and…
camilamacedo86 Feb 26, 2026
445f523
UPSTREAM: <carry>: fix 83026 for TP cluster
jianzhangbjz Feb 28, 2026
4b11f99
UPSTREAM: <carry>: serviceAccount validation unified across all runtimes
kuiwang02 Mar 6, 2026
edc7422
UPSTREAM: <carry>: Fix OLMv1 test operator to listen on IPv6
stbenjam Mar 6, 2026
18c0606
UPSTREAM: <carry>: Increase install timeout and add diagnostic loggin…
camilamacedo86 Mar 11, 2026
880b373
UPSTREAM: <carry>: add service account to curl job
ehearne-redhat Mar 2, 2026
22930be
UPSTREAM: <carry>: update OCP-75441 to support multi-arch
jianzhangbjz Mar 19, 2026
a430946
UPSTREAM: <carry>: deployment config cases
kuiwang02 Feb 6, 2026
2e62cb6
UPSTREAM: <drop>: go mod vendor
Mar 23, 2026
8125b3d
UPSTREAM: <drop>: remove upstream GitHub configuration
Mar 23, 2026
c4285a5
UPSTREAM: <drop>: configure the commit-checker
Mar 23, 2026
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
2 changes: 1 addition & 1 deletion commitchecker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
expectedMergeBase: dd1c319eded29d55bad6eb39a741f88ca53329df
expectedMergeBase: a307a6daf5c5b1bd78c75e0ed02aeaf5c7f9d94d
upstreamBranch: main
upstreamOrg: operator-framework
upstreamRepo: operator-controller
29 changes: 29 additions & 0 deletions internal/operator-controller/catalogmetadata/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/fs"
"os"
"path/filepath"
"strings"
"sync"

"github.com/operator-framework/operator-registry/alpha/declcfg"
Expand Down Expand Up @@ -75,10 +76,15 @@ func (fsc *filesystemCache) Put(catalogName, resolvedRef string, source io.Reade
func (fsc *filesystemCache) writeFS(catalogName string, source io.Reader) (fs.FS, error) {
cacheDir := fsc.cacheDir(catalogName)

if err := fsc.removeOrphanedTempDirs(catalogName); err != nil {
return nil, err
}

tmpDir, err := os.MkdirTemp(fsc.cachePath, fmt.Sprintf(".%s-", catalogName))
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Mar 23, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Prefix matching can remove another catalog’s temp dirs

The ".%s-" naming + HasPrefix cleanup is ambiguous for catalog names that share prefixes (example: foo matches .foo-bar-*). This can delete temp dirs belonging to a different catalog and cause cross-catalog interference.

Proposed fix
+func tempDirPrefix(catalogName string) string {
+	return fmt.Sprintf(".%d_%s-", len(catalogName), catalogName)
+}
+
 func (fsc *filesystemCache) writeFS(catalogName string, source io.Reader) (fs.FS, error) {
 	cacheDir := fsc.cacheDir(catalogName)
@@
-	tmpDir, err := os.MkdirTemp(fsc.cachePath, fmt.Sprintf(".%s-", catalogName))
+	tmpDir, err := os.MkdirTemp(fsc.cachePath, tempDirPrefix(catalogName))
@@
 func (fsc *filesystemCache) removeOrphanedTempDirs(catalogName string) error {
@@
-	prefix := fmt.Sprintf(".%s-", catalogName)
+	prefix := tempDirPrefix(catalogName)
 	for _, entry := range entries {
 		if strings.HasPrefix(entry.Name(), prefix) {
 			if err := os.RemoveAll(filepath.Join(fsc.cachePath, entry.Name())); err != nil {

Also applies to: 186-189

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.

Ignoring

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@tmshort, understood. I'll note this for future reference.

(ㅠ﹏ㅠ)


📝 Learnings were identified and not saved (knowledge base disabled). Enable

if err != nil {
return nil, fmt.Errorf("error creating temporary directory to unpack catalog metadata: %v", err)
}
defer os.RemoveAll(tmpDir)

if err := declcfg.WalkMetasReader(source, func(meta *declcfg.Meta, err error) error {
if err != nil {
Expand Down Expand Up @@ -164,3 +170,26 @@ func (fsc *filesystemCache) Remove(catalogName string) error {
func (fsc *filesystemCache) cacheDir(catalogName string) string {
return filepath.Join(fsc.cachePath, catalogName)
}

// removeOrphanedTempDirs removes temporary staging directories left behind by a
// previous writeFS call for the given catalog that was interrupted before the
// rename (e.g. pod eviction or crash). Temp dirs use the prefix ".{catalogName}-"
// as created by os.MkdirTemp. This method must be called while the write lock is held.
func (fsc *filesystemCache) removeOrphanedTempDirs(catalogName string) error {
entries, err := os.ReadDir(fsc.cachePath)
if os.IsNotExist(err) {
return nil
}
if err != nil {
return fmt.Errorf("error reading cache directory: %w", err)
}
prefix := fmt.Sprintf(".%s-", catalogName)
for _, entry := range entries {
if strings.HasPrefix(entry.Name(), prefix) {
if err := os.RemoveAll(filepath.Join(fsc.cachePath, entry.Name())); err != nil {
return fmt.Errorf("error removing orphaned temp directory %q: %w", entry.Name(), err)
}
}
}
return nil
}
24 changes: 24 additions & 0 deletions internal/operator-controller/catalogmetadata/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,30 @@ func TestFilesystemCacheRemove(t *testing.T) {
assert.NoDirExists(t, catalogCachePath)
}

func TestFilesystemCachePutCleansOrphanedTempDirs(t *testing.T) {
const catalogName = "test-catalog"
cacheDir := t.TempDir()
c := cache.NewFilesystemCache(cacheDir)

// Simulate temp dirs left behind by a previous interrupted Put for this catalog.
orphan1 := filepath.Join(cacheDir, ".test-catalog-1234567890")
orphan2 := filepath.Join(cacheDir, ".test-catalog-9876543210")
require.NoError(t, os.MkdirAll(orphan1, 0700))
require.NoError(t, os.MkdirAll(orphan2, 0700))

// A temp dir for a different catalog should NOT be removed.
otherOrphan := filepath.Join(cacheDir, ".other-catalog-1111111111")
require.NoError(t, os.MkdirAll(otherOrphan, 0700))

_, err := c.Put(catalogName, "fake/catalog@sha256:fakesha", defaultContent(), nil)
require.NoError(t, err)

assert.NoDirExists(t, orphan1, "orphaned temp dir for catalog should have been removed")
assert.NoDirExists(t, orphan2, "orphaned temp dir for catalog should have been removed")
assert.DirExists(t, otherOrphan, "temp dir for a different catalog should not be removed")
assert.DirExists(t, filepath.Join(cacheDir, catalogName), "real cache dir should exist")
}

func equalFilesystems(expected, actual fs.FS) error {
normalizeJSON := func(data []byte) []byte {
var v interface{}
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Babel==2.18.0
beautifulsoup4==4.14.3
certifi==2026.2.25
charset-normalizer==3.4.4
charset-normalizer==3.4.5
click==8.3.1
colorama==0.4.6
cssselect==1.4.0
Expand All @@ -19,7 +19,7 @@ mkdocs-material-extensions==1.3.1
packaging==26.0
paginate==0.5.7
pathspec==1.0.4
platformdirs==4.9.2
platformdirs==4.9.4
Pygments==2.19.2
pymdown-extensions==10.21
pyquery==2.0.1
Expand Down