-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
82 lines (75 loc) · 2.26 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
stages:
- local_debug
- lint
- build_vm_infra
- destroy_vm_infra
- build
# Target can be:
# cloud provider aws, oci, azure or aws/srv-linux-01, oci/srv-olinux-85 etc
# use "all" for all targets and "none" to skip th CI
# default is none
# TARGET: "oci/srv-olinux-85"
variables:
CI_PRE_CLONE_SCRIPT: umask 0022
TARGET: "none"
YAK_REPOSITORY: "yak4all/yak"
YAK_VERSION: "beta"
lint:
stage: lint
image: registry.gitlab.com/pipeline-components/ansible-lint:latest
variables:
ANSIBLE_COLLECTIONS_PATHS: ./collections
ANSIBLE_CONFIG: ./ansible.cfg
script:
- pwd
- ansible-lint --version
- ansible-lint --show-relpath --config-file gitlab_ci/ansible-lint.yml
allow_failure: true
dbg:
stage: local_debug
image: busybox:latest
script:
- env
include:
- project: 'dbiservices/yak/yak_dev_infrastructure'
ref: main
file: 'build_vm_infra.yml'
- project: 'dbiservices/yak/yak_dev_infrastructure'
ref: main
file: 'destroy_vm_infra.yml'
build:
# Use the official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:${TAG}" --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG} --build-arg CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA} --build-arg YAKENV_TAG=${YAKENV_TAG} .
- docker tag "$CI_REGISTRY_IMAGE:${TAG}" "$CI_REGISTRY_IMAGE:${MAIN_TAG}"
- docker push "$CI_REGISTRY_IMAGE:${TAG}"
- docker push "$CI_REGISTRY_IMAGE:${MAIN_TAG}"
# Run this job on tag creation and when a Dockerfile exists
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-(integration|INTEGRATION)[0-9]*$/
variables:
TAG: $CI_COMMIT_TAG
MAIN_TAG: integration
YAKENV_TAG: $MAIN_TAG
exists:
- Dockerfile
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-(stable|STABLE)[0-9]*$/
variables:
TAG: $CI_COMMIT_TAG
MAIN_TAG: stable
YAKENV_TAG: $MAIN_TAG
exists:
- Dockerfile
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-(beta|BETA)[0-9]*$/
variables:
TAG: $CI_COMMIT_TAG
MAIN_TAG: beta
YAKENV_TAG: $MAIN_TAG
exists:
- Dockerfile