mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-22 15:41:47 +00:00
Display proper revision for sources
Includes a change to an empty revision string if the reconciler has not produced an artifact yet, as this will otherwise result in a nil pointer dereference.
This commit is contained in:
parent
d41bd6b6b1
commit
f3cab6e177
3 changed files with 21 additions and 9 deletions
|
|
@ -72,18 +72,22 @@ func getSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
var rows [][]string
|
var rows [][]string
|
||||||
for _, source := range list.Items {
|
for _, source := range list.Items {
|
||||||
row := []string{}
|
var row []string
|
||||||
|
var revision string
|
||||||
|
if source.GetArtifact() != nil {
|
||||||
|
revision = source.GetArtifact().Revision
|
||||||
|
}
|
||||||
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
source.GetArtifact().Revision,
|
revision,
|
||||||
string(c.Status),
|
string(c.Status),
|
||||||
c.Message,
|
c.Message,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
source.GetArtifact().Revision,
|
revision,
|
||||||
string(corev1.ConditionFalse),
|
string(corev1.ConditionFalse),
|
||||||
"waiting to be reconciled",
|
"waiting to be reconciled",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,18 +72,22 @@ func getSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
var rows [][]string
|
var rows [][]string
|
||||||
for _, source := range list.Items {
|
for _, source := range list.Items {
|
||||||
row := []string{}
|
var row []string
|
||||||
|
var revision string
|
||||||
|
if source.GetArtifact() != nil {
|
||||||
|
revision = source.GetArtifact().Revision
|
||||||
|
}
|
||||||
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
"unknown",
|
revision,
|
||||||
string(c.Status),
|
string(c.Status),
|
||||||
c.Message,
|
c.Message,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
source.GetArtifact().Revision,
|
revision,
|
||||||
string(corev1.ConditionFalse),
|
string(corev1.ConditionFalse),
|
||||||
"waiting to be reconciled",
|
"waiting to be reconciled",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,18 +72,22 @@ func getSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
var rows [][]string
|
var rows [][]string
|
||||||
for _, source := range list.Items {
|
for _, source := range list.Items {
|
||||||
row := []string{}
|
var row []string
|
||||||
|
var revision string
|
||||||
|
if source.GetArtifact() != nil {
|
||||||
|
revision = source.GetArtifact().Revision
|
||||||
|
}
|
||||||
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
if c := meta.GetCondition(source.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
source.GetArtifact().Revision,
|
revision,
|
||||||
string(c.Status),
|
string(c.Status),
|
||||||
c.Message,
|
c.Message,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
row = []string{
|
row = []string{
|
||||||
source.GetName(),
|
source.GetName(),
|
||||||
source.GetArtifact().Revision,
|
revision,
|
||||||
string(corev1.ConditionFalse),
|
string(corev1.ConditionFalse),
|
||||||
"waiting to be reconciled",
|
"waiting to be reconciled",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue