-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
59 lines (55 loc) · 2.03 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
stages:
- prepare
- build
- test
- docker-build
- deploy
- acceptance
include:
- local: ci/gitlab/**.yml
- project: "networkteam/gitlab-ci-common"
file: "/includes/docker-build.yaml"
variables:
SECURE_ANALYZERS_PREFIX: registry.gitlab.com/gitlab-org/security-products/analyzers
# Template for component specific jobs
#
# We cannot use child pipelines currently, since some features like test reports and showing information
# on the according merge request are not supported. So the idea is to split the jobs into components
# and use template jobs for each component. With merge request pipelines and `changes` rules, we can
# control which jobs run depending on the actual changes in the merge request.
.component-job:
# Needs a COMPONENT variable
# variables: COMPONENT: "backend"
rules:
# Only run the job on merge requests if changes in the component or CI definitions for component occurred
- if: $CI_MERGE_REQUEST_ID
changes:
- .gitlab-ci.yml
- ci/gitlab/$COMPONENT.yml
- $COMPONENT/**/*
# Always run the job on the main branch
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Copy (tag) docker image if _no_ changes for this component occurred, and we are in a merge request
.component-dockercopy-job:
stage: docker-build
image: registry.networkteam.com/networkteam/docker/oci-tools:latest
# Needs a COMPONENT variable
# variables: COMPONENT: "frontend"
rules:
# Do not run the job on merge requests if changes in the component or CI definitions for component occurred
- if: $CI_MERGE_REQUEST_ID
changes:
- .gitlab-ci.yml
- ci/gitlab/$COMPONENT.yml
- $COMPONENT/**/*
when: never
# Otherwise, run the job for merge request pipelines
- if: $CI_MERGE_REQUEST_ID
needs: []
dependencies: []
script:
- skopeo login
--username $CI_REGISTRY_USER
--password $CI_REGISTRY_PASSWORD
$CI_REGISTRY
- skopeo copy docker://$CI_REGISTRY_IMAGE/$COMPONENT:latest docker://$CI_REGISTRY_IMAGE/$COMPONENT:$CI_REGISTRY_TAG