Skip to content

Commit

Permalink
Revert "update argocd app history command to print group by source"
Browse files Browse the repository at this point in the history
This reverts commit abe7889.
  • Loading branch information
Mangaal committed Mar 13, 2024
1 parent e870d83 commit 6faf3c7
Showing 1 changed file with 5 additions and 37 deletions.
42 changes: 5 additions & 37 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2463,45 +2463,13 @@ func printApplicationHistoryIds(revHistory []argoappv1.RevisionHistory) {
// Print a history table for an application.
func printApplicationHistoryTable(revHistory []argoappv1.RevisionHistory) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
type history struct {
id int64
date string
revision string
}
varHistory := map[string][]history{}
_, _ = fmt.Fprintf(w, "ID\tDATE\tREVISION\n")
for _, depInfo := range revHistory {
if depInfo.Source.RepoURL != "" {
rev := depInfo.Source.TargetRevision
if len(depInfo.Revision) >= 7 {
rev = fmt.Sprintf("%s (%s)", rev, depInfo.Revision[0:7])
}
varHistory[depInfo.Source.RepoURL] = append(varHistory[depInfo.Source.RepoURL], history{
id: depInfo.ID,
date: fmt.Sprintf("%s", depInfo.DeployedAt),
revision: rev,
})
}
if depInfo.Sources != nil {
for i, sourceInfo := range depInfo.Sources {
rev := sourceInfo.TargetRevision
if len(depInfo.Revisions[i]) >= 7 {
rev = fmt.Sprintf("%s (%s)", rev, depInfo.Revisions[i][0:7])
}
varHistory[sourceInfo.RepoURL] = append(varHistory[sourceInfo.RepoURL], history{
id: depInfo.ID,
date: fmt.Sprintf("%s", depInfo.DeployedAt),
revision: rev,
})
}
}
}
for source, historyEntries := range varHistory {
_, _ = fmt.Fprintf(w, "SOURCE\t%s\n", source)
_, _ = fmt.Fprintf(w, "ID\tDATE\tREVISION\n")
for _, history := range historyEntries {
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", history.id, history.date, history.revision)
rev := depInfo.Source.TargetRevision
if len(depInfo.Revision) >= 7 {
rev = fmt.Sprintf("%s (%s)", rev, depInfo.Revision[0:7])
}
_, _ = fmt.Fprintf(w, "\n")
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", depInfo.ID, depInfo.DeployedAt, rev)
}
_ = w.Flush()
}
Expand Down

0 comments on commit 6faf3c7

Please sign in to comment.