-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
130 lines (125 loc) · 3.62 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
---
stages:
- molecule
- changes
- push
variables:
GITHUB_USER: lotusnoir
ANSIBLE_REMOTE_TMP: /tmp
PY_COLORS: 1
######################################################
# RUN MOLECULE FOR EACH DISTRIB
######################################################
molecule_debian12:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=debian12 molecule test
molecule_debian11:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=debian11 molecule test
molecule_debian10:
stage: molecule
image: lotusnoir/molecule_play:v2.0.0
script:
- MOLECULE_DISTRIB=debian10 molecule test
molecule_oraclelinux8:
stage: molecule
image: lotusnoir/molecule_play:v2.0.0
script:
- MOLECULE_DISTRIB=oraclelinux8 molecule test
molecule_oraclelinux9:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=oraclelinux9 molecule test
molecule_redhat8:
stage: molecule
image: lotusnoir/molecule_play:v2.0.0
script:
- MOLECULE_DISTRIB=redhat8 molecule test
molecule_redhat9:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=redhat9 molecule test
molecule_rocky9:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=rocky9 molecule test
molecule_ubuntu18:
stage: molecule
image: lotusnoir/molecule_play:v2.0.0
variables:
MOLECULE_DOCKER_COMMAND: "--cap-add NET_ADMIN"
script:
- MOLECULE_DISTRIB=ubuntu18 molecule test
molecule_ubuntu22:
stage: molecule
image: lotusnoir/molecule_play:latest
script:
- MOLECULE_DISTRIB=ubuntu22 molecule test
molecule_ubuntu20:
stage: molecule
image: lotusnoir/molecule_play:latest
variables:
MOLECULE_DOCKER_COMMAND: "--cap-add NET_ADMIN"
script:
- MOLECULE_DISTRIB=ubuntu20 molecule test
######################################################
# GENERATE CHANGELOG FILE
######################################################
changelog:
stage: changes
image: node:19
needs:
- molecule_debian12
- molecule_debian11
- molecule_debian10
- molecule_oraclelinux8
- molecule_oraclelinux9
- molecule_redhat8
- molecule_redhat9
- molecule_rocky9
- molecule_ubuntu18
- molecule_ubuntu22
- molecule_ubuntu20
artifacts:
paths:
- CHANGELOG.md
expire_in: 1 day
before_script:
- npm install -g auto-changelog
script:
- auto-changelog -t keepachangelog --sort-commits date-desc --hide-empty-releases --hide-credit -l 10 -b 10
##################################################
# PUSH CODE WHEN ALL TEST OK
##################################################
push_src_on_github:
stage: push
image: alpine:latest
needs:
- changelog
before_script:
- apk add git openssh-client
- eval $(ssh-agent -s)
- echo "${GITHUB_USER_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tUser ansible\n\tStrictHostKeyChecking no\n\tForwardAgent yes\n\n" > ~/.ssh/config
- git config --global user.email "${GITHUB_USER_EMAIL}"
- git config --global user.name "${GITHUB_USER}"
- git config --global init.defaultBranch main
- COMMENT=$(git log -1 --pretty=%B | head -1)
script:
- git clone git@github.com:${GITHUB_USER}/ansible-apps_snoopy.git /tmp/ansible-apps_snoopy
- find /tmp/ansible-apps_snoopy -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf "{}" +;
- rm -rf .git
- cp -r . /tmp/ansible-apps_snoopy/
- cd /tmp/ansible-apps_snoopy
- git add -A
- git commit -m "${COMMENT}" || echo "No changes, nothing to commit!"
- git push --follow-tags