diff --git a/controllers/helmchart_controller.go b/controllers/helmchart_controller.go index ddc149f45..d12081536 100644 --- a/controllers/helmchart_controller.go +++ b/controllers/helmchart_controller.go @@ -447,7 +447,12 @@ func (r *HelmChartReconciler) fromTarballArtifact(ctx context.Context, source so if c.Spec.ReconcileStrategy == sourcev1.ReconcileStrategyRevision { // Isolate the commit SHA from GitRepository type artifacts by removing the branch/ prefix. splitRev := strings.Split(source.Revision, "/") - opts.VersionMetadata = splitRev[len(splitRev)-1] + sha := splitRev[len(splitRev)-1] + // The version is used in e.g. resource labels in many charts, which means it has a limited + // length of 63 characters. To not use all that space with e.g. the length from a Git commit + // SHA (40 characters): take the short SHA of the first 12 characters. + // Length ref: http://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Short-SHA-1 + opts.VersionMetadata = sha[0:12] } // Set the VersionMetadata to the object's Generation if ValuesFiles is defined // This ensures changes can be noticed by the Artifact consumer