-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(app): Add optional 'name' to Source object #20470
base: master
Are you sure you want to change the base?
Conversation
❗ Preview Environment deployment failed on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
name
reference to Source object
name
reference to Source object220edee
to
b9e648b
Compare
b9e648b
to
a45c12b
Compare
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.
If this PR is ready for review, can you go ahead and fix the CI checks?
d70723f
to
f490b1d
Compare
f490b1d
to
e2650a1
Compare
bc501b0
to
ed5b9b6
Compare
01ba671
to
39b0038
Compare
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.
Good work 👍 The code changes are missing unit tests and maybe e2e too on the different commands. @ishitasequeira has more knowledge on the usage of multi-source. Do you see something that has been forgotten in this PR?
for _, r := range app.Status.Resources { | ||
statusByName[r.Name] = r.Status | ||
} | ||
// check if the app has 3 resources, guestbook and 2 pods |
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.
I think you should validate that the final source is equal to two and contains "dynamic duo" and "guestbook2" items.
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.
@CefBoud Thanks for taking this up!! Left some comments. Also, I think this change would also need to be reflected on the Application Create and AddSource UI Pages too.
@@ -381,6 +396,19 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com | |||
}) | |||
errors.CheckError(err) | |||
|
|||
if sourceName != "" && sourcePosition != -1 { |
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.
Since the Name
parameter has been added to the ApplicationSource
object, it's not exclusive to multi-source applications. This means the name
field also applies to single-source apps. Therefore, in all commands where we’re adding the sourceName
check, we should ensure the command supports single-source applications as well, using the sourceName
field.
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.
@ishitasequeira Thank you for the review.
My reasoning was that although the field is defined in ApplicationSource
, much like Ref
and the implicit source-position
, it only should be considered in the multi-source case. Additionally, the purpose of the proposal was to offer an alternative to source-position
in the multi-source case.
What are your thoughts?
@@ -435,6 +463,7 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com | |||
command.Flags().BoolVar(&hardRefresh, "hard-refresh", false, "Refresh application data as well as target manifests cache") | |||
command.Flags().StringVarP(&appNamespace, "app-namespace", "N", "", "Only get application from namespace") | |||
command.Flags().IntVar(&sourcePosition, "source-position", -1, "Position of the source from the list of sources of the app. Counting starts at 1.") | |||
command.Flags().StringVar(&sourceName, "source-name", "", "Name of the source from the list of sources of the app.") |
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.
Same here, considering Name
is not specific to a multi-source app, the description might need an update.
@@ -751,6 +753,8 @@ func ConstructSource(source *argoappv1.ApplicationSource, appOpts AppOptions, fl | |||
setPluginOptEnvs(source, appOpts.pluginEnvs) | |||
case "ref": | |||
source.Ref = appOpts.ref | |||
case "source-name": | |||
source.Name = appOpts.SourceName |
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.
We should be checking if the name is already assigned to some other source within the app.spec.sources
before allowing to set it.
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.
I added the check in validateAndNormalizeApp
to have a central validation for the both the UI and CLI API calls.
12252d8
to
0a9d9ac
Compare
Signed-off-by: cef <[email protected]>
0a9d9ac
to
1376663
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20470 +/- ##
=========================================
Coverage ? 55.09%
=========================================
Files ? 324
Lines ? 55281
Branches ? 0
=========================================
Hits ? 30457
Misses ? 22220
Partials ? 2604 ☔ View full report in Codecov by Sentry. |
Closes #17731
Description
This PR adds an optional 'name' to the Application Source object. It can be used instead of the source position in multi-source Applications CLI.
Screenshots
Checklist: