summaryrefslogtreecommitdiff
path: root/.expeditor/promote-docker-images.sh
blob: 32b4aea9d16c85e4d6c440d0613f4c2f81c9ba8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash

export DOCKER_CLI_EXPERIMENTAL=enabled

VERSION=$(cat VERSION)

echo "--- Creating manifest for ${EXPEDITOR_TARGET_CHANNEL}"
docker manifest create "chef/chef:${EXPEDITOR_TARGET_CHANNEL}" \
  --amend "chef/chef:${VERSION}-arm64" \
  --amend "chef/chef:${VERSION}-amd64"

echo "--- Pushing manifest for ${EXPEDITOR_TARGET_CHANNEL}"
docker manifest push "chef/chef:${EXPEDITOR_TARGET_CHANNEL}"

if [[ $EXPEDITOR_TARGET_CHANNEL == "stable" ]]; then
  echo "--- Creating manifest for latest"
  docker manifest create "chef/chef:latest" \
    --amend "chef/chef:${VERSION}-arm64" \
    --amend "chef/chef:${VERSION}-amd64"

  echo "--- Pushing manifest for latest"
  docker manifest push "chef/chef:latest"

  # split the version and add the tags for major and major.minor
  version=(${VERSION//./ })

  echo "--- Creating manifest for ${version[0]}"
  docker manifest create "chef/chef:${version[0]}" \
    --amend "chef/chef:${VERSION}-arm64" \
    --amend "chef/chef:${VERSION}-amd64"

  echo "--- Pushing manifest for ${version[0]}"
  docker manifest push "chef/chef:${version[0]}"

  echo "--- Creating manifest for ${version[0]}.${version[1]}"
  docker manifest create "chef/chef:${version[0]}.${version[1]}" \
    --amend "chef/chef:${VERSION}-arm64" \
    --amend "chef/chef:${VERSION}-amd64"

  echo "--- Pushing manifest for ${version[0]}.${version[1]}"
  docker manifest push "chef/chef:${version[0]}.${version[1]}"
fi