-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
117 lines (103 loc) · 2.37 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
variables:
npm_config_cache: $CI_PROJECT_DIR/.npm
VERSION_PATTERN: /^v[0-9]+\.[0-9]+\.[0-9]+/
.is-working-branch: &is-working-branch
if: $CI_COMMIT_REF_PROTECTED == "false" && $CI_PIPELINE_SOURCE != "merge_request_event"
.is-dev: &is-dev
if: $CI_COMMIT_BRANCH == "dev"
.is-version-tag: &is-version-tag
if: $CI_COMMIT_TAG =~ $VERSION_PATTERN
.is-schedule: &is-schedule
if: $CI_PIPELINE_SOURCE == "schedule"
.is-not-schedule: &is-not-schedule
if: $CI_PIPELINE_SOURCE == "schedule"
when: never
.manual-if-renovate-commit: &manual-if-renovate-commit
if: $CI_COMMIT_MESSAGE =~ /^\[Renovate\]/ && $CI_COMMIT_BRANCH == "dev"
when: manual
default:
image:
name: node:22-alpine
tags:
- docker
cache:
- paths:
- $npm_config_cache
before_script:
- npm ci --prefer-offline
stages:
- lint
- build
- test
- deploy
- renovate
lint:
stage: lint
rules:
- *is-working-branch
script:
- npm run format:check
- npm run lint
build:
stage: build
rules:
- *is-working-branch
script:
- npm run build
test:
stage: test
rules:
- *is-working-branch
script:
- npm run test:ci
artifacts:
when: always
reports:
junit: junit.xml
deploy:dev:
stage: deploy
tags:
- shell
- runner-dev
environment: development
resource_group: development
cache: []
rules:
- *is-not-schedule
- *manual-if-renovate-commit
- *is-dev
before_script: []
script:
- ./scripts/deploy-dev.sh
deploy:docker:
stage: deploy
image:
name: gcr.io/kaniko-project/executor:v1.22.0-debug
entrypoint: [""]
cache: []
rules:
- *is-version-tag
before_script:
- cat $NEXUS_AUTH_CONFIG | base64 -d > /kaniko/.docker/config.json
script:
- VERSION_NUM=$(echo $CI_COMMIT_TAG | cut -c 2-)
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${NEXUS_URL}:${NEXUS_DOCKER_PORT}/istex/istex-search:${VERSION_NUM}"
renovate:
stage: renovate
image: renovate/renovate:38.129
interruptible: false
cache: []
rules:
- *is-schedule
before_script: []
script:
- renovate
variables:
RENOVATE_AUTODISCOVER: true
RENOVATE_AUTODISCOVER_FILTER: "/^istex\/istex-search\/istex-search$/"
RENOVATE_PLATFORM: gitlab
RENOVATE_ENDPOINT: $CI_API_V4_URL
RENOVATE_COMMIT_MESSAGE_PREFIX: "[Renovate]"