Set digests in image override
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
parent
87797221ac
commit
8c246a5450
|
|
@ -104,6 +104,7 @@ func (kg *KustomizeGenerator) WriteFile(dirPath string) error {
|
|||
Name: image.Name,
|
||||
NewName: image.NewName,
|
||||
NewTag: image.NewTag,
|
||||
Digest: image.Digest,
|
||||
}
|
||||
if exists, index := checkKustomizeImageExists(kus.Images, image.Name); exists {
|
||||
kus.Images[index] = newImage
|
||||
|
|
|
|||
|
|
@ -50,3 +50,7 @@ func Test_secureBuildKustomization_panic(t *testing.T) {
|
|||
g.Expect(err).To(HaveOccurred())
|
||||
})
|
||||
}
|
||||
|
||||
func Test_WriteFile(t *testing.T) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,10 @@ func TestKustomizationReconciler_FluxTransformers(t *testing.T) {
|
|||
NewName: "ghcr.io/stefanprodan/podinfo",
|
||||
NewTag: "5.2.0",
|
||||
},
|
||||
{
|
||||
Name: "ghcr.io/fluxcd/flagger",
|
||||
Digest: "sha256:2832f53c577d44753e97b0ed5f00e7e3a06979c9fab77d0e78bdac4b612b14fb",
|
||||
},
|
||||
},
|
||||
Patches: []kustomize.Patch{
|
||||
{
|
||||
|
|
@ -394,6 +398,8 @@ metadata:
|
|||
g.Expect(deployment.ObjectMeta.Labels["patch3"]).To(Equal("json6902"))
|
||||
g.Expect(deployment.ObjectMeta.Labels["patch4"]).To(Equal("strategic-merge"))
|
||||
g.Expect(*deployment.Spec.Replicas).To(Equal(int32(2)))
|
||||
g.Expect(deployment.Spec.Template.Spec.Containers[0].Image).To(ContainSubstring("5.2.0"))
|
||||
g.Expect(deployment.Spec.Template.Spec.Containers[1].Image).To(ContainSubstring("sha256:2832f53c577d44753e97b0ed5f00e7e3a06979c9fab77d0e78bdac4b612b14fb"))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,3 +17,5 @@ spec:
|
|||
containers:
|
||||
- name: podinfo
|
||||
image: podinfo
|
||||
- name: flagger
|
||||
image: ghcr.io/fluxcd/flagger
|
||||
|
|
|
|||
Loading…
Reference in New Issue