Skip to content

Commit 23d7df0

Browse files
committed
Refactor CI workflows to use specific CentOS images and add alternative OS testing
1 parent 1ddd999 commit 23d7df0

File tree

12 files changed

+2498
-2492
lines changed

12 files changed

+2498
-2492
lines changed

.github/workflows/alt-os-test.yml

Lines changed: 166 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1,167 +1,167 @@
1-
name: Alternative OS Test (Fallback)
2-
3-
on:
4-
workflow_dispatch: # Manual trigger only
5-
schedule:
6-
- cron: '0 3 * * 0' # Weekly on Sunday at 3 AM
7-
8-
jobs:
9-
test-alternative-images:
10-
name: Test Alternative Images
11-
runs-on: ubuntu-latest
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
include:
16-
# Use alternative base images if primary ones fail
17-
- os: amazonlinux:2023
18-
name: "Amazon Linux 2023"
19-
package_manager: dnf
20-
- os: oraclelinux:8
21-
name: "Oracle Linux 8"
22-
package_manager: dnf
23-
- os: oraclelinux:9
24-
name: "Oracle Linux 9"
25-
package_manager: dnf
26-
- os: redhat/ubi8
27-
name: "Red Hat UBI 8"
28-
package_manager: dnf
29-
- os: redhat/ubi9
30-
name: "Red Hat UBI 9"
31-
package_manager: dnf
32-
steps:
33-
- name: Checkout code
34-
uses: actions/checkout@v4
35-
36-
- name: Test on ${{ matrix.name }}
37-
run: |
38-
echo "Testing on ${{ matrix.name }}"
39-
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.os }} bash -c '
40-
set -e
41-
42-
# Update package list and install basic tools
43-
if command -v ${{ matrix.package_manager }} >/dev/null; then
44-
${{ matrix.package_manager }} update -y -q
45-
${{ matrix.package_manager }} install -y -q curl wget socat cronie procps-ng || \
46-
${{ matrix.package_manager }} install -y -q curl wget socat crontabs procps-ng
47-
else
48-
echo "Package manager not found, skipping dependency installation"
49-
fi
50-
51-
# Make script executable
52-
chmod +x cert_manager.sh
53-
54-
# Test script syntax
55-
bash -n cert_manager.sh || exit 1
56-
echo "✅ Syntax check passed on ${{ matrix.name }}"
57-
58-
# Test basic menu display
59-
echo "0" | timeout 10s ./cert_manager.sh >/dev/null 2>&1 || true
60-
echo "✅ Basic execution test passed on ${{ matrix.name }}"
61-
62-
# Test dependency availability
63-
which curl >/dev/null && echo "✅ curl available"
64-
which wget >/dev/null && echo "✅ wget available"
65-
which socat >/dev/null && echo "✅ socat available"
66-
(which cronie >/dev/null || which cron >/dev/null || which crontabs >/dev/null) && echo "✅ cron service available"
67-
68-
echo "✅ All tests passed on ${{ matrix.name }}"
69-
' || {
70-
echo "⚠️ Test failed on ${{ matrix.name }}, but continuing..."
71-
exit 0
72-
}
73-
74-
test-minimal-containers:
75-
name: Test Minimal Containers
76-
runs-on: ubuntu-latest
77-
strategy:
78-
fail-fast: false
79-
matrix:
80-
include:
81-
# Test with minimal/scratch containers that might not have all tools
82-
- os: alpine:latest
83-
name: "Alpine Linux"
84-
package_manager: apk
85-
- os: alpine:3.18
86-
name: "Alpine Linux 3.18"
87-
package_manager: apk
88-
- os: busybox:latest
89-
name: "BusyBox"
90-
package_manager: none
91-
steps:
92-
- name: Checkout code
93-
uses: actions/checkout@v4
94-
95-
- name: Test on ${{ matrix.name }}
96-
run: |
97-
echo "Testing on ${{ matrix.name }}"
98-
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.os }} sh -c '
99-
set -e
100-
101-
# Install bash first (if possible)
102-
if [ "${{ matrix.package_manager }}" = "apk" ]; then
103-
apk update -q
104-
apk add --no-cache bash curl wget socat dcron procps
105-
elif [ "${{ matrix.package_manager }}" = "none" ]; then
106-
echo "⚠️ Minimal container - limited testing"
107-
fi
108-
109-
# Test if bash is available
110-
if command -v bash >/dev/null; then
111-
chmod +x cert_manager.sh
112-
113-
# Test script syntax
114-
bash -n cert_manager.sh || exit 1
115-
echo "✅ Syntax check passed on ${{ matrix.name }}"
116-
117-
# Test basic execution (very brief)
118-
echo "0" | timeout 5s bash cert_manager.sh >/dev/null 2>&1 || true
119-
echo "✅ Basic execution test passed on ${{ matrix.name }}"
120-
else
121-
echo "⚠️ Bash not available on ${{ matrix.name }}"
122-
fi
123-
124-
echo "✅ Tests completed on ${{ matrix.name }}"
125-
' || {
126-
echo "⚠️ Some tests failed on ${{ matrix.name }}, but this is expected for minimal containers"
127-
exit 0
128-
}
129-
130-
compatibility-summary:
131-
name: Alternative Compatibility Summary
132-
runs-on: ubuntu-latest
133-
needs: [test-alternative-images, test-minimal-containers]
134-
if: always()
135-
steps:
136-
- name: Generate summary
137-
run: |
138-
echo "## Alternative OS Test Results" > alt_compatibility_report.md
139-
echo "" >> alt_compatibility_report.md
140-
echo "| Test Suite | Status |" >> alt_compatibility_report.md
141-
echo "|------------|--------|" >> alt_compatibility_report.md
142-
143-
if [ "${{ needs.test-alternative-images.result }}" = "success" ]; then
144-
echo "| Alternative RHEL-based Images | ✅ Pass |" >> alt_compatibility_report.md
145-
else
146-
echo "| Alternative RHEL-based Images | ⚠️ Partial |" >> alt_compatibility_report.md
147-
fi
148-
149-
if [ "${{ needs.test-minimal-containers.result }}" = "success" ]; then
150-
echo "| Minimal Containers | ✅ Pass |" >> alt_compatibility_report.md
151-
else
152-
echo "| Minimal Containers | ⚠️ Limited |" >> alt_compatibility_report.md
153-
fi
154-
155-
echo "" >> alt_compatibility_report.md
156-
echo "**Note:** This is a fallback test suite for alternative container images." >> alt_compatibility_report.md
157-
echo "" >> alt_compatibility_report.md
158-
echo "Generated on: $(date)" >> alt_compatibility_report.md
159-
160-
cat alt_compatibility_report.md
161-
162-
- name: Upload alternative report
163-
uses: actions/upload-artifact@v4
164-
with:
165-
name: alternative-compatibility-report
166-
path: alt_compatibility_report.md
1+
name: Alternative OS Test (Fallback)
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
schedule:
6+
- cron: '0 3 * * 0' # Weekly on Sunday at 3 AM
7+
8+
jobs:
9+
test-alternative-images:
10+
name: Test Alternative Images
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
# Use alternative base images if primary ones fail
17+
- os: amazonlinux:2023
18+
name: "Amazon Linux 2023"
19+
package_manager: dnf
20+
- os: oraclelinux:8
21+
name: "Oracle Linux 8"
22+
package_manager: dnf
23+
- os: oraclelinux:9
24+
name: "Oracle Linux 9"
25+
package_manager: dnf
26+
- os: redhat/ubi8
27+
name: "Red Hat UBI 8"
28+
package_manager: dnf
29+
- os: redhat/ubi9
30+
name: "Red Hat UBI 9"
31+
package_manager: dnf
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
36+
- name: Test on ${{ matrix.name }}
37+
run: |
38+
echo "Testing on ${{ matrix.name }}"
39+
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.os }} bash -c '
40+
set -e
41+
42+
# Update package list and install basic tools
43+
if command -v ${{ matrix.package_manager }} >/dev/null; then
44+
${{ matrix.package_manager }} update -y -q
45+
${{ matrix.package_manager }} install -y -q curl wget socat cronie procps-ng || \
46+
${{ matrix.package_manager }} install -y -q curl wget socat crontabs procps-ng
47+
else
48+
echo "Package manager not found, skipping dependency installation"
49+
fi
50+
51+
# Make script executable
52+
chmod +x cert_manager.sh
53+
54+
# Test script syntax
55+
bash -n cert_manager.sh || exit 1
56+
echo "✅ Syntax check passed on ${{ matrix.name }}"
57+
58+
# Test basic menu display
59+
echo "0" | timeout 10s ./cert_manager.sh >/dev/null 2>&1 || true
60+
echo "✅ Basic execution test passed on ${{ matrix.name }}"
61+
62+
# Test dependency availability
63+
which curl >/dev/null && echo "✅ curl available"
64+
which wget >/dev/null && echo "✅ wget available"
65+
which socat >/dev/null && echo "✅ socat available"
66+
(which cronie >/dev/null || which cron >/dev/null || which crontabs >/dev/null) && echo "✅ cron service available"
67+
68+
echo "✅ All tests passed on ${{ matrix.name }}"
69+
' || {
70+
echo "⚠️ Test failed on ${{ matrix.name }}, but continuing..."
71+
exit 0
72+
}
73+
74+
test-minimal-containers:
75+
name: Test Minimal Containers
76+
runs-on: ubuntu-latest
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
include:
81+
# Test with minimal/scratch containers that might not have all tools
82+
- os: alpine:latest
83+
name: "Alpine Linux"
84+
package_manager: apk
85+
- os: alpine:3.18
86+
name: "Alpine Linux 3.18"
87+
package_manager: apk
88+
- os: busybox:latest
89+
name: "BusyBox"
90+
package_manager: none
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
95+
- name: Test on ${{ matrix.name }}
96+
run: |
97+
echo "Testing on ${{ matrix.name }}"
98+
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.os }} sh -c '
99+
set -e
100+
101+
# Install bash first (if possible)
102+
if [ "${{ matrix.package_manager }}" = "apk" ]; then
103+
apk update -q
104+
apk add --no-cache bash curl wget socat dcron procps
105+
elif [ "${{ matrix.package_manager }}" = "none" ]; then
106+
echo "⚠️ Minimal container - limited testing"
107+
fi
108+
109+
# Test if bash is available
110+
if command -v bash >/dev/null; then
111+
chmod +x cert_manager.sh
112+
113+
# Test script syntax
114+
bash -n cert_manager.sh || exit 1
115+
echo "✅ Syntax check passed on ${{ matrix.name }}"
116+
117+
# Test basic execution (very brief)
118+
echo "0" | timeout 5s bash cert_manager.sh >/dev/null 2>&1 || true
119+
echo "✅ Basic execution test passed on ${{ matrix.name }}"
120+
else
121+
echo "⚠️ Bash not available on ${{ matrix.name }}"
122+
fi
123+
124+
echo "✅ Tests completed on ${{ matrix.name }}"
125+
' || {
126+
echo "⚠️ Some tests failed on ${{ matrix.name }}, but this is expected for minimal containers"
127+
exit 0
128+
}
129+
130+
compatibility-summary:
131+
name: Alternative Compatibility Summary
132+
runs-on: ubuntu-latest
133+
needs: [test-alternative-images, test-minimal-containers]
134+
if: always()
135+
steps:
136+
- name: Generate summary
137+
run: |
138+
echo "## Alternative OS Test Results" > alt_compatibility_report.md
139+
echo "" >> alt_compatibility_report.md
140+
echo "| Test Suite | Status |" >> alt_compatibility_report.md
141+
echo "|------------|--------|" >> alt_compatibility_report.md
142+
143+
if [ "${{ needs.test-alternative-images.result }}" = "success" ]; then
144+
echo "| Alternative RHEL-based Images | ✅ Pass |" >> alt_compatibility_report.md
145+
else
146+
echo "| Alternative RHEL-based Images | ⚠️ Partial |" >> alt_compatibility_report.md
147+
fi
148+
149+
if [ "${{ needs.test-minimal-containers.result }}" = "success" ]; then
150+
echo "| Minimal Containers | ✅ Pass |" >> alt_compatibility_report.md
151+
else
152+
echo "| Minimal Containers | ⚠️ Limited |" >> alt_compatibility_report.md
153+
fi
154+
155+
echo "" >> alt_compatibility_report.md
156+
echo "**Note:** This is a fallback test suite for alternative container images." >> alt_compatibility_report.md
157+
echo "" >> alt_compatibility_report.md
158+
echo "Generated on: $(date)" >> alt_compatibility_report.md
159+
160+
cat alt_compatibility_report.md
161+
162+
- name: Upload alternative report
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: alternative-compatibility-report
166+
path: alt_compatibility_report.md
167167
retention-days: 30

0 commit comments

Comments
 (0)