@@ -845,20 +845,25 @@ def build_remote_image(arches, commit, url, repo, tag, secret=None, from=None,
845
845
build_args + = [" --from" , from]
846
846
}
847
847
build_args + = extra_build_args
848
+ def digest_list = []
848
849
parallel arches. collectEntries { arch ->
849
850
[arch, {
850
851
pipeutils. withPodmanRemoteArchBuilder(arch : arch) {
851
852
def final_args = build_args + [" --arch" , arch, " --tag" , " ${ tag} -${ arch} " ]
853
+ final_args + = [" --write-digest-to-file" , " ${ tag} -${ arch} " ]
852
854
shwrap(" cosa remote-build-container ${ final_args.join(' ')} " )
855
+ digest_list + = readFile(" ${ tag} -${ arch} " )
856
+ shwrap(""" rm -f ${ tag} -${ arch} """ )
853
857
}
854
858
}]
855
859
}
860
+ return digest_list
856
861
}
857
862
858
- def push_manifest (arches , repo , image_tag , manifest_tag ) {
863
+ def push_manifest (digests , repo , manifest_tag ) {
859
864
def images = " "
860
- for (arch in arches ) {
861
- images + = " --image=docker://${ repo} : ${ image_tag } - ${ arch } "
865
+ for (digest in digests ) {
866
+ images + = " --image=docker://${ repo} @ ${ digest } "
862
867
}
863
868
// arbitrarily selecting the s390x builder; we don't run this
864
869
// locally because podman wants user namespacing (yes, even just
@@ -879,23 +884,23 @@ def copy_image(src_image, dest_image, registry_secret_path=None) {
879
884
""" )
880
885
}
881
886
882
- def delete_tags (arches , repo , image_tag , manifest_tag , registry_secret_path = None ) {
887
+ def delete_tags (digests , repo , manifest_tag , registry_secret_path = None ) {
883
888
shwrap("""
884
889
export STORAGE_DRIVER=vfs # https://github.com/coreos/fedora-coreos-pipeline/issues/723#issuecomment-1297668507
885
890
skopeo delete --authfile=${ registry_secret_path} \
886
891
docker://${ repo} :${ manifest_tag}
887
892
""" )
888
- parallel arches . keySet(). collectEntries{arch -> [arch , {
893
+ parallel digests . keySet(). collectEntries{arch -> [digest , {
889
894
shwrap("""
890
895
export STORAGE_DRIVER=vfs # https://github.com/coreos/fedora-coreos-pipeline/issues/723#issuecomment-1297668507
891
896
skopeo delete --authfile=${ registry_secret_path} \
892
- docker://${ repo} :${ image_tag } - ${ arch }
897
+ docker://${ repo} :${ digest }
893
898
""" )
894
899
}]}
895
900
}
896
901
897
902
def build_and_push_image (params = [:]) {
898
- // Available parameters:
903
+ // Available parameters:
899
904
// arches: list -- List of architectures to run against
900
905
// extra_build_args: list -- List of extra commands to pass to `cosa remote` cmd
901
906
// from: string -- Value to replace in the Containerfile
@@ -910,12 +915,10 @@ def build_and_push_image(params = [:]) {
910
915
def from = params. get(' from' , " " );
911
916
def extra_build_args = params. get(' extra_build_args' , " " );
912
917
913
- build_remote_image(params[' arches' ], params[' src_commit' ], params[' src_url' ], params[' staging_repository' ],
914
- params[' image_tag_staging' ], secret, from, extra_build_args)
915
-
918
+ def digests = build_remote_image(params[' arches' ], params[' src_commit' ], params[' src_url' ], params[' staging_repository' ],
919
+ params[' image_tag_staging' ], secret, from, extra_build_args)
916
920
stage(" Push Manifest" ) {
917
- push_manifest(params[' arches' ], params[' staging_repository' ], params[' image_tag_staging' ],
918
- params[' manifest_tag_staging' ])
921
+ push_manifest(digests, params[' staging_repository' ], params[' manifest_tag_staging' ])
919
922
}
920
923
}
921
924
0 commit comments