Skip to content

Commit 4fa28ba

Browse files
committed
CI: Remove the molecule action usage from pull-request-management workflow
1 parent d751048 commit 4fa28ba

File tree

3 files changed

+100
-66
lines changed

3 files changed

+100
-66
lines changed

.github/molecule-runner.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
#
3+
# Purpose: Molecule runner for github-action
4+
# Author: @titom73
5+
# Date: 2020-12-16
6+
# Version: 1.1
7+
# License: APACHE
8+
# --------------------------------------
9+
10+
echo "Script running from ${PWD}"
11+
12+
# Set default values
13+
INPUT_CHECK_GIT="${INPUT_CHECK_GIT:-true}"
14+
INPUT_CHECK_GIT_ENFORCED="${INPUT_CHECK_GIT_ENFORCED:-true}"
15+
16+
echo "INPUT_CHECK_GIT: $INPUT_CHECK_GIT"
17+
echo "INPUT_CHECK_GIT_ENFORCED: $INPUT_CHECK_GIT_ENFORCED"
18+
19+
if [ ${INPUT_CHECK_GIT} = "true" ]; then
20+
git config core.fileMode false
21+
echo " * Run Git Verifier because CHECK_GIT is set to ${INPUT_CHECK_GIT}"
22+
# if git diff-index --quiet HEAD --; then
23+
GIT_STATUS="$(git status --porcelain)"
24+
if [ "$?" -ne "0" ]; then
25+
echo "'git status --porcelain' failed to run - something is wrong"
26+
exit 1
27+
fi
28+
if [ -n "$GIT_STATUS" ]; then
29+
# Some changes
30+
echo 'Some changes'
31+
echo '------------'
32+
git --no-pager status --short
33+
echo ''
34+
echo 'Diffs are:'
35+
echo '------------'
36+
git --no-pager diff
37+
if [ ${INPUT_CHECK_GIT_ENFORCED} = "true" ]; then
38+
exit 1
39+
else
40+
exit 0
41+
fi
42+
else
43+
# No Changes
44+
echo ' - No change found after running Molecule'
45+
exit 0
46+
fi
47+
exit 0
48+
else
49+
echo " * Git verifier skipped as not set to true"
50+
fi

.github/requirements-ci-dev.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Installing PyAVD from source.
22
# The package path below is relative to the repo root and will only work if the pip install is executed from there.
33
./python-avd[ansible-collection]
4+
molecule>=6.0
5+
molecule-plugins[docker]>=23.4.0

.github/workflows/pull-request-management.yml

+48-66
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,14 @@ jobs:
149149
if: needs.file-changes.outputs.config_gen == 'true'
150150
steps:
151151
- uses: actions/checkout@v4
152-
- name: Run molecule action
153-
uses: arista-netdevops-community/[email protected]
154-
with:
155-
molecule_parentdir: "ansible_collections/arista/avd"
156-
molecule_command: "test"
157-
molecule_args: "--scenario-name ${{ matrix.avd_scenario }}"
158-
pip_file: .github/requirements-ci-dev.txt
159-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
160-
ansible: ${{ matrix.ansible_version }}
161-
check_git: true
162-
check_git_enforced: true
152+
- name: Run molecule test
153+
run: |
154+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
155+
cd ansible_collections/arista/avd
156+
molecule test --scenario-name ${{ matrix.avd_scenario }}
157+
- name: Check GIT status
158+
run: |
159+
.github/molecule-runner.sh
163160
# - uses: actions/upload-artifact@v4
164161
# with:
165162
# name: molecule-${{ matrix.avd_scenario }}-artifacts
@@ -180,17 +177,14 @@ jobs:
180177
if: needs.file-changes.outputs.dhcp == 'true'
181178
steps:
182179
- uses: actions/checkout@v4
183-
- name: Run molecule action
184-
uses: arista-netdevops-community/[email protected]
185-
with:
186-
molecule_parentdir: "ansible_collections/arista/avd"
187-
molecule_command: "test"
188-
molecule_args: "--scenario-name ${{ matrix.avd_scenario }}"
189-
pip_file: .github/requirements-ci-dev.txt
190-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
191-
ansible: ${{ matrix.ansible_version }}
192-
check_git: true
193-
check_git_enforced: true
180+
- name: Run molecule test
181+
run: |
182+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
183+
cd ansible_collections/arista/avd
184+
molecule test --scenario-name ${{ matrix.avd_scenario }}
185+
- name: Check GIT status
186+
run: |
187+
.github/molecule-runner.sh
194188
# - uses: actions/upload-artifact@v4
195189
# with:
196190
# name: molecule-${{ matrix.avd_scenario }}-artifacts
@@ -249,17 +243,14 @@ jobs:
249243
uv pip compile .github/requirements-ci-dev.txt --resolution=lowest-direct > ${{ matrix.pip_requirements }}
250244
cat ${{ matrix.pip_requirements }}
251245
if: matrix.pip_requirements == 'tmp-requirements-minimum.txt'
252-
- name: Run molecule action
253-
uses: arista-netdevops-community/[email protected]
254-
with:
255-
molecule_parentdir: "ansible_collections/arista/avd"
256-
molecule_command: "test"
257-
molecule_args: "--scenario-name ${{ matrix.avd_scenario }}"
258-
pip_file: ${{ matrix.pip_requirements }}
259-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
260-
ansible: ${{ matrix.ansible_version }}
261-
check_git: true
262-
check_git_enforced: true
246+
- name: Run molecule test
247+
run: |
248+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
249+
cd ansible_collections/arista/avd
250+
molecule test --scenario-name ${{ matrix.avd_scenario }}
251+
- name: Check GIT status
252+
run: |
253+
.github/molecule-runner.sh
263254
# - uses: actions/upload-artifact@v4
264255
# with:
265256
# name: molecule-${{ matrix.avd_scenario }}-artifacts
@@ -285,17 +276,14 @@ jobs:
285276

