a740491c2aa340fac5e0afc971c0a23ec1721e06
[releng.git] / jjb / releng / opnfv-manifest.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10
11 set -o errexit
12 set -o nounset
13 set -o pipefail
14
15 # Starting creating manifest image for $DOCKER_REPO_NAME
16
17 ARCH=(amd64 arm64)
18 DOCKER_REPO_NAME=${DOCKER_REPO_NAME-}
19 RELEASE_VERSION=${RELEASE_VERSION-}
20 BRANCH=${BRANCH-}
21 ARCH_TAG=${ARCH_TAG-}
22
23 # Before script install manifest-tool:
24 # cd .. && git clone https://github.com/estesp/manifest-tool
25 # cd ../manifest-tool && sudo -E make && sudo -E make install
26
27 if [[ "$BRANCH" == "master" ]]; then
28         DOCKER_TAG="latest"
29 elif [[ "$BRANCH" == "euphrates" ]]; then
30         DOCKER_TAG="euphrates"
31 elif [[ -n "${RELEASE_VERSION}" ]]; then
32         DOCKER_TAG="${RELEASE_VERSION}"
33 else
34         DOCKER_TAG="stable"
35 fi
36 if [[ "${ARCH_TAG}" =~ "arm64" || "${ARCH_TAG}" =~ "amd64" ]]; then
37         sudo manifest-tool push from-args --platforms linux/amd64,linux/arm64 \
38            --template "${DOCKER_REPO_NAME}":"${ARCH[0]}"-"${DOCKER_TAG}" \
39            --template "${DOCKER_REPO_NAME}":"${ARCH[1]}"-"${DOCKER_TAG}" \
40            --target "${DOCKER_REPO_NAME}":"${DOCKER_TAG}"
41 fi
42