|
| 1 | +name: Test Ceph on Arm64 |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - smoke_tests |
| 10 | + paths: |
| 11 | + - 'content/opensource_packages/ceph.md' |
| 12 | + - '.github/workflows/test-ceph.yml' |
| 13 | + |
| 14 | +jobs: |
| 15 | + test-ceph: |
| 16 | + runs-on: ubuntu-24.04-arm |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set test metadata |
| 23 | + id: metadata |
| 24 | + run: | |
| 25 | + echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT |
| 26 | + echo "package_slug=ceph" >> $GITHUB_OUTPUT |
| 27 | + echo "dashboard_link=/opensource_packages/ceph" >> $GITHUB_OUTPUT |
| 28 | + |
| 29 | + # ============================================================ |
| 30 | + # Install Ceph |
| 31 | + # ============================================================ |
| 32 | + - name: Install Ceph |
| 33 | + id: install |
| 34 | + run: | |
| 35 | + echo "Installing Ceph..." |
| 36 | + |
| 37 | + # Install Ceph from Ubuntu repository |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get install -y ceph ceph-common cephadm |
| 40 | + |
| 41 | + # Verify installation |
| 42 | + if command -v ceph &> /dev/null; then |
| 43 | + echo "Ceph installed successfully" |
| 44 | + echo "install_status=success" >> $GITHUB_OUTPUT |
| 45 | + else |
| 46 | + echo "Ceph installation failed" |
| 47 | + echo "install_status=failed" >> $GITHUB_OUTPUT |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | + |
| 51 | + # ============================================================ |
| 52 | + # Detect version |
| 53 | + # ============================================================ |
| 54 | + - name: Detect Ceph version |
| 55 | + id: version |
| 56 | + run: | |
| 57 | + VERSION=$(ceph --version | grep -oP '(?<=ceph version )[0-9.]+') |
| 58 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 59 | + echo "Detected Ceph version: $VERSION" |
| 60 | + ceph --version |
| 61 | + |
| 62 | + # ============================================================ |
| 63 | + # Run tests |
| 64 | + # ============================================================ |
| 65 | + - name: Test 1 - Check ceph client binary exists |
| 66 | + id: test1 |
| 67 | + run: | |
| 68 | + START_TIME=$(date +%s) |
| 69 | + |
| 70 | + if command -v ceph &> /dev/null; then |
| 71 | + echo "✓ ceph command found" |
| 72 | + which ceph |
| 73 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 74 | + else |
| 75 | + echo "✗ ceph command not found" |
| 76 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 77 | + exit 1 |
| 78 | + fi |
| 79 | + |
| 80 | + END_TIME=$(date +%s) |
| 81 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 82 | + |
| 83 | + - name: Test 2 - Check cephadm binary exists |
| 84 | + id: test2 |
| 85 | + run: | |
| 86 | + START_TIME=$(date +%s) |
| 87 | + |
| 88 | + if command -v cephadm &> /dev/null; then |
| 89 | + echo "✓ cephadm command found" |
| 90 | + which cephadm |
| 91 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 92 | + else |
| 93 | + echo "✗ cephadm command not found" |
| 94 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 95 | + exit 1 |
| 96 | + fi |
| 97 | + |
| 98 | + END_TIME=$(date +%s) |
| 99 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 100 | + |
| 101 | + - name: Test 3 - Check Ceph version command |
| 102 | + id: test3 |
| 103 | + run: | |
| 104 | + START_TIME=$(date +%s) |
| 105 | + |
| 106 | + if ceph --version | grep -q "ceph version"; then |
| 107 | + echo "✓ Ceph version check passed" |
| 108 | + ceph --version |
| 109 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 110 | + else |
| 111 | + echo "✗ Ceph version check failed" |
| 112 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 113 | + exit 1 |
| 114 | + fi |
| 115 | + |
| 116 | + END_TIME=$(date +%s) |
| 117 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 118 | + |
| 119 | + - name: Test 4 - Check rados binary (RADOS object store) |
| 120 | + id: test4 |
| 121 | + run: | |
| 122 | + START_TIME=$(date +%s) |
| 123 | + |
| 124 | + if command -v rados &> /dev/null; then |
| 125 | + echo "✓ rados command found" |
| 126 | + which rados |
| 127 | + rados --version 2>&1 || echo "rados binary exists" |
| 128 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 129 | + else |
| 130 | + echo "✗ rados command not found" |
| 131 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 132 | + exit 1 |
| 133 | + fi |
| 134 | + |
| 135 | + END_TIME=$(date +%s) |
| 136 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 137 | + |
| 138 | + - name: Test 5 - Check rbd binary (RADOS Block Device) |
| 139 | + id: test5 |
| 140 | + run: | |
| 141 | + START_TIME=$(date +%s) |
| 142 | + |
| 143 | + if command -v rbd &> /dev/null; then |
| 144 | + echo "✓ rbd command found" |
| 145 | + which rbd |
| 146 | + rbd --version 2>&1 || echo "rbd binary exists" |
| 147 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 148 | + else |
| 149 | + echo "✗ rbd command not found" |
| 150 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 151 | + exit 1 |
| 152 | + fi |
| 153 | + |
| 154 | + END_TIME=$(date +%s) |
| 155 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 156 | + |
| 157 | + - name: Test 6 - Check cephfs binary (Ceph File System) |
| 158 | + id: test6 |
| 159 | + run: | |
| 160 | + START_TIME=$(date +%s) |
| 161 | + |
| 162 | + if command -v cephfs &> /dev/null || command -v ceph-fuse &> /dev/null; then |
| 163 | + echo "✓ CephFS related command found" |
| 164 | + if command -v ceph-fuse &> /dev/null; then |
| 165 | + which ceph-fuse |
| 166 | + ceph-fuse --version 2>&1 || echo "ceph-fuse binary exists" |
| 167 | + fi |
| 168 | + echo "status=passed" >> $GITHUB_OUTPUT |
| 169 | + else |
| 170 | + echo "✗ CephFS related commands not found" |
| 171 | + echo "status=failed" >> $GITHUB_OUTPUT |
| 172 | + exit 1 |
| 173 | + fi |
| 174 | + |
| 175 | + END_TIME=$(date +%s) |
| 176 | + echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT |
| 177 | + |
| 178 | + # ============================================================ |
| 179 | + # Calculate summary |
| 180 | + # ============================================================ |
| 181 | + - name: Calculate test summary |
| 182 | + if: always() |
| 183 | + id: summary |
| 184 | + run: | |
| 185 | + PASSED=0 |
| 186 | + FAILED=0 |
| 187 | + TOTAL_DURATION=0 |
| 188 | + |
| 189 | + # Test 1 |
| 190 | + if [ "${{ steps.test1.outputs.status }}" == "passed" ]; then |
| 191 | + PASSED=$((PASSED + 1)) |
| 192 | + else |
| 193 | + FAILED=$((FAILED + 1)) |
| 194 | + fi |
| 195 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test1.outputs.duration || 0 }})) |
| 196 | + |
| 197 | + # Test 2 |
| 198 | + if [ "${{ steps.test2.outputs.status }}" == "passed" ]; then |
| 199 | + PASSED=$((PASSED + 1)) |
| 200 | + else |
| 201 | + FAILED=$((FAILED + 1)) |
| 202 | + fi |
| 203 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test2.outputs.duration || 0 }})) |
| 204 | + |
| 205 | + # Test 3 |
| 206 | + if [ "${{ steps.test3.outputs.status }}" == "passed" ]; then |
| 207 | + PASSED=$((PASSED + 1)) |
| 208 | + else |
| 209 | + FAILED=$((FAILED + 1)) |
| 210 | + fi |
| 211 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test3.outputs.duration || 0 }})) |
| 212 | + |
| 213 | + # Test 4 |
| 214 | + if [ "${{ steps.test4.outputs.status }}" == "passed" ]; then |
| 215 | + PASSED=$((PASSED + 1)) |
| 216 | + else |
| 217 | + FAILED=$((FAILED + 1)) |
| 218 | + fi |
| 219 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test4.outputs.duration || 0 }})) |
| 220 | + |
| 221 | + # Test 5 |
| 222 | + if [ "${{ steps.test5.outputs.status }}" == "passed" ]; then |
| 223 | + PASSED=$((PASSED + 1)) |
| 224 | + else |
| 225 | + FAILED=$((FAILED + 1)) |
| 226 | + fi |
| 227 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test5.outputs.duration || 0 }})) |
| 228 | + |
| 229 | + # Test 6 |
| 230 | + if [ "${{ steps.test6.outputs.status }}" == "passed" ]; then |
| 231 | + PASSED=$((PASSED + 1)) |
| 232 | + else |
| 233 | + FAILED=$((FAILED + 1)) |
| 234 | + fi |
| 235 | + TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test6.outputs.duration || 0 }})) |
| 236 | + |
| 237 | + echo "passed=$PASSED" >> $GITHUB_OUTPUT |
| 238 | + echo "failed=$FAILED" >> $GITHUB_OUTPUT |
| 239 | + echo "duration=$TOTAL_DURATION" >> $GITHUB_OUTPUT |
| 240 | + |
| 241 | + if [ $FAILED -eq 0 ]; then |
| 242 | + echo "overall_status=success" >> $GITHUB_OUTPUT |
| 243 | + echo "badge_status=passing" >> $GITHUB_OUTPUT |
| 244 | + else |
| 245 | + echo "overall_status=failure" >> $GITHUB_OUTPUT |
| 246 | + echo "badge_status=failing" >> $GITHUB_OUTPUT |
| 247 | + fi |
| 248 | + |
| 249 | + # ============================================================ |
| 250 | + # Generate JSON with Ceph metadata |
| 251 | + # ============================================================ |
| 252 | + - name: Generate test results JSON |
| 253 | + if: always() |
| 254 | + run: | |
| 255 | + mkdir -p test-results |
| 256 | + |
| 257 | + cat > test-results/ceph.json << EOF |
| 258 | + { |
| 259 | + "schema_version": "1.0", |
| 260 | + "package": { |
| 261 | + "name": "Ceph", |
| 262 | + "version": "${{ steps.version.outputs.version }}", |
| 263 | + "language": "c++", |
| 264 | + "category": "Storage" |
| 265 | + }, |
| 266 | + "run": { |
| 267 | + "id": "${{ github.run_id }}", |
| 268 | + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 269 | + "timestamp": "${{ steps.metadata.outputs.timestamp }}", |
| 270 | + "status": "${{ steps.summary.outputs.overall_status }}", |
| 271 | + "runner": { |
| 272 | + "os": "ubuntu-24.04", |
| 273 | + "arch": "arm64" |
| 274 | + } |
| 275 | + }, |
| 276 | + "tests": { |
| 277 | + "passed": ${{ steps.summary.outputs.passed }}, |
| 278 | + "failed": ${{ steps.summary.outputs.failed }}, |
| 279 | + "skipped": 0, |
| 280 | + "duration_seconds": ${{ steps.summary.outputs.duration }}, |
| 281 | + "details": [ |
| 282 | + { |
| 283 | + "name": "Check ceph client binary exists", |
| 284 | + "status": "${{ steps.test1.outputs.status }}", |
| 285 | + "duration_seconds": ${{ steps.test1.outputs.duration || 0 }} |
| 286 | + }, |
| 287 | + { |
| 288 | + "name": "Check cephadm binary exists", |
| 289 | + "status": "${{ steps.test2.outputs.status }}", |
| 290 | + "duration_seconds": ${{ steps.test2.outputs.duration || 0 }} |
| 291 | + }, |
| 292 | + { |
| 293 | + "name": "Check Ceph version command", |
| 294 | + "status": "${{ steps.test3.outputs.status }}", |
| 295 | + "duration_seconds": ${{ steps.test3.outputs.duration || 0 }} |
| 296 | + }, |
| 297 | + { |
| 298 | + "name": "Check rados binary (RADOS object store)", |
| 299 | + "status": "${{ steps.test4.outputs.status }}", |
| 300 | + "duration_seconds": ${{ steps.test4.outputs.duration || 0 }} |
| 301 | + }, |
| 302 | + { |
| 303 | + "name": "Check rbd binary (RADOS Block Device)", |
| 304 | + "status": "${{ steps.test5.outputs.status }}", |
| 305 | + "duration_seconds": ${{ steps.test5.outputs.duration || 0 }} |
| 306 | + }, |
| 307 | + { |
| 308 | + "name": "Check cephfs binary (Ceph File System)", |
| 309 | + "status": "${{ steps.test6.outputs.status }}", |
| 310 | + "duration_seconds": ${{ steps.test6.outputs.duration || 0 }} |
| 311 | + } |
| 312 | + ] |
| 313 | + }, |
| 314 | + "metadata": { |
| 315 | + "dashboard_link": "${{ steps.metadata.outputs.dashboard_link }}", |
| 316 | + "badge_status": "${{ steps.summary.outputs.badge_status }}" |
| 317 | + } |
| 318 | + } |
| 319 | + EOF |
| 320 | + |
| 321 | + echo "Generated test results:" |
| 322 | + cat test-results/ceph.json |
| 323 | + |
| 324 | + # ============================================================ |
| 325 | + # STANDARD STEPS - Commit results to repository |
| 326 | + # ============================================================ |
| 327 | + |
| 328 | + - name: Upload test results |
| 329 | + if: always() |
| 330 | + uses: actions/upload-artifact@v4 |
| 331 | + with: |
| 332 | + name: ceph-test-results |
| 333 | + path: test-results/ceph.json |
| 334 | + retention-days: 90 |
| 335 | + |
| 336 | + - name: Commit test results to repository |
| 337 | + if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/smoke_tests') |
| 338 | + run: | |
| 339 | + git config --global user.name 'github-actions[bot]' |
| 340 | + git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
| 341 | + |
| 342 | + mkdir -p data/test-results |
| 343 | + cp test-results/ceph.json data/test-results/ceph.json |
| 344 | + |
| 345 | + git add data/test-results/ceph.json |
| 346 | + |
| 347 | + if ! git diff --staged --quiet; then |
| 348 | + git commit -m "Update ceph test results [skip ci]" |
| 349 | + |
| 350 | + # Retry logic for push |
| 351 | + MAX_RETRIES=5 |
| 352 | + RETRY_COUNT=0 |
| 353 | + |
| 354 | + while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do |
| 355 | + if git push origin ${{ github.ref_name }}; then |
| 356 | + echo "Successfully pushed test results" |
| 357 | + break |
| 358 | + else |
| 359 | + RETRY_COUNT=$((RETRY_COUNT + 1)) |
| 360 | + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then |
| 361 | + echo "Push failed, attempt $RETRY_COUNT of $MAX_RETRIES. Retrying in 5 seconds..." |
| 362 | + sleep 5 |
| 363 | + git pull --rebase origin ${{ github.ref_name }} |
| 364 | + else |
| 365 | + echo "Failed to push after $MAX_RETRIES attempts" |
| 366 | + exit 1 |
| 367 | + fi |
| 368 | + fi |
| 369 | + done |
| 370 | + else |
| 371 | + echo "No changes to commit" |
| 372 | + fi |
0 commit comments