-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (67 loc) · 2.27 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
include:
- remote: "https://gitlab.com/xrow-public/ci-tools/raw/3.0/.gitlab-helm-and-docker.yml"
build:helm:common:
variables:
CHART_DIR: ./schema-test/charts/common
extends: .template:helm:build
build:container:
stage: .pre
lint:helm:
services:
- name: ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
alias: schema.test.com
variables:
DOMAIN: schema.test.com
image: quay.io/podman/stable:latest
stage: lint
needs: ["build:container"]
script:
- |
source <(curl -s https://gitlab.com/xrow-public/ci-tools/-/raw/3.0/scripts/library.sh)
ci_registry_token_login
yum install -y openssl
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
for file in $(find ./ -maxdepth 3 -regextype posix-extended -iregex '.*[.]json' | sort -g); do
sed -i "s/schema.example.com/${DOMAIN}:8443/" $file
echo "Modified: $file"
done
curl --head -X GET --retry 10 --retry-connrefused --retry-delay 5 --fail http://${DOMAIN}:8080
openssl s_client -showcerts -connect ${DOMAIN}:8443 </dev/null 2>/dev/null|openssl x509 -outform PEM > /etc/pki/ca-trust/source/anchors/server.crt
update-ca-trust
echo "127.0.0.1 ${DOMAIN}" >> /etc/hosts
helm lint schema-test/
pages:
variables:
DOMAIN: schema.xrow.com
DOCUMENT_ROOT: ./public
needs: ["lint:helm"]
script:
- |
if [[ ! -v DOMAIN ]] ; then
echo "Setup CI variable DOMAIN"
exit 1
fi
cp -R src/public public/
echo "Publish schemas for ${DOMAIN}"
for file in $(find ${DOCUMENT_ROOT}/ -maxdepth 3 -regextype posix-extended -iregex '.*[.]json' | sort -g); do
sed -i "s/schema.example.com/${DOMAIN}/" $file
echo "Modified: $file"
done
artifacts:
paths:
- public
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: $CI_MERGE_REQUEST_ID
when: never
- if: '$CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH'
exists:
- src/public/**/*.json
- src/public/*.json
when: on_success
- if: '$CI_COMMIT_TAG =~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/'
exists:
- src/public/**/*.json
- src/public/*.json
when: on_success