Skip to content

Commit

Permalink
ROX-7299: Push images as manifest lists (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
misberner authored Jun 8, 2021
1 parent 3766ac8 commit 8813bf3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defaultImage: &defaultImage

defaultMachine: &defaultMachine
machine:
image: ubuntu-2004:202010-01
image: ubuntu-2004:202104-01

runOnAllTags: &runOnAllTags
filters:
Expand Down Expand Up @@ -883,22 +883,22 @@ jobs:
name: Push images
command: |
echo "Pushing collector base image"
docker push "stackrox/collector:${COLLECTOR_VERSION}-base"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-base"
echo "Pushing collector image"
docker push "stackrox/collector:${COLLECTOR_VERSION}"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}"
echo "Pushing collector latest image"
docker push "stackrox/collector:${COLLECTOR_VERSION}-latest"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-latest"
echo "Pushing collector slim image"
docker push "stackrox/collector:${COLLECTOR_VERSION}-slim"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${COLLECTOR_VERSION}-slim"
echo "Pushing collector rhel base image"
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-base"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-base"
echo "Pushing collector rhel image"
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}"
echo "Pushing collector rhel latest image"
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-latest"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-latest"
echo "Pushing collector rhel slim image"
docker push "stackrox/collector-rhel:${COLLECTOR_VERSION}-slim"
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector-rhel:${COLLECTOR_VERSION}-slim"
kernel-module-build-failures-check:
<<: *defaultImage
Expand Down Expand Up @@ -1430,10 +1430,10 @@ jobs:
"${container_build_dir}"
if [[ "$CIRCLE_BRANCH" != "master" && -z "$CIRCLE_TAG" ]]; then
docker push "stackrox/collector:${collector_ver}-reload-latest" | cat
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${collector_ver}-reload-latest" | cat
else
docker push "stackrox/collector:${collector_ver}-latest" | cat
docker push "collector.stackrox.io/collector:${collector_ver}-latest" | cat
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "stackrox/collector:${collector_ver}-latest" | cat
~/workspace/go/src/github.com/stackrox/collector/scripts/push-as-manifest-list.sh "collector.stackrox.io/collector:${collector_ver}-latest" | cat
fi
done
Expand Down
23 changes: 23 additions & 0 deletions scripts/push-as-manifest-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

die() {
echo >&2 "$@"
exit 1
}

[[ "$#" == 1 ]] || die "Usage: $0 <image>"

image="$1"

[[ -n "$image" ]] || die "No image specified"
[[ "$image" == *:* ]] || die "Must specify a tagged image reference when using this script"

arch_image="${image}-amd64"
docker tag "$image" "$arch_image"

docker push "$arch_image"
docker manifest create "$image" "$arch_image"

docker manifest push "$image"

0 comments on commit 8813bf3

Please sign in to comment.