This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
126 lines (109 loc) · 3.37 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
---
variables:
GITHUB_REPO: $CI_PROJECT_NAME
GITHUB_GROUP: enix
ANSIBLE_INVENTORY: "tests/inventory"
PYTHONUNBUFFERED: "1"
ANSIBLE_FORCE_COLOR: "true"
ANSIBLE_CALLBACK_RESULT_FORMAT: "yaml"
ANSIBLE_DISPLAY_SKIPPED_HOSTS: "false"
PY_COLORS: "1"
molecule:
stage: test
services:
- docker:24-dind
variables:
DOCKER_BUILDKIT: 1
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
DOCKER_DRIVER: overlay2
image: docker:24-dind
before_script:
- apk add --no-cache
python3 python3-dev py3-pip gcc git curl build-base
autoconf automake py3-cryptography linux-headers
musl-dev libffi-dev openssl-dev openssh rsync
- python3 -m pip install ansible molecule ansible-lint yamllint molecule-docker
- docker info
- python3 --version
- ansible --version
- ansible-lint --version
- yamllint --version
- molecule --version
script:
- molecule test --all -- -vv
tags:
- docker-dind
.ansible_test_template: &ansible_test
script:
- ansible --version
# Run linters. Does not fail if no errors reported
- ansible-lint --force-color . || true
- yamllint -f colored . || true
- ansible localhost -m setup
# Uncomment if your role have depends
# - ansible-galaxy install -v -r requirements.yml
- ansible-playbook tests/test.yml --syntax-check
- ansible-playbook -vvv --connection=local tests/test.yml
# - idempotence=$(mktemp)
# - ansible-playbook -vvv --connection=local tests/test.yml | tee ${idempotence}
# - >
# tail ${idempotence}
# | grep -q 'changed=0.*failed=0'
# && (echo 'Idempotence test: pass' && exit 0)
# || (echo 'Idempotence test: fail' && exit 1)
# This part is used to check role run.
# Add your own tests depending on your $ROLE
# - echo "=======> Starting output tests"
# We build using (ansiblecheck)[https://hub.docker.com/r/ansiblecheck/ansiblecheck/]
# images It provide a wide variety of OS container images to test with.
# most frequent ones included here
# debian-wheezy:
# image: ansiblecheck/ansiblecheck:debian-wheezy
# <<: *ansible_test
debian-jessie:
image: ansiblecheck/ansiblecheck:debian-jessie
<<: *ansible_test
debian-stretch:
image: ansiblecheck/ansiblecheck:debian-stretch
<<: *ansible_test
debian-buster:
image: registry.gitlab.com/lcaflc/ansiblecheck:debian-buster
<<: *ansible_test
debian-bullseye:
image: registry.gitlab.com/lcaflc/ansiblecheck:debian-bullseye
<<: *ansible_test
debian-bookworm:
image: registry.gitlab.com/lcaflc/ansiblecheck:debian-bookworm
<<: *ansible_test
ubuntu-bionic:
image: registry.gitlab.com/lcaflc/ansiblecheck:ubuntu-bionic
<<: *ansible_test
ubuntu-focal:
image: registry.gitlab.com/lcaflc/ansiblecheck:ubuntu-focal
<<: *ansible_test
ubuntu-jammy:
image: registry.gitlab.com/lcaflc/ansiblecheck:ubuntu-jammy
<<: *ansible_test
importgalaxy:
stage: deploy
image: registry.gitlab.com/lcaflc/ansiblecheck:debian-bookworm
only:
- main
- master
- tags
# when: on_success
before_script:
- ansible --version
script:
- ansible-galaxy role import ${GITHUB_GROUP} ${GITHUB_REPO} --token ${GALAXY_API_TOKEN}
# Trigger rebuild of enix install scripts
enixinstall:
stage: deploy
only:
- tags
trigger:
project: enix/install
strategy: depend