summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 47a17a0cdc04669520689a79b31b69cf36a0066e (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
# You can override the included template(s) by including variable overrides
# See https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "web"'

stages:
- build
- test
- deploy

build-job:
  stage: build
  tags: 
    - loufux-docker
  image: ansible
  script:
    - ansible-galaxy install git+https://gitlab.com/loufux/ansible/helloworld.git
    - ansible-galaxy list
  artifacts:
    paths:
      - /root/.ansible/roles/helloworld

syntax-check-job:
  stage: test
  tags:
    - loufux-docker
  image: ansible
  script:
    - ansible-playbook .ansible/roles/helloworld/tests/test.yml -i .ansible/roles/helloworld/tests/inventory --syntax-check ||true

lint-test-job:
  stage: test
  tags:
    - loufux-docker
  image: ansible
  script:
    - ansible-lint -p .ansible/roles/helloworld/tests/test.yml | ansible-lint-junit -o ansible-lint.xml || true
  artifacts:
    reports:
      junit: ansible-lint.xml


deploy-job:
  stage: deploy
  tags:
    - loufux-docker
  image: ansible
  script:
    - ansible-playbook .ansible/roles/helloworld/tests/test.yml -i .ansible/roles/helloworld/tests/inventory