-
Notifications
You must be signed in to change notification settings - Fork 7k
feat: AppSet PR generator return 0 results upon repo not found instead of failing #23447
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.
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
reggie-k
merged 16 commits into
argoproj:master
from
reggie-k:appset-return-0-results-when-repo-not-found
Jul 2, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4593fbc
initial
reggie-k d69742a
reset
reggie-k f63e18f
Merge branch 'master' of https://github.com/argoproj/argo-cd into app…
reggie-k 56548b2
master sync
reggie-k bcf7413
analyzed http response code where applicable and added unit tests for…
reggie-k 76b2ee4
placate linter
reggie-k ba3c789
added docs for the declarative config
reggie-k a390064
resolved conflicts
reggie-k f941fe7
handle azur devops non-404 error
reggie-k 9b00f3a
upstream sync
reggie-k 456b7ab
Update applicationset/services/pull_request/azure_devops.go
reggie-k a4416df
azure devops error as const
reggie-k 96ee58d
Nitish's note in comments
reggie-k c37eee7
azuredevops err as const
reggie-k 76b7912
Merge branch 'master' of https://github.com/argoproj/argo-cd into app…
reggie-k 016a805
Update docs/operator-manual/applicationset.yaml
reggie-k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package pull_request | ||
|
|
||
| import "errors" | ||
|
|
||
| // RepositoryNotFoundError represents an error when a repository is not found by a pull request provider | ||
| type RepositoryNotFoundError struct { | ||
| causingError error | ||
| } | ||
|
|
||
| func (e *RepositoryNotFoundError) Error() string { | ||
| return e.causingError.Error() | ||
| } | ||
|
|
||
| // NewRepositoryNotFoundError creates a new repository not found error | ||
| func NewRepositoryNotFoundError(err error) error { | ||
| return &RepositoryNotFoundError{causingError: err} | ||
| } | ||
|
|
||
| // IsRepositoryNotFoundError checks if the given error is a repository not found error | ||
| func IsRepositoryNotFoundError(err error) bool { | ||
| var repoErr *RepositoryNotFoundError | ||
| return errors.As(err, &repoErr) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package pull_request | ||
|
|
||
| import ( | ||
| "errors" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestRepositoryNotFoundError(t *testing.T) { | ||
| t.Run("NewRepositoryNotFoundError creates correct error type", func(t *testing.T) { | ||
| originalErr := errors.New("repository does not exist") | ||
| repoNotFoundErr := NewRepositoryNotFoundError(originalErr) | ||
|
|
||
| require.Error(t, repoNotFoundErr) | ||
| assert.Equal(t, "repository does not exist", repoNotFoundErr.Error()) | ||
| }) | ||
|
|
||
| t.Run("IsRepositoryNotFoundError identifies RepositoryNotFoundError", func(t *testing.T) { | ||
| originalErr := errors.New("repository does not exist") | ||
| repoNotFoundErr := NewRepositoryNotFoundError(originalErr) | ||
|
|
||
| assert.True(t, IsRepositoryNotFoundError(repoNotFoundErr)) | ||
| }) | ||
|
|
||
| t.Run("IsRepositoryNotFoundError returns false for regular errors", func(t *testing.T) { | ||
| regularErr := errors.New("some other error") | ||
|
|
||
| assert.False(t, IsRepositoryNotFoundError(regularErr)) | ||
| }) | ||
|
|
||
| t.Run("IsRepositoryNotFoundError returns false for nil error", func(t *testing.T) { | ||
| assert.False(t, IsRepositoryNotFoundError(nil)) | ||
| }) | ||
|
|
||
| t.Run("IsRepositoryNotFoundError works with wrapped errors", func(t *testing.T) { | ||
| originalErr := errors.New("repository does not exist") | ||
| repoNotFoundErr := NewRepositoryNotFoundError(originalErr) | ||
| wrappedErr := errors.New("wrapped: " + repoNotFoundErr.Error()) | ||
|
|
||
| // Direct RepositoryNotFoundError should be identified | ||
| assert.True(t, IsRepositoryNotFoundError(repoNotFoundErr)) | ||
|
|
||
| // Wrapped string error should not be identified (this is expected behavior) | ||
| assert.False(t, IsRepositoryNotFoundError(wrappedErr)) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.