This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
208 lines (208 loc) · 7.33 KB
/
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
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
196
197
198
199
200
201
202
203
204
205
206
207
208
---
name: Pulp CI
on: pull_request
jobs:
git-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.1
- run: |
git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PyGithub
run: pip install pygithub
- name: Check commit message
env:
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
run: |
for sha in $(curl $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g')
do
python .github/validate_commit_message.py $sha
VALUE=$?
if [ "$VALUE" -gt 0 ]; then
exit $VALUE
fi
done
shell: bash
- name: Check submodule status
run: |
.ci/submodule_check.sh
molecule:
runs-on: ubuntu-20.04
needs: git-check
strategy:
fail-fast: false
# Testing different python versions because of
# https://pulp.plan.io/issues/5768#note-17
#
# Certain old versions are in distros:
# Fedora / EPEL8 / Ubuntu 20.04: ansible 2.9
# Debian 11 / Ubuntu 21.10: ansible 2.10
matrix:
include:
- test_type: release-static
ansible: "ansible~=2.9.0"
python: "2.7"
- test_type: source-static
ansible: "ansible-core" # currently at 2.13.0
python: "3.10"
- test_type: packages-static
ansible: "ansible~=2.10.0"
python: "3.7"
- test_type: release-cluster
ansible: "ansible-core~=2.12.0"
python: "3.8"
# We skip source-cluster for PR CI because no one probably does it.
- test_type: packages-cluster
ansible: "ansible" # currently at 5.3.0
python: "3.9"
- test_type: release-upgrade
ansible: "ansible-core~=2.11.0" # used by ansible==4.10.0
python: "3.6"
# We skip source-upgrade for PR CI because devs can always rebuild
# their vagrant environments.
- test_type: packages-upgrade
ansible: "ansible~=2.9.0"
python: "2.7"
steps:
- uses: actions/checkout@v2.3.1
- name: Configure the kernel to allow containers to talk to eachother
run: |
sudo sysctl net.bridge.bridge-nf-call-iptables=0
sudo sysctl net.bridge.bridge-nf-call-arptables=0
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
# devel_ci.yml is where we run the devel role. For performance.
- name: Configure source-static to not run the devel role
if: matrix.test_type == 'source-static'
run: |
sed -i '/pulp_devel/d' molecule/source-static/converge.yml
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --upgrade pip
- name: Install Python 2 packages
if: matrix.python == '2.7'
run: |
pip install "sh<1.13" "ruamel.yaml<0.17" "ruamel.yaml.clib<0.2.3"
- name: Install Python 3 packages
if: matrix.python != '2.7'
run: |
pip install molecule-docker
- name: Install Ansible & Molecule
run: |
sudo apt remove ansible
pip install docker molecule ${{ matrix.ansible }}
- name: Workaround bug with latest molecule and ansible 2.9
if: matrix.python != '2.7' && matrix.ansible == 'ansible~=2.9.0'
run: pip install molecule~=3.6.1 molecule-docker~=1.1
shell: bash
# Stable release 0.3.3 does not support Ansible 6 / ansible-core 2.13.
# Stable releases 0.2.z support Ansible 2.9, but not with collections support.
- name: Install mitogen (Ansible 2.10+)
if: matrix.ansible != 'ansible~=2.9.0'
run: |
cd ..
git clone https://github.com/mitogen-hq/mitogen.git
pip install ./mitogen
shell: bash
- name: Setting pulp.pulp_installer collection
# Downloading dependencies sometimes fails the 1st time, so retry
run: |
make vendor || make vendor
make install || make install
rm playbooks/resize_disk.yaml
ansible-galaxy collection install -p build/collections --force community.docker ||
ansible-galaxy collection install -p build/collections --force community.docker
shell: bash
- name: Molecule dependency
# Downloading dependencies sometimes fails the 1st time
run: |
ansible --version
molecule dependency --scenario-name ${{ matrix.test_type }} ||
molecule dependency --scenario-name ${{ matrix.test_type }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
shell: bash
- name: Molecule create & prepare
# Pulling images (for upgrades) sometimes fails the 1st time.
run: |
ansible --version
molecule create --scenario-name ${{ matrix.test_type }} ||
molecule create --scenario-name ${{ matrix.test_type }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
shell: bash
- name: Molecule converge
run: |
ansible --version
set +e
MITOGEN_LOCATION=$(pip show mitogen | grep Location | cut -f 2 -d " ")
set -e
if [ "$MITOGEN_LOCATION" != ""]; then
STRATEGY=mitogen_linear
MITOGEN_PATH=$MITOGEN_LOCATION/ansible_mitogen/plugins/strategy/
else
STRATEGY=linear # The default
fi
ANSIBLE_STRATEGY=${STRATEGY} ANSIBLE_STRATEGY_PLUGINS=${MITOGEN_PATH} molecule converge --scenario-name ${{ matrix.test_type }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
shell: bash
- name: Molecule idempotence
# release-upgrade is multi-phase upgrading, a non-idempotent playbook
# release-cluster takes the 2nd longest but is theoretically covered by
# release-static and packages-cluster
if: matrix.test_type != 'release-upgrade' && matrix.test_type != 'release-cluster'
run: |
ansible --version
molecule idempotence --scenario-name ${{ matrix.test_type }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
shell: bash
- name: Molecule verify
run: |
ansible --version
molecule verify --scenario-name ${{ matrix.test_type }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
shell: bash
lint:
runs-on: ubuntu-latest
needs: git-check
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2.3.1
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Ansible
run: |
pip install --upgrade pip
sudo apt remove ansible
pip install ansible-core
- name: Install Ansible-lint
run: |
# pulp_installer is now on maintenance, so limit the lint checks
pip install "ansible-lint[yamllint]<6.13"
- name: Lint test
run: |
ansible-lint
- name: Install Node.js dependencies
run: |
npm ci
- name: Lint documentation
run: |
npm test