You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(STONEINTG-1317): annotate snapshot for the missed component
* annotate the components to snapshot when they are not included in
snasphot due to missing valid container image or git source
Signed-off-by: Hongwei Liu <[email protected]>
// if the containerImage doesn't have a valid digest, the component
872
875
// will not be added to snapshot
873
876
err=ValidateImageDigest(containerImage)
874
877
iferr!=nil {
875
878
log.Error(err, "component cannot be added to snapshot for application due to invalid digest in containerImage", "component.Name", applicationComponent.Name)
iferr:=metadata.SetAnnotation(snapshot, helpers.CreateSnapshotAnnotationName, fmt.Sprintf("Component(s) '%s' is(are) not included in snapshot due to missing valid containerImage or git source", strings.Join(invalidComponents, ", "))); err!=nil {
904
+
returnnil, fmt.Errorf("failed to set annotation %s: %w", SnapshotGitSourceRepoURLAnnotation, err)
Expect(snapshot.Annotations["test.appstudio.openshift.io/create-snapshot-status"]).To(Equal("Component(s) 'second-component, bad-component' is(are) not included in snapshot due to missing valid containerImage or git source"))
691
693
})
692
694
693
695
It("Return false when the image url contains invalid digest", func() {
Expect(snapshot.Spec.Components).To(HaveLen(1), "One component should have been added to snapshot. Other component should have been omited due to empty ContainerImage field or missing valid digest")
524
523
Expect(snapshot.Spec.Components[0].Name).To(Equal(hasComp.Name), "The built component should have been added to the snapshot")
524
+
Expect(snapshot.Annotations[helpers.CreateSnapshotAnnotationName]).To(Equal("Component(s) 'another-component-sample' is(are) not included in snapshot due to missing valid containerImage or git source"))
525
525
})
526
526
527
527
It("ensures that snapshot has label pointing to build pipelinerun", func() {
0 commit comments