Skip to content

Commit c1bc9d2

Browse files
RavenDB-24201: update CI wf according to ansible steering committee's review
1 parent 5a4931f commit c1bc9d2

File tree

2 files changed

+127
-172
lines changed

2 files changed

+127
-172
lines changed

.github/workflows/tests_role_ravendb_node.yml

Lines changed: 116 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -9,217 +9,165 @@ on:
99
- cron: "0 10 * * 1" # every Monday at 10:00 UTC
1010

1111
jobs:
12-
legacy-sanity:
13-
name: Ansible Sanity Tests (Python 2.7)
14-
runs-on: ubuntu-latest
15-
container:
16-
image: python:2.7
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
21-
- name: Fix collection path for ansible-test # should be removed once we restructure
22-
run: |
23-
mkdir -p ansible_collections/ravendb/ravendb
24-
tar --exclude=ansible_collections -cf - . | tar -C ansible_collections/ravendb/ravendb -xf -
25-
cd ansible_collections/ravendb/ravendb
26-
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install "ansible-core@https://github.com/ansible/ansible/archive/stable-2.9.tar.gz"
31-
32-
- name: Run ansible-test sanity
33-
working-directory: ansible_collections/ravendb/ravendb
34-
run: |
35-
ansible-test sanity --python 2.7 -v --color
36-
37-
sanity:
38-
name: Ansible Sanity Tests
12+
# sanity:
13+
# name: Ansible Sanity Tests
14+
# runs-on: ubuntu-latest
15+
# strategy:
16+
# matrix:
17+
# include:
18+
# - python-version: "3.12"
19+
# ansible-core: stable-2.16
20+
# - python-version: "3.12"
21+
# ansible-core: stable-2.17
22+
# - python-version: "3.13"
23+
# ansible-core: stable-2.18
24+
# - python-version: "3.13"
25+
# ansible-core: stable-2.19
26+
# - python-version: "3.13"
27+
# ansible-core: devel
28+
# steps:
29+
# - name: Checkout code
30+
# uses: actions/checkout@v4
31+
32+
# - name: Fix collection path for ansible-test
33+
# run: |
34+
# mkdir -p ansible_collections/ravendb/ravendb
35+
# rsync -av --exclude ansible_collections ./ ansible_collections/ravendb/ravendb
36+
# cd ansible_collections/ravendb/ravendb
37+
38+
# - name: Set up Python (host)
39+
# uses: actions/setup-python@v5
40+
# with:
41+
# python-version: ${{ matrix.python-version }}
42+
43+
# - name: Install dependencies
44+
# run: |
45+
# python -m pip install --upgrade pip
46+
# pip install "ansible-core@https://github.com/ansible/ansible/archive/${{ matrix.ansible-core }}.tar.gz"
47+
48+
# - name: Run ansible-test sanity
49+
# working-directory: ansible_collections/ravendb/ravendb
50+
# run: |
51+
# ansible-test sanity --docker -v --color
52+
53+
integration-and-unit:
54+
name: Integration + Unit Tests
3955
runs-on: ubuntu-latest
4056
strategy:
4157
matrix:
4258
include:
43-
- python-version: "3.10"
44-
ansible-core: stable-2.16
45-
- python-version: "3.11"
46-
ansible-core: stable-2.16
47-
- python-version: "3.12"
48-
ansible-core: stable-2.16
49-
50-
- python-version: "3.10"
51-
ansible-core: stable-2.17
52-
- python-version: "3.11"
53-
ansible-core: stable-2.17
54-
- python-version: "3.12"
55-
ansible-core: stable-2.17
56-
57-
- python-version: "3.11"
58-
ansible-core: stable-2.18
59-
- python-version: "3.12"
60-
ansible-core: stable-2.18
61-
- python-version: "3.13"
62-
ansible-core: stable-2.18
63-
59+
# - python-version: "3.10"
60+
# ansible-core: stable-2.16
61+
# - python-version: "3.11"
62+
# ansible-core: stable-2.16
63+
# - python-version: "3.12"
64+
# ansible-core: stable-2.16
65+
# - python-version: "3.10"
66+
# ansible-core: stable-2.17
67+
# - python-version: "3.11"
68+
# ansible-core: stable-2.17
69+
# - python-version: "3.12"
70+
# ansible-core: stable-2.17
71+
# - python-version: "3.11"
72+
# ansible-core: stable-2.18
73+
# - python-version: "3.12"
74+
# ansible-core: stable-2.18
75+
# - python-version: "3.13"
76+
# ansible-core: stable-2.18
6477
- python-version: "3.11"
6578
ansible-core: stable-2.19
6679
- python-version: "3.12"
6780
ansible-core: stable-2.19
6881
- python-version: "3.13"
6982
ansible-core: stable-2.19
70-
71-
- python-version: "3.11"
72-
ansible-core: devel
7383
- python-version: "3.12"
7484
ansible-core: devel
7585
- python-version: "3.13"
7686
ansible-core: devel
87+
7788
steps:
7889
- name: Checkout code
7990
uses: actions/checkout@v4
8091

