Files
bitcoin/.github/actions/run-in-docker-action/action.yml
fanquake 9d4c9b0035 Squashed 'src/secp256k1/' changes from 14e56970cb..57315a6985
57315a6985 Merge bitcoin-core/secp256k1#1813: Remove trailing spaces and introduce `-Wtrailing-whitespace=any` compiler flag
86cae58d2f build: Add `-Wleading-whitespace=spaces` compiler flag
fb229e7602 build: Add `-Wtrailing-whitespace=any` compiler flag
13e3bee504 refactor: Remove trailing whitespace
453949ab2a Merge bitcoin-core/secp256k1#1816: ci: Rotate Docker cache keys
cd49c57e44 Merge bitcoin-core/secp256k1#1814: release process: mention the `[Unreleased]` link clearly
2ccff6eb73 ci: Add weekly schedule
2f18567d24 ci: Rotate Docker cache keys every 4 weeks
0ffb1749a5 ci, docker: Fix LLVM repository signature failure
0267b65512 release process: mention the `[Unreleased]` link clearly
1605b02f75 Merge bitcoin-core/secp256k1#1775: Add CMake build directory patterns to `.gitignore`
748c0fdd67 Add CMake build directory patterns to `.gitignore`
7eb86bdb01 autotools: Rename `build-aux` to `autotools-aux`

git-subtree-dir: src/secp256k1
git-subtree-split: 57315a69853c9bd4765fccf20b541d47f1b45ca9
2026-02-02 15:21:14 +00:00

53 lines
1.6 KiB
YAML

name: 'Run in Docker with environment'
description: 'Run a command in a Docker container, while passing explicitly set environment variables into the container.'
inputs:
dockerfile:
description: 'A Dockerfile that defines an image'
required: true
scope:
description: 'A cached image scope'
required: true
command:
description: 'A command to run in a container'
required: true
runs:
using: "composite"
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
id: main_builder
continue-on-error: true
with:
context: .
file: ${{ inputs.dockerfile }}
load: true
cache-from: type=gha,scope=${{ inputs.scope }}
- uses: docker/build-push-action@v6
id: retry_builder
if: steps.main_builder.outcome == 'failure'
with:
context: .
file: ${{ inputs.dockerfile }}
load: true
cache-from: type=gha,scope=${{ inputs.scope }}
- # Workaround for https://github.com/google/sanitizers/issues/1614 .
# The underlying issue has been fixed in clang 18.1.3.
run: sudo sysctl -w vm.mmap_rnd_bits=28
shell: bash
- # Tell Docker to pass environment variables in `env` into the container.
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
$(docker images -q | head -n1) \
bash -c "
git config --global --add safe.directory ${{ github.workspace }}
${{ inputs.command }}
"
shell: bash