286277
steps:
287278
- uses: actions/checkout@v4
288-
- name: Run molecule action
289-
uses: arista-netdevops-community/[email protected]
290-
with:
291-
molecule_parentdir: "ansible_collections/arista/avd"
292-
molecule_command: "test"
293-
molecule_args: "--scenario-name ${{ matrix.avd_scenario }}"
294-
pip_file: .github/requirements-ci-dev.txt
295-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
296-
ansible: ${{ matrix.ansible_version }}
297-
check_git: true
298-
check_git_enforced: true
279+
- name: Run molecule test
280+
run: |
281+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
282+
cd ansible_collections/arista/avd
283+
molecule test --scenario-name ${{ matrix.avd_scenario }}
284+
- name: Check GIT status
285+
run: |
286+
.github/molecule-runner.sh
299287
# - uses: actions/upload-artifact@v4
300288
# with:
301289
# name: molecule-${{ matrix.avd_scenario }}-artifacts
@@ -321,17 +309,14 @@ jobs:
321309
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.anta_runner == 'true'
322310
steps:
323311
- uses: actions/checkout@v4
324-
- name: Run molecule action
325-
uses: arista-netdevops-community/[email protected]
326-
with:
327-
molecule_parentdir: 'ansible_collections/arista/avd'
328-
molecule_command: 'test'
329-
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
330-
pip_file: .github/requirements-ci-dev.txt
331-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
332-
ansible: ${{ matrix.ansible_version }}
333-
check_git: true
334-
check_git_enforced: true
312+
- name: Run molecule test
313+
run: |
314+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
315+
cd ansible_collections/arista/avd
316+
molecule test --scenario-name ${{ matrix.avd_scenario }}
317+
- name: Check GIT status
318+
run: |
319+
.github/molecule-runner.sh
335320
336321
# ----------------------------------- #
337322
# EOS Validate State MOLECULE
@@ -353,17 +338,14 @@ jobs:
353338
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true'
354339
steps:
355340
- uses: actions/checkout@v4
356-
- name: Run molecule action
357-
uses: arista-netdevops-community/[email protected]
358-
with:
359-
molecule_parentdir: "ansible_collections/arista/avd"
360-
molecule_command: "test"
361-
molecule_args: "--scenario-name ${{ matrix.avd_scenario }}"
362-
pip_file: .github/requirements-ci-dev.txt
363-
galaxy_file: "ansible_collections/arista/avd/collections.yml"
364-
ansible: ${{ matrix.ansible_version }}
365-
check_git: true
366-
check_git_enforced: true
341+
- name: Run molecule test
342+
run: |
343+
pip install -r .github/requirements-ci-dev.txt {{ matrix.ansible_version}}
344+
cd ansible_collections/arista/avd
345+
molecule test --scenario-name ${{ matrix.avd_scenario }}
346+
- name: Check GIT status
347+
run: |
348+
.github/molecule-runner.sh
367349
368350
# ----------------------------------- #
369351
# Ansible tests

0 commit comments

Comments
 (0)