1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Support shortening of revision with digest

The `\b` in the regular expression ensures we only match with a
hexadecimal notation as awhole, while still allowing to match with
e.g. `sha1:...` which would not have been possible by using `\W`
as this includes `_`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals
2023-02-13 14:01:25 +01:00
parent ae9728685c
commit bb6a7b8f07
10 changed files with 172 additions and 25 deletions

View File

@@ -25,6 +25,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/internal/utils"
)
var getSourceHelmChartCmd = &cobra.Command{
@@ -80,6 +82,9 @@ func (a *helmChartListAdapter) summariseItem(i int, includeNamespace bool, inclu
revision = item.GetArtifact().Revision
}
status, msg := statusAndMessage(item.Status.Conditions)
// NB: do not shorten revision as it contains a SemVer
// Message may still contain reference of e.g. commit chart was build from
msg = utils.TruncateHex(msg)
return append(nameColumns(&item, includeNamespace, includeKind),
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
}