aboutsummaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: 6c4b31206c8438947a1d83255462dddb1f367b82 (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
################################################################################
#
# !! DO NOT EDIT MANUALLY !!
#
# This file is generated by gitlab-ci-generator
#
################################################################################

stages:
  - lint
  - config
  # - infra_install
  # - virt_install
  # - apps
  # - check

variables:
  GIT_SUBMODULE_STRATEGY: recursive
  VAULT_FILE: .vault
  RUNNER_TAG: <SET ME>

################################################################################
# Shared parameters
################################################################################
.runner_tags: &runner_tags
  tags:
    - $RUNNER_TAG

.syntax_checking: &syntax_checking
  only:
    - pushes
  stage: lint

.artifacts_root: &artifacts_root
  name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
  paths:
    - vars/
    - inventory/

.artifacts: &artifacts
  artifacts:
    <<: *artifacts_root
    expire_in: 15 days

.artifacts_longexpire: &artifacts_longexpire
  artifacts:
    <<: *artifacts_root
    expire_in: 1 yrs

.runner_env: &runner_env
  CHAINED_CI_SRC: "<SET ME>" # Url to the gitlab chained ci project
  # CHAINED_CI_SRC: "https://gitlab.devops.telekom.de/tnap/onapcommunity/integrationproject/onapdeployment/chained-ci.git"

################################################################################
# Linting
################################################################################

yaml_checking:
  <<: *syntax_checking
  <<: *runner_tags
  variables:
    <<: *runner_env
  image: sdesbure/yamllint:latest
  script:
    - >
      yamllint -d "line-length: {
      max: 80,
      allow-non-breakable-words: true,
      allow-non-breakable-inline-mappings: true}"
      .gitlab-ci.yml
    - yamllint *.yml

ansible_linting:
  <<: *syntax_checking
  <<: *runner_tags
  variables:
    <<: *runner_env
  image: sdesbure/ansible-lint:latest
  script:
    - ansible-lint -x ANSIBLE0010,ANSIBLE0013 run-ci.yml

################################################################################
# Pages
################################################################################

pages:
  image: registry.gitlab.com/orange-opensource/lfn/ci_cd/docker_ansible:2.7.10-alpine
  stage: lint
  <<: *runner_tags
  variables:
    <<: *runner_env
  script:
    - ./chained-ci-vue/init.sh ./pod_inventory
  artifacts:
    paths:
      - public
  only:
    - master
  except:
    - triggers
    - api
    - external
    - pipelines
    - schedules
    - web


################################################################################
# Jobs
################################################################################

.vault_mgmt: &vault_mgmt
  before_script:
    - echo ${ANSIBLE_VAULT_PASSWORD} > ${PWD}/${VAULT_FILE}
  after_script:
    - rm -f $PWD/.vault

.set_config: &set_config
  <<: *runner_tags
  <<: *vault_mgmt
  image: registry.gitlab.com/orange-opensource/lfn/ci_cd/docker_ansible:2.7.10-alpine
  script:
    - >
      ansible-playbook -i pod_inventory/inventory --limit ${pod}
      --vault-password-file ${PWD}/${VAULT_FILE}
      ${ansible_verbose} artifacts_init.yml

.run_ci: &run_ci
  <<: *runner_tags
  <<: *vault_mgmt
  image: registry.gitlab.com/orange-opensource/lfn/ci_cd/docker_ansible:2.7.10-alpine
  script:
    - >
      ansible-playbook -i pod_inventory/inventory --limit ${pod}
      --extra-vars "step=${CI_JOB_NAME%:*}"
      --vault-password-file ${PWD}/${VAULT_FILE}
      ${ansible_verbose} run-ci.yml

.trigger: &trigger
  <<: *runner_tags
  <<: *vault_mgmt
  image: registry.gitlab.com/orange-opensource/lfn/ci_cd/docker_ansible:2.7.10-alpine
  script:
    - >
      ansible-playbook -i pod_inventory/inventory --limit ${pod}
      --vault-password-file ${PWD}/${VAULT_FILE}
      ${ansible_verbose} --extra-vars "step=trigger" trigger_myself.yml

################################################################################
# onap-daily-unh-oom-master
################################################################################

.onap-daily-unh-oom-master_global: &onap-daily-unh-oom-master_global
  variables:
    pod: onap-daily-unh-oom-master
    <<: *runner_env
  environment:
    name: unh/k8s8-8
  only:
    variables:
      - $POD == "onap-daily-unh-oom-master"
    refs:
      - web
      - schedules
      - triggers

config:onap-daily-unh-oom-master:
  stage: config
  <<: *onap-daily-unh-oom-master_global
  <<: *set_config
  <<: *artifacts_longexpire
# infra_deploy:onap-daily-unh-oom-master:
#   stage: infra_install
#   <<: *onap-daily-unh-oom-master_global
#   <<: *run_ci
#   <<: *artifacts_longexpire
# virt_install:onap-daily-unh-oom-master:
#   stage: virt_install
#   <<: *onap-daily-unh-oom-master_global
#   <<: *run_ci
#   <<: *artifacts_longexpire
# apps_deploy:onap-daily-unh-oom-master:
#   stage: apps
#   <<: *onap-daily-unh-oom-master_global
#   <<: *run_ci
#   <<: *artifacts_longexpire
# apps_test:onap-daily-unh-oom-master:
#   stage: check
#   <<: *onap-daily-unh-oom-master_global
#   <<: *run_ci

##
# End of generated file
##