build(deps): bump the devops group across 1 directory with 25 updates #973
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Docker Config | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "**/Cargo.lock" | |
| - docker/Dockerfile | |
| - docker/entrypoint.sh | |
| - docker/**/*.toml | |
| - zebrad/tests/common/configs/** | |
| - .github/workflows/test-docker.yml | |
| push: | |
| branches: [main] | |
| paths: | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "**/Cargo.lock" | |
| - docker/Dockerfile | |
| - docker/entrypoint.sh | |
| - docker/**/*.toml | |
| - zebrad/tests/common/configs/** | |
| - .github/workflows/test-docker.yml | |
| # Ensures that only one workflow task will run at a time. Previous builds, if | |
| # already in process, will get cancelled. Only the latest commit will be allowed | |
| # to run, cancelling any workflows in between | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| RUST_LIB_BACKTRACE: 1 | |
| RUST_LOG: info | |
| COLORBT_SHOW_HIDDEN: 1 | |
| jobs: | |
| build-docker-image: | |
| name: Build Docker Image | |
| permissions: | |
| id-token: write | |
| statuses: write | |
| runs-on: ${{ vars.DOCKER_BUILD_RUNNER_AMD64 || 'ubuntu-latest' }} | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Inject slug/short variables | |
| uses: rlespinasse/github-slug-action@e6f261660910b273384c5c42b17a0217881b217a #v5.6.0 | |
| with: | |
| short-length: 7 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd #v4.0.0 | |
| - name: Build & push | |
| id: docker_build | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f #v7.1.0 | |
| with: | |
| target: tests | |
| context: . | |
| file: docker/Dockerfile | |
| tags: zebrad-test:${{ github.sha }} | |
| build-args: | | |
| SHORT_SHA=${{ env.GITHUB_SHA_SHORT }} | |
| CARGO_INCREMENTAL=1 | |
| outputs: type=docker,dest=${{ runner.temp }}/zebrad-test.tar | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1 | |
| with: | |
| name: zebrad-test | |
| path: ${{ runner.temp }}/zebrad-test.tar | |
| test-configurations: | |
| name: Test ${{ matrix.name }} | |
| needs: build-docker-image | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: read | |
| runs-on: ${{ vars.DOCKER_BUILD_RUNNER_AMD64 || 'ubuntu-latest' }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Privilege drop verification - runs 'id' to verify non-root user | |
| - id: privilege-drop | |
| name: Privilege drop | |
| env_vars: "" | |
| test_cmd: id | |
| grep_patterns: -e "uid=10001\\(zebra\\).*gid=10001\\(zebra\\)" | |
| # Basic network configurations | |
| - id: default-conf | |
| name: Default config | |
| env_vars: "" | |
| grep_patterns: -e "resolved seed peer IP addresses.*mainnet" | |
| - id: testnet-conf | |
| name: Testnet config | |
| env_vars: -e ZEBRA_NETWORK__NETWORK=Testnet | |
| grep_patterns: -e "resolved seed peer IP addresses.*testnet" | |
| # Only runs when using the image is built with the `tests` target, because the `runtime` target | |
| # doesn't have the custom config file available in the tests/common/configs directory | |
| - id: custom-conf | |
| name: Custom config | |
| env_vars: -e CONFIG_FILE_PATH=/home/zebra/zebrad/tests/common/configs/custom-conf.toml | |
| grep_patterns: -e "extra_coinbase_data:\\sSome\\(\\\"do you even shield\\?\\\"\\)" | |
| # RPC configuration tests | |
| - id: rpc-conf | |
| name: RPC config | |
| env_vars: -e ZEBRA_RPC__LISTEN_ADDR=0.0.0.0:8232 | |
| grep_patterns: -e "Opened RPC endpoint at.*0.0.0.0:8232" | |
| - id: rpc-custom-conf | |
| name: RPC with custom port | |
| env_vars: -e ZEBRA_RPC__LISTEN_ADDR=127.0.0.1:28232 | |
| grep_patterns: -e "Opened RPC endpoint at.*127.0.0.1:28232" | |
| # Custom directory tests | |
| - id: rpc-cookie-conf | |
| name: RPC with custom cookie dir | |
| env_vars: -e ZEBRA_RPC__LISTEN_ADDR=0.0.0.0:8232 -e ZEBRA_RPC__ENABLE_COOKIE_AUTH=true -e ZEBRA_RPC__COOKIE_DIR=/home/zebra/.config/cookie | |
| grep_patterns: -e "RPC auth cookie written to disk" | |
| # Custom directory tests | |
| - id: custom-dirs-conf | |
| name: Custom cache and cookie directories | |
| env_vars: -e ZEBRA_STATE__CACHE_DIR=/tmp/zebra-cache | |
| grep_patterns: -e "Opened Zebra state cache at /tmp/zebra-cache" | |
| # Feature-based configurations | |
| - id: prometheus-feature | |
| name: Prometheus metrics | |
| env_vars: -e FEATURES=prometheus -e ZEBRA_METRICS__ENDPOINT_ADDR=0.0.0.0:9999 | |
| grep_patterns: -e "0.0.0.0:9999" | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Download artifact | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1 | |
| with: | |
| name: zebrad-test | |
| path: ${{ runner.temp }} | |
| - name: Load image | |
| run: | | |
| docker load --input ${{ runner.temp }}/zebrad-test.tar | |
| docker image ls -a | |
| - name: Run ${{ matrix.name }} test | |
| # Only run custom-conf test if the config file exists in the built image | |
| if: ${{ matrix.id != 'custom-conf' || hashFiles('zebrad/tests/common/configs/custom-conf.toml') != '' }} | |
| env: | |
| TEST_CMD: ${{ matrix.test_cmd }} | |
| run: | | |
| # For one-shot commands (like 'id'), run directly and check output | |
| if [ -n "$TEST_CMD" ]; then | |
| OUTPUT=$(docker run --rm ${{ matrix.env_vars }} zebrad-test:${{ github.sha }} $TEST_CMD) | |
| echo "Output: $OUTPUT" | |
| if echo "$OUTPUT" | grep --extended-regexp ${{ matrix.grep_patterns }}; then | |
| echo "SUCCESS: Found expected pattern in output" | |
| exit 0 | |
| else | |
| echo "FAILURE: Expected pattern not found in output" | |
| exit 1 | |
| fi | |
| fi | |
| # For long-running commands (zebrad start), run detached and follow logs | |
| docker run ${{ matrix.env_vars }} --detach --name ${{ matrix.id }} -t zebrad-test:${{ github.sha }} zebrad start | |
| # Use a subshell to handle the broken pipe error gracefully | |
| ( | |
| trap "" PIPE; | |
| docker logs \ | |
| --tail all \ | |
| --follow \ | |
| ${{ matrix.id }} | \ | |
| tee --output-error=exit /dev/stderr | \ | |
| grep --max-count=1 --extended-regexp --color=always \ | |
| ${{ matrix.grep_patterns }} | |
| ) | |
| LOGS_EXIT_STATUS=$? | |
| # Display grep status for debugging | |
| echo "grep exit status: $LOGS_EXIT_STATUS" | |
| docker stop ${{ matrix.id }} | |
| EXIT_STATUS=$(docker wait ${{ matrix.id }} || echo "Error retrieving exit status"); | |
| echo "docker exit status: $EXIT_STATUS"; | |
| # If grep didn't find the pattern, fail immediately | |
| if [ $LOGS_EXIT_STATUS -ne 0 ]; then | |
| echo "ERROR: Failed to find the expected pattern in logs. Check grep_patterns."; | |
| exit 1; | |
| else | |
| echo "SUCCESS: Found the expected pattern in logs."; | |
| # Exit successfully if grep passed, even if docker stop resulted in SIGKILL (137 or 139) | |
| exit 0; | |
| fi | |
| test-docker-config-success: | |
| name: Test Docker Config Success | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - build-docker-image | |
| - test-configurations | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe #v1.2.2 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |