kaniko.sh 1.37 KB
Newer Older
1
2
3
4
5
6
7
8
#!/busybox/sh

set -e

mkdir -p /kaniko/.docker

echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json

Georges Racinet's avatar
Georges Racinet committed
9
PYDEPS_TAG="latest"
10
11
12
13
14
15
16
17
18
19
20
21

if [ "$CI_COMMIT_BRANCH" = "branch/default" ]; then
    TAG="latest"
elif [ "$CI_COMMIT_HG_BRANCH" = "branch/stable" ]; then
    TAG="stable"
else
    TAG="$CI_COMMIT_HG_SHORT_SHA"
fi

set -u
set -x

22
23
24
25
for HG_BRANCH in default stable; do
    DESTINATION=${CI_REGISTRY_IMAGE}/hg-${HG_BRANCH}:${TAG}
    echo "Building with kaniko, pushing to ${DESTINATION}"

26
27
    /kaniko/executor --context $CI_PROJECT_DIR/context \
                     --dockerfile $CI_PROJECT_DIR/Dockerfile.rolling-hg \
28
29
30
31
32
33
                     --build-arg HG_BRANCH=${HG_BRANCH} \
                     --build-arg PYDEPS_TAG=${PYDEPS_TAG} \
                     --single-snapshot \
                     --cleanup \
                     --destination $DESTINATION
done
34
35
36
37
38

DESTINATION=${CI_REGISTRY_IMAGE}/hg-current:${TAG}
echo "Building with kaniko, pushing to ${DESTINATION}"

# TODO put released hg version to use in a separate file for better clarity
39
40
/kaniko/executor --context $CI_PROJECT_DIR/context \
                 --dockerfile $CI_PROJECT_DIR/Dockerfile.released-hg \
41
42
43
                 --build-arg HG_VERSION=5.5.2 \
                 --build-arg PYDEPS_TAG=${PYDEPS_TAG} \
                 --destination $DESTINATION