When running in GitHub actions using the built-in Docker runner:
- name: "Run Tests"
uses: "./.devcontainer"
with:
entrypoint: "./tests/run.sh"
User scripts running inside the devcontainer can read environment variables on the CI machine, like:
- Common variables like
$CI
- GitHub Actions config like
$GITHUB_ACTIONS, $GITHUB_TOKEN, and $GITHUB_REF.
- Repository/User secrets passed via
steps.{STEP_ID}.env.
But unfortunately that is not the same when running through the devcontainer CLI:
- name: "Run Tests"
uses: "devcontainers/ci@v0.3"
with:
runCmd: "./tests/run.sh"
The current workarounds are to either use the env: {} input parameter of devcontainers/ci, or the remoteEnv field in devcontainer.json. But this has a major drawback. Users have to list every single environment variable their scripts (or their dependencies) can possibly use/need. The issue gets worse when using third-party scripts and CLIs that don't explicitly declare which environment variables they read, but depend on their existence to run correctly (as if they ran directly on the CI machine without the devcontainer).
I wonder if there is a reason this is not enabled by default. If so, Is it possible to configure it to inherit the CI environment variables via devcontainer.json, instead of listing every single one there?
When running in GitHub actions using the built-in Docker runner:
User scripts running inside the devcontainer can read environment variables on the CI machine, like:
$CI$GITHUB_ACTIONS,$GITHUB_TOKEN, and$GITHUB_REF.steps.{STEP_ID}.env.But unfortunately that is not the same when running through the devcontainer CLI:
The current workarounds are to either use the
env: {}input parameter ofdevcontainers/ci, or theremoteEnvfield indevcontainer.json. But this has a major drawback. Users have to list every single environment variable their scripts (or their dependencies) can possibly use/need. The issue gets worse when using third-party scripts and CLIs that don't explicitly declare which environment variables they read, but depend on their existence to run correctly (as if they ran directly on the CI machine without the devcontainer).I wonder if there is a reason this is not enabled by default. If so, Is it possible to configure it to inherit the CI environment variables via
devcontainer.json, instead of listing every single one there?