-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
.gitlab-ci.yml
54 lines (51 loc) · 1.79 KB
/
.gitlab-ci.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
variables:
CI_DEBUG_TRACE: "false"
REGISTRY_URL: "registry.local:5000/patrowl/docker-images"
STACK: "patrowl-manager"
FOLDER_PATH: "."
stages:
- build
- test
- run
build-push-manager:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- VERSION=$(cat $CI_PROJECT_DIR/$FOLDER_PATH/VERSION | cut -d " " -f1)
- echo "Building Dockerfile $REGISTRY_URL/$STACK:$VERSION on branch $CI_COMMIT_BRANCH"
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{$(echo \"${REGISTRY_URL}\" | cut -d '/' -f1)\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- cat /kaniko/.docker/config.json
- /kaniko/executor --insecure --cleanup --context $CI_PROJECT_DIR/$FOLDER_PATH --dockerfile $CI_PROJECT_DIR/$FOLDER_PATH/Dockerfile --destination $REGISTRY_URL/$STACK:$VERSION
rules:
- if: $CI_COMMIT_BRANCH == "master"
changes:
- VERSION
test-build-manager:
stage: test
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "Building Dockerfile $REGISTRY_URL/$STACK:$VERSION on branch $CI_COMMIT_BRANCH"
- /kaniko/executor --insecure --cleanup --context $CI_PROJECT_DIR/$FOLDER_PATH --dockerfile $CI_PROJECT_DIR/$FOLDER_PATH/Dockerfile --no-push
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: never
- when: always
# run-job-manager:
# stage: run
# image:
# name: $REGISTRY_URL/$STACK:$VERSION
# script:
# - echo "Running $STACK on branch $CI_COMMIT_BRANCH"
# rules:
# - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH
# changes:
# - $FOLDER_PATH/*
# after_script:
# - docker images | grep $STACK
# - docker stop $(docker ps -a -q --filter ancestor=$REGISTRY_URL/$STACK:$VERSION)