|
18 | 18 | default: false |
19 | 19 |
|
20 | 20 | jobs: |
| 21 | + # Setup Docker environment - test if custom image is available |
| 22 | + setup_docker: |
| 23 | + name: Setup Docker Environment |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + continue-on-error: true # Don't fail the workflow if this job fails |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + packages: read |
| 29 | + outputs: |
| 30 | + success: ${{ steps.test_image.outputs.success }} |
| 31 | + # Try to use custom image from ghcr.io |
| 32 | + container: |
| 33 | + image: ghcr.io/wolfssl/build-wolfprovider-debian:bookworm |
| 34 | + env: |
| 35 | + DEBIAN_FRONTEND: noninteractive |
| 36 | + options: --cap-add=NET_ADMIN --cap-add=NET_RAW |
| 37 | + steps: |
| 38 | + - name: Test custom image availability |
| 39 | + id: test_image |
| 40 | + run: | |
| 41 | + echo "Custom Docker image is available and working" |
| 42 | + echo "success=true" >> $GITHUB_OUTPUT |
| 43 | +
|
21 | 44 | build_wolfprovider_common: |
22 | 45 | name: Build wolfProvider |
23 | 46 | runs-on: ubuntu-22.04 |
24 | | - # Grant permissions to read packages from ghcr.io |
| 47 | + needs: setup_docker |
| 48 | + if: always() |
25 | 49 | permissions: |
26 | 50 | contents: read |
27 | 51 | packages: read |
28 | | - # Run inside Debian Bookworm using container from ghcr.io/wolfssl/build-wolfprovider-debian:bookworm |
29 | | - # We are using this container to avoid having to install all the dependencies on the host machine |
30 | | - # and speed up the build process. |
31 | | - # Note: Docker image paths must be lowercase even though the GitHub org is wolfSSL |
| 52 | + # Use custom image if available, otherwise fallback to stock debian:bookworm |
32 | 53 | container: |
33 | | - image: ghcr.io/wolfssl/build-wolfprovider-debian:bookworm |
| 54 | + image: ${{ needs.setup_docker.outputs.success == 'true' && 'ghcr.io/wolfssl/build-wolfprovider-debian:bookworm' || 'debian:bookworm' }} |
34 | 55 | env: |
35 | 56 | DEBIAN_FRONTEND: noninteractive |
36 | | - # Add network capabilities so ifconfig/RTNETLINK operations are permitted |
37 | | - # These are passed to `docker run` as runtime options |
38 | 57 | options: --cap-add=NET_ADMIN --cap-add=NET_RAW |
39 | 58 | timeout-minutes: 20 |
40 | 59 | env: |
|
43 | 62 | WOLFPROV_PACKAGES_PATH: /tmp/wolfprov-packages |
44 | 63 | DEBS_PATH: debs |
45 | 64 | steps: |
| 65 | + # Install dependencies if using fallback stock debian:bookworm image |
| 66 | + - name: Install build dependencies (fallback) |
| 67 | + if: needs.setup_docker.outputs.success != 'true' |
| 68 | + run: | |
| 69 | + echo "Custom Docker image unavailable, installing dependencies on stock debian:bookworm..." |
| 70 | + apt-get update && apt-get install -y --no-install-recommends \ |
| 71 | + build-essential \ |
| 72 | + devscripts \ |
| 73 | + debhelper \ |
| 74 | + dh-autoreconf \ |
| 75 | + libtool \ |
| 76 | + pkg-config \ |
| 77 | + git \ |
| 78 | + wget \ |
| 79 | + curl \ |
| 80 | + ca-certificates \ |
| 81 | + openssl \ |
| 82 | + dpkg-dev \ |
| 83 | + lintian \ |
| 84 | + fakeroot \ |
| 85 | + dh-exec \ |
| 86 | + equivs \ |
| 87 | + expect \ |
| 88 | + xxd \ |
| 89 | + bc \ |
| 90 | + libdistro-info-perl |
| 91 | + echo "✓ Dependencies installed successfully" |
| 92 | +
|
46 | 93 | # Check if artifact already exists from another job in the same workflow run |
47 | 94 | # When multiple matrix jobs run in parallel, the first one to finish uploads the artifact |
48 | 95 | # Other jobs can then find it and skip rebuilding (no need to download it, just check it exists) |
|
0 commit comments