-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnullplaftorm-asset-docker-image-build-and-push-kaniko.yml
40 lines (37 loc) · 1.58 KB
/
nullplaftorm-asset-docker-image-build-and-push-kaniko.yml
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
spec:
inputs:
dockerfile:
default: $CI_PROJECT_DIR/Dockerfile
---
stages:
- nullplatform-asset-docker-image-build-and-push
variables:
RUNNER_TAG: $RUNNER_TAG
NULLPLATFORM_API_KEY: $NULLPLATFORM_API_KEY
NULLPLATFORM_ENCRIPTION_KEY: $NULLPLATFORM_ENCRIPTION_KEY
nullplatform-asset-docker-image-build-and-push:
image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""]
stage: nullplatform-asset-docker-image-build-and-push
script:
- mkdir -p /kaniko/.docker
- |+
while IFS= read -r line; do
for env_var in $line
do
export "$env_var"
done
if [ "$ASSET_REPOSITORY_PROVIDER" == "aws-ecr" ]; then
echo -n "{\"credsStore\":\"ecr-login\"}" > /kaniko/.docker/config.json
elif [ "$ASSET_REPOSITORY_PROVIDER" == "azure-container-registry" ]; then
BUILD_AZURE_REGISTRY_AUTH_TOKEN=$(echo -n "$BUILD_AZURE_REGISTRY_USERNAME:$BUILD_AZURE_REGISTRY_PASSWORD" | base64 | tr -d \\n)
echo -n "{\"auths\":{\"$BUILD_AZURE_REGISTRY_LOGIN_SERVER\":{\"auth\":\"$BUILD_AZURE_REGISTRY_AUTH_TOKEN\"}}}" > /kaniko/.docker/config.json
else
BUILD_REGISTRY_AUTH_TOKEN=$(echo -n "$BUILD_DOCKER_REGISTRY_USERNAME:$BUILD_DOCKER_REGISTRY_PASSWORD" | base64 | tr -d \\n)
echo -n "{\"auths\":{\"$BUILD_DOCKER_REGISTRY_SERVER\":{\"auth\":\"$BUILD_REGISTRY_AUTH_TOKEN\"}}}" > /kaniko/.docker/config.json
fi
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $[[ inputs.dockerfile ]] --destination $ASSET_URL
done < assets-to-create.txt
except:
- tags