81-
- name: Fix collection path for ansible-test #should be removed once we restructre
92+
- name: Fix collection path for ansible-test
8293
run: |
8394
mkdir -p ansible_collections/ravendb/ravendb
8495
rsync -av --exclude ansible_collections ./ ansible_collections/ravendb/ravendb
8596
cd ansible_collections/ravendb/ravendb
86-
87-
- name: Set up Python ${{ matrix.python-version }}
97+
98+
- name: Set up Python (host)
8899
uses: actions/setup-python@v5
89100
with:
90101
python-version: ${{ matrix.python-version }}
91102

92-
- name: Install dependencies
103+
- name: Install ASP.NET Core Runtime
93104
run: |
94-
python -m pip install --upgrade pip
95-
pip install "ansible-core@https://github.com/ansible/ansible/archive/${{ matrix.ansible-core }}.tar.gz"
105+
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
106+
chmod +x dotnet-install.sh
107+
./dotnet-install.sh --runtime aspnetcore --channel 8.0
96108
97-
- name: Run ansible-test sanity
98-
working-directory: ansible_collections/ravendb/ravendb
109+
- name: Uninstall old Molecule plugins
99110
run: |
100-
ansible-test sanity --python ${{ matrix.python-version }} --docker -v --color
101-
102-
test-debian-setup-scenarios:
103-
runs-on: ubuntu-latest
104-
steps:
105-
- name: Checkout code
106-
uses: actions/checkout@v4
107-
108-
- name: Set up Python 3
109-
uses: actions/setup-python@v2
110-
with:
111-
python-version: "3.x"
112-
113-
- name: Cache pip dependencies
114-
uses: actions/cache@v4
115-
with:
116-
path: ~/.cache/pip
117-
key: ${{ runner.os }}-pip
118-
restore-keys: |
119-
${{ runner.os }}-pip-
111+
pip uninstall -y molecule-docker molecule molecule-plugins[docker] community.docker docker
120112
121113
- name: Install dependencies
114+
env:
115+
ANSIBLE_COLLECTIONS_PATHS: ~/.ansible/collections:/usr/share/ansible/collections
122116
run: |
123117
python -m pip install --upgrade pip
124-
pip install ansible molecule molecule-docker docker
118+
pip install "ansible-core@https://github.com/ansible/ansible/archive/${{ matrix.ansible-core }}.tar.gz"
119+
pip install molecule molecule-plugins[docker] docker ravendb_test_driver
120+
ansible-galaxy collection install community.docker ansible.posix community.general
121+
122+
- name: Patch Molecule docker plugin for Ansible 2.19 or devel
123+
if: matrix.ansible-core == 'stable-2.19' || startsWith(matrix.ansible-core, 'devel')
124+
run: |
125+
for f in destroy.yml create.yml; do
126+
sed -i "s#(lookup('env', 'HOME'))#lookup('env', 'HOME') | bool#" \
127+
$(python -c "import molecule_plugins.docker as d, os; print(os.path.join(os.path.dirname(d.__file__), 'playbooks', '$f'))")
128+
done
125129
126130
- name: Set ansible roles path
127131
run: echo "ANSIBLE_ROLES_PATH=$GITHUB_WORKSPACE/roles" >> $GITHUB_ENV
128132

129-
- name: Run molecule unsecured scenario
133+
- name: Run Debian unsecured scenario
130134
working-directory: roles/ravendb_node
131135
run: molecule test -s unsecured
132-
133-
- name: Run molecule update scenario
136+
137+
- name: Run Debian update scenario
134138
working-directory: roles/ravendb_node
135139
run: molecule test -s update
136140

137-
- name: Run molecule clenaup scenario
141+
- name: Run Debian cleanup scenario
138142
working-directory: roles/ravendb_node
139143
run: molecule test -s cleanup
140144

