forked from thorian93/ansible-role-meilisearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
101 lines (90 loc) · 1.83 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
---
variables:
REPO_NAME: "ansible-role-meilisearch"
GITHUB_REPO: "git@github.com:thorian93/${REPO_NAME}.git"
GITLAB_REPO: "git@gitlab.com:thorian93_ansible/${REPO_NAME}.git"
stages:
- cleanup
- security
- linting
- deploy
- finish
clean-build-area:
stage: cleanup
tags:
- shell
script:
- rm -rf ./*
- rm -rf ./.git/
secret-scan:
stage: security
tags:
- shell
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HOST}/ansible/ansible-scripts.git scripts
- ./scripts/secret-finder.sh
ansible-lint:
stage: linting
tags:
- shell
script:
- ansible-lint ./
yaml-lint:
stage: linting
tags:
- shell
script:
- yamllint ./
shell-lint:
stage: linting
tags:
- shell
script:
- find ./ -name "*.sh" -exec shellcheck {} \;
github-deploy-master:
stage: deploy
tags:
- shell
script:
- git remote set-url --push origin ${GITHUB_REPO}
- git push origin HEAD:${CI_COMMIT_REF_NAME}
only:
- master
github-deploy-tags:
stage: deploy
tags:
- shell
script:
- git remote set-url --push origin ${GITHUB_REPO}
- git push origin ${CI_COMMIT_TAG}
only:
- tags
except:
- branches
gitlab-deploy-master:
stage: deploy
tags:
- shell
script:
- git remote add gitlab ${GITLAB_REPO}
- git push gitlab HEAD:${CI_COMMIT_REF_NAME}
only:
- master
gitlab-deploy-tags:
stage: deploy
tags:
- shell
script:
- git remote add gitlab ${GITLAB_REPO}
- git push gitlab ${CI_COMMIT_TAG}
only:
- tags
except:
- branches
open-issue:
stage: finish
tags:
- shell
script:
- curl --silent --request POST --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" "${GITLAB_URL}/api/v4/projects/${CI_PROJECT_ID}/issues?title=Pipeline%20${CI_PIPELINE_ID}%20failed&assignee_ids=2&labels=bug"
when: on_failure