Skip to content

Commit 8813bf3

Browse files
authored
ROX-7299: Push images as manifest lists (#421)
1 parent 3766ac8 commit 8813bf3

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

.circleci/config.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defaultImage: &defaultImage
1212

1313
defaultMachine: &defaultMachine
1414
machine:
15-
image: ubuntu-2004:202010-01
15+
image: ubuntu-2004:202104-01
1616

1717
runOnAllTags: &runOnAllTags
1818
filters:
@@ -883,22 +883,22 @@ jobs:
883883
name: Push images
884884
command: |
885885
echo "Pushing collector base image"
886-
docker push "stackrox/collector:${COLLECTOR_VERSION}-base"
886+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-base"
887887
echo "Pushing collector image"
888-
docker push "stackrox/collector:${COLLECTOR_VERSION}"
888+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}"
889889
echo "Pushing collector latest image"
890-
docker push "stackrox/collector:${COLLECTOR_VERSION}-latest"
890+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-latest"
891891
echo "Pushing collector slim image"
892-
docker push "stackrox/collector:${COLLECTOR_VERSION}-slim"
892+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-slim"
893893
894894
echo "Pushing collector rhel base image"
895-
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-base"
895+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-base"
896896
echo "Pushing collector rhel image"
897-
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}"
897+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}"
898898
echo "Pushing collector rhel latest image"
899-
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-latest"
899+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-latest"
900900
echo "Pushing collector rhel slim image"
901-
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-slim"
901+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-slim"
902902
903903
kernel-module-build-failures-check:
904904
<<: *defaultImage
@@ -1430,10 +1430,10 @@ jobs:
14301430
"${container_build_dir}"
14311431
14321432
if [[ "$CIRCLE_BRANCH" != "master" && -z "$CIRCLE_TAG" ]]; then
1433-
docker push "stackrox/collector:${collector_ver}-reload-latest" | cat
1433+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${collector_ver}-reload-latest" | cat
14341434
else
1435-
docker push "stackrox/collector:${collector_ver}-latest" | cat
1436-
docker push "collector.stackrox.io/collector:${collector_ver}-latest" | cat
1435+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${collector_ver}-latest" | cat
1436+
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "collector.stackrox.io/collector:${collector_ver}-latest" | cat
14371437
fi
14381438
done
14391439

scripts/push-as-manifest-list.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
die() {
6+
echo >&2 "$@"
7+
exit 1
8+
}
9+
10+
[[ "$#" == 1 ]] || die "Usage: $0 <image>"
11+
12+
image="$1"
13+
14+
[[ -n "$image" ]] || die "No image specified"
15+
[[ "$image" == *:* ]] || die "Must specify a tagged image reference when using this script"
16+
17+
arch_image="${image}-amd64"
18+
docker tag "$image" "$arch_image"
19+
20+
docker push "$arch_image"
21+
docker manifest create "$image" "$arch_image"
22+
23+
docker manifest push "$image"

0 commit comments

Comments
 (0)