141-
test-rhel-setup-scenarios:
142-
runs-on: ubuntu-latest
143-
steps:
144-
- name: Checkout code
145-
uses: actions/checkout@v4
146-
147-
- name: Set up Python 3
148-
uses: actions/setup-python@v2
149-
with:
150-
python-version: "3.x"
151-
152-
- name: Cache pip dependencies
153-
uses: actions/cache@v4
154-
with:
155-
path: ~/.cache/pip
156-
key: ${{ runner.os }}-pip
157-
restore-keys: |
158-
${{ runner.os }}-pip-
159-
160-
- name: Install dependencies
161-
run: |
162-
python -m pip install --upgrade pip
163-
pip install ansible molecule molecule-docker docker
164-
165-
- name: Set ansible roles path
166-
run: echo "ANSIBLE_ROLES_PATH=$GITHUB_WORKSPACE/roles" >> $GITHUB_ENV
167-
168-
- name: Run molecule unsecured-rhel scenario
169-
working-directory: roles/ravendb_node
170-
run: molecule test -s unsecured-rhel
145+
- name: Run RHEL unsecured scenario
146+
working-directory: roles/ravendb_node
147+
run: molecule test -s unsecured-rhel
148+
149+
- name: Run RHEL update scenario
150+
working-directory: roles/ravendb_node
151+
run: molecule test -s update-rhel
152+
153+
- name: Run RHEL cleanup scenario
154+
working-directory: roles/ravendb_node
155+
run: molecule test -s cleanup-rhel
156+
157+
# Unit tests
158+
- name: Build ansible galaxy collection
159+
run: |
160+
ansible-galaxy collection build .
161+
ansible-galaxy collection install ./ravendb-ravendb-*.tar.gz --force -p ./
162+
163+
- name: Set up .NET environment variables
164+
run: |
165+
export DOTNET_ROOT=$HOME/.dotnet
166+
export PATH=$PATH:$HOME/.dotnet
167+
source ~/.bashrc
168+
169+
- name: Change to ravendb_node role directory
170+
run: cd roles/ravendb_node
171171

172-
- name: Run molecule update-rhel scenario
173-
working-directory: roles/ravendb_node
174-
run: molecule test -s update-rhel
175-
176-
- name: Run molecule clenaup-rhel scenario
177-
working-directory: roles/ravendb_node
178-
run: molecule test -s cleanup-rhel
179-
180-
test-ravendb-modules:
181-
runs-on: ubuntu-latest
182-
steps:
183-
- name: Checkout code
184-
uses: actions/checkout@v4
185-
186-
- name: Set up Python 3
187-
uses: actions/setup-python@v2
188-
with:
189-
python-version: "3.x"
190-
191-
- name: Cache pip dependencies
192-
uses: actions/cache@v4
193-
with:
194-
path: ~/.cache/pip
195-
key: ${{ runner.os }}-pip
196-
restore-keys: |
197-
${{ runner.os }}-pip-
198-
199-
- name: Install ASP.NET Core Runtime
200-
run: |
201-
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
202-
chmod +x dotnet-install.sh
203-
./dotnet-install.sh --runtime aspnetcore --channel 8.0
204-
205-
- name: Install dependencies
206-
run: |
207-
python -m pip install --upgrade pip
208-
pip install ansible molecule molecule-docker docker ravendb_test_driver
209-
210-
- name: Build ansible galaxy collection
211-
run: |
212-
ansible-galaxy collection build .
213-
ansible-galaxy collection install ./ravendb-ravendb-*.tar.gz --force -p ./
214-
215-
- name: Set up .NET environment variables
216-
run: |
217-
export DOTNET_ROOT=$HOME/.dotnet
218-
export PATH=$PATH:$HOME/.dotnet
219-
source ~/.bashrc
220-
221-
- name: Change to ravendb_node role directory
222-
run: cd roles/ravendb_node
223-
224-
- name: Run modules unit tests
225-
run: python3 -m unittest discover -s tests/unit -v
172+
- name: Run modules unit tests
173+
run: python3 -m unittest discover -s tests/unit -v

roles/ravendb_node/tasks/install.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@
112112
extra_opts:
113113
- --transform
114114
- s/^RavenDB\/Server//
115-
when: ravendb_should_update_binaries
115+
when:
116+
- ravendb_should_update_binaries is defined
117+
- ravendb_should_update_binaries | bool
116118
tags: binaries
117119
when: ansible_facts['os_family'] | lower == 'redhat'
118120

@@ -191,7 +193,9 @@
191193
owner: root
192194
group: ravendb
193195
mode: '0644'
194-
when: ravendb_should_update_binaries
196+
when:
197+
- ravendb_should_update_binaries is defined
198+
- ravendb_should_update_binaries | bool
195199
tags: config,ravendb_settings
196200

197201
- block:
@@ -213,7 +217,8 @@
213217
- libsodium
214218
- libzstd
215219
when:
216-
- ravendb_should_update_binaries
220+
- ravendb_should_update_binaries is defined
221+
- ravendb_should_update_binaries | bool
217222
- ravendb_version is regex('^4\.') and item != 'libzstd'
218223
tags: binaries
219224

@@ -225,7 +230,9 @@
225230
- librvnpal
226231
- libsodium
227232
- libzstd
228-
when: ravendb_should_update_binaries
233+
when:
234+
- ravendb_should_update_binaries is defined
235+
- ravendb_should_update_binaries | bool
229236
tags: binaries
230237

231238
- name: Adjust binaries permissions

0 commit comments

Comments
 (0)