-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
120 lines (110 loc) · 2.46 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
stages:
- awx_check_project
- awx_conf_project
- awx_check_template
- awx_conf_template
- syntax_check
- staging_test
- dev_test
- production_deployment
variables:
# Just one "BRANCH" and TAG variable is allowed.
# Remeber to change them in line with your dev branch
BRANCH: "federico_configreplace_dev"
TAG: "cfgrpl"
awx_check_project:
stage: awx_check_project
tags:
- netengeu
script:
- tower-cli project get --name $BRANCH
except:
- master
- staging
awx_config_project:
stage: awx_conf_project
tags:
- netengeu
script:
- >
tower-cli project create --name $BRANCH --scm-type git
--scm-url https://git.tmaws.io/federico.olivieri/demo_network_code.git
--organization demo --scm-branch $BRANCH --scm-credential gitlab_credentials_demo
--scm-update-on-launch True
- tower-cli project update --name $BRANCH --monitor
when: on_failure
except:
- master
- staging
awx_check_template:
stage: awx_check_template
tags:
- netengeu
script:
- tower-cli job_template get --name $BRANCH
when: always
except:
- master
- staging
awx_config_template:
stage: awx_conf_template
tags:
- netengeu
script:
- >
tower-cli job_template create --name $BRANCH --job-type run
--inventory demo_dev --project $BRANCH --playbook dev.yml
--vault-credential vault_demo --verbosity verbose --job-tags $TAG
--allow-simultaneous True --diff-mode True
when: on_failure
except:
- master
- staging
yaml:
stage: syntax_check
tags:
- netengeu
script:
- yamllint -c /home/gitlab-runner/.config/yamllint/config/yamllint ./
except:
- master
when: always
jinja2:
stage: syntax_check
tags:
- netengeu
script:
- jinja-ninja roles/demo/templates/
except:
- master
when: always
ansible_run_dev:
stage: dev_test
tags:
- netengeu
script:
- tower-cli job launch --job-template=$BRANCH --monitor
except:
- master
- staging
when: always
ansible_run_staging:
stage: staging_test
tags:
- netengeu
script:
- tower-cli workflow_job launch --workflow-job-template=demo_staging_WORKFLOW --monitor
only:
- staging
when: always
deployment:
stage: production_deployment
tags:
- netengeu
script:
- tower-cli job launch --job-template=demo_MASTER --monitor
- tower-cli job_template delete --name $BRANCH
- tower-cli project delete --name $BRANCH
only:
- master
when: always