Skip to content

feature request: inherit CI environment #242

Description

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions