-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
162 lines (149 loc) · 4.41 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
image: $DOCKERHUB_URL/node:14-buster
include:
- project: automation-toolchain/atg-shared-templates
file: security/base.gitlab-ci.yml
ref: v1.1.6
variables:
SECRET_DETECTION_EXCLUDED_PATHS: "presentation/css/choices.min.css"
stages:
- atg-shared-checks
- test_build
- build
- perfomance_tests
- publish
- release
coverage:
stage: test_build
tags:
- cm-official-docker-executor
before_script:
- npm run set-local-registry-scopes
script:
- npm ci
- npm run lint
- npm run testtemplates
- npm run coverage
- npx nyc report -r html -r text
artifacts:
paths:
- coverage
build:
stage: test_build
before_script:
- npm run set-local-registry-scopes
script:
- apt-get update && apt-get install -y rpm git
- npm ci && npm run build
artifacts:
expire_in: 1 week
name: f5-appsvcs-templates.$CI_BUILD_REF
paths:
- dist/*
audit_packages:
stage: test_build
tags:
- cm-official-docker-executor
before_script:
- npm run set-local-registry-scopes
script:
- npm ci && npm run audit-production
format_examples_templates:
stage: test_build
tags:
- cm-official-docker-executor
script:
- npm run set-local-registry-scopes
- npm ci && npm run format-templates && npm run validate-templates-are-formatted
create_docs:
image: ${CONTAINTHEDOCS_IMAGE}
stage: test_build
allow_failure: true
before_script:
- npm run set-local-registry-scopes
script:
- cd docs
- pip3 install -r requirements.txt
- if [ "$CI_COMMIT_REF_NAME" = "docs-staging" ] || [ "$CI_COMMIT_REF_NAME" = "docs-latest" ]; then
- rm -r _templates
- fi
- npm ci
- make html
- make test
tags:
- cm-official-docker-executor
artifacts:
expire_in: 1 week
name: sphinx-docs_$CI_BUILD_REF
paths:
- docs/_build/html
pages:
stage: publish
environment:
name: staging
url: https://${CI_PROJECT_NAMESPACE}.${PAGES_DOMAIN}/${CI_PROJECT_NAME}/
tags:
- cm-official-docker-executor
script:
# Base directory and index
- PUBLIC_DIR='./public'
- mkdir -p ${PUBLIC_DIR}
- cp pages/index.html ${PUBLIC_DIR}
# Public Docs
- PUBLIC_DOCS=${PUBLIC_DIR}/public-docs
- mkdir -p ${PUBLIC_DOCS}
- test -e docs/ && cp -R docs/_build/html/* ${PUBLIC_DOCS}
# Unit test results (coverage)
- COVERAGE_DOCS=${PUBLIC_DIR}/coverage-docs
- mkdir -p ${COVERAGE_DOCS}
- cp -R coverage/* ${COVERAGE_DOCS}
# Perfomance test results (coverage)
- PERFOMANCE_TESTS=${PUBLIC_DIR}/perfomance-tests-results
- mkdir -p ${PERFOMANCE_TESTS}
- cp -R perfomance-tests-results/* ${PERFOMANCE_TESTS} || true # Allow failure for PerfTests
artifacts:
paths:
- public
only:
- develop
- doc-wip
- schedules
clouddocs:
image: ${CONTAINTHEDOCS_IMAGE}
stage: publish
tags:
- cm-official-docker-executor
only:
- docs-staging@automation-toolchain/mystique
- docs-latest@automation-toolchain/mystique
dependencies:
- create_docs
script:
- apk add --update --no-cache jq
- scripts/publish-clouddocs.sh
publish_to_github:
stage: release
variables:
GH_TOKEN: "${GITHUB_API_TOKEN}"
before_script:
- npm run set-local-registry-scopes
script:
- npm ci
- scripts/release.sh
rules:
- if: $CI_COMMIT_MESSAGE =~ /Bump version to ([0-9]+\.){2,2}[0-9]+[^-]/ && $CI_COMMIT_BRANCH == "master"
perfomance_tests:
stage: perfomance_tests
only:
- schedules
before_script:
- npm run set-local-registry-scopes
- npm ci
script:
# Test case name is constructed using the following: ${NUM_APPS}-${NUM_TENANTS}-${BATCH_SIZE}-${TEMPLATE_WEIGHT}
- TEST_CASES=("50-1-1-heavy" "100-1-10-medium" "100-1-25-light" "100-20-10" "300-20-50")
- for TEST_CASE in ${TEST_CASES[@]}; do echo "Test case name = ${TEST_CASE}"; echo $TEST_CASE | ( IFS="-" read -r APPS TENANTS SIZE WEIGHT; unset $IFS; export PERF_BATCH_NUM_APPS=$APPS; export PERF_BATCH_NUM_TENANTS=$TENANTS; export PERF_BATCH_SIZE=$SIZE; export PERF_BATCH_WEIGHT=$WEIGHT; npm run test-performance; ) done
# Generating HTML results pages
- node scripts/generate_pref_tests_html.js
artifacts:
paths:
- perfomance-tests-results