@@ -21,6 +21,7 @@ import (
21
21
"crypto/tls"
22
22
"errors"
23
23
"fmt"
24
+ "github.com/fluxcd/pkg/git"
24
25
"net/url"
25
26
"os"
26
27
"path/filepath"
@@ -789,10 +790,10 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
789
790
if obj .Spec .ReconcileStrategy == sourcev1 .ReconcileStrategyRevision {
790
791
rev := source .Revision
791
792
if obj .Spec .SourceRef .Kind == sourcev1 .GitRepositoryKind {
792
- // Split the reference by the `/` delimiter which may be present,
793
- // and take the last entry which contains the SHA.
794
- split := strings . Split ( source . Revision , "/" )
795
- rev = split [ len ( split ) - 1 ]
793
+ rev = git . ExtractHashFromRevision ( rev ). String ()
794
+ }
795
+ if obj . Spec . SourceRef . Kind == sourcev1 . BucketKind {
796
+ rev = backwardsCompatibleDigest ( rev ). Hex ()
796
797
}
797
798
if kind := obj .Spec .SourceRef .Kind ; kind == sourcev1 .GitRepositoryKind || kind == sourcev1 .BucketKind {
798
799
// The SemVer from the metadata is at times used in e.g. the label metadata for a resource
@@ -1243,9 +1244,10 @@ func (r *HelmChartReconciler) requestsForGitRepositoryChange(o client.Object) []
1243
1244
return nil
1244
1245
}
1245
1246
1247
+ revision := git .TransformRevision (repo .GetArtifact ().Revision )
1246
1248
var reqs []reconcile.Request
1247
1249
for _ , i := range list .Items {
1248
- if i .Status .ObservedSourceArtifactRevision != repo . GetArtifact (). Revision {
1250
+ if git . TransformRevision ( i .Status .ObservedSourceArtifactRevision ) != revision {
1249
1251
reqs = append (reqs , reconcile.Request {NamespacedName : client .ObjectKeyFromObject (& i )})
1250
1252
}
1251
1253
}
@@ -1270,9 +1272,10 @@ func (r *HelmChartReconciler) requestsForBucketChange(o client.Object) []reconci
1270
1272
return nil
1271
1273
}
1272
1274
1275
+ revision := backwardsCompatibleDigest (bucket .GetArtifact ().Revision )
1273
1276
var reqs []reconcile.Request
1274
1277
for _ , i := range list .Items {
1275
- if i .Status .ObservedSourceArtifactRevision != bucket . GetArtifact (). Revision {
1278
+ if backwardsCompatibleDigest ( i .Status .ObservedSourceArtifactRevision ) != revision {
1276
1279
reqs = append (reqs , reconcile.Request {NamespacedName : client .ObjectKeyFromObject (& i )})
1277
1280
}
1278
1281
}
0 commit comments