-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
91 lines (83 loc) · 2.88 KB
/
.gitlab-ci.yml
File metadata and controls
91 lines (83 loc) · 2.88 KB
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
variables:
MODULE : git@gitlab.widas.de:cidaas-public-devkits/cidaas-plugins/module-version.git
TEMPLATE_REPO: https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.widas.de/cidaas-management/cidaas-versioning-ci-templates.git
SCRIPTS_PATH: cidaas-versioning-ci-templates/scripts/
stages:
- test
- prepare
- module
get_prerequisites:
image: makocchi/alpine-git-curl-jq
stage: prepare
script:
- git clone ${TEMPLATE_REPO}
artifacts:
paths:
- ./${SCRIPTS_PATH}
expire_in: 1 hrs
only:
- master
get_version:
image: nexus.widas.de:18443/cidaas-node-typescript:12.7.0-3.5.3
stage: prepare
script:
- apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
- npm install -g semantic-release @semantic-release/gitlab
- semantic-release
- echo "export PACKAGE_VERSION="$(git describe --abbrev=0 --tags)"" >> variables
artifacts:
paths:
- variables
only:
- master
update_module:
stage: module
image: python:3.7
before_script:
- source ./variables
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan gitlab.widas.de >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- if [ -d "module-version" ]; then rm -Rf module-version; fi
- git config --global user.email $RELEASE_USER_EMAIL
- git config --global user.name $RELEASE_USER_NAME
- echo $MODULE_VERSION_PROJECT
- git clone $MODULE_VERSION_PROJECT
- cd module-version
script:
- git checkout development
- mkdir python_scripts
- mv ../${SCRIPTS_PATH}/module.py ./python_scripts/module.py
- python python_scripts/module.py $CI_PROJECT_NAME $PACKAGE_VERSION "update version of $CI_PROJECT_NAME to $PACKAGE_VERSION"
- rm -rf ./python_scripts
- git commit -am "update version of $CI_PROJECT_NAME to $PACKAGE_VERSION"
- git push
only:
- master
except:
variables:
- $CI_PROJECT_NAME =~/^*module-version*$/
code_quality_json:
image: docker:git
stage: test
allow_failure: true
variables:
CODE_QUALITY_IMAGE: "codeclimate/codeclimate:latest"
script:
- docker pull "$CODE_QUALITY_IMAGE"
- docker run
--env SOURCE_CODE="$PWD"
--env CODECLIMATE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
--volume /tmp/cc:/tmp/cc
"$CODE_QUALITY_IMAGE" analyze -f json > gl-code-quality-report.json
artifacts:
reports:
codequality: gl-code-quality-report.json
paths: [gl-code-quality-report.json]
dependencies: []