@@ -10,7 +10,7 @@ const BotCommand = "argo";
1010// supported actions, must be prefixed by BotCommand for example 'argo unlock'
1111const BotActions = Object . freeze ( { Unlock : "unlock" , Diff : "diff" , Sync : "sync" , Preview : "preview" , Info : "info" , History : "history" , Rollback : "rollback" , Help : "help" } ) ;
1212// supported diff flags
13- const BotDiffActions = Object . freeze ( { AutoSync : "--auto-sync" , All : "--all" , Dir : "--dir" , DirShort : "-d" } ) ;
13+ const BotDiffActions = Object . freeze ( { AutoSync : "--auto-sync" , All : "--all" , Dir : "--dir" , DirShort : "-d" , App : "--app" , AppShort : "-a" } ) ;
1414
1515// help string for actions
1616const diffHelp = `
@@ -20,6 +20,8 @@ supported flags:
2020--auto-sync: diffs all apps with auto sync enabled against yaml files/helm charts on current branch
2121--dir [dir name] or -d [dir name]: diffs all yaml files/helm charts in a specific directory against what's deployed in GKE
2222 will look in subdirectories i.e 'argo diff -d /abc' will also check attempt to diff all deployments in 'abc' dir
23+ --app [app name] or -a [app name]: diffs all yaml manifests/helm charts for a specific app against what's deployed in GKE
24+ will look in subdirectories where argo app is deployed i.e 'argo app diff -a app1' will diff against git repo where app1 manifests reside
2325--all: diffs all apps on current branch against what's deployed in GKE (default behavior)` ;
2426
2527const BotHelp = Object . freeze ( { Diff : diffHelp ,
@@ -162,6 +164,11 @@ export class ArgoBot {
162164 this . appContext . log ( "Received diff command with" + BotDiffActions . Dir ) ;
163165 jsonResponse = await this . argoAPI . fetchAppsWithDirectory ( arr [ 3 ] ) ;
164166 return await this . handleDiff ( jsonResponse ) ;
167+ } else if ( arr [ 2 ] && ( arr [ 2 ] === BotDiffActions . App || arr [ 2 ] === BotDiffActions . AppShort ) && arr [ 3 ] ) {
168+ this . appContext . log ( "Received diff command with" + BotDiffActions . App ) ;
169+ const appDir = await this . argoAPI . fetchDirForAppWithName ( arr [ 3 ] ) ;
170+ jsonResponse = { items : [ { metadata : { name : arr [ 3 ] } , spec : { source : { path : appDir } } } ] } ;
171+ return await this . handleDiff ( jsonResponse ) ;
165172 } else if ( arr [ 2 ] ) {
166173 // if arr[2] is not empty, then it's not a valid diff arg, notify user
167174 this . appContext . log ( "Received unsupported diff command" ) ;
0 commit comments