Skip to content

Bug: UPSTREAM_REPO: unbound variable #48

@JaimieWi

Description

@JaimieWi

Addition to re-install the install-azure-tre-oss.sh script was required to pick up changes to the container when running in GitHub Actions.

# Re-run the install-azure-tre-oss.sh script
echo "Re-running install-azure-tre-oss.sh..."
bash /tmp/install-azure-tre-oss.sh "${UPSTREAM_REPO}" "${UPSTREAM_REPO_VERSION}" "${AZURETRE_HOME}" "${GITHUB_TOKEN}"

The above was added, but causes a failure when running the container locally.

[9521 ms] Start: Run in container: /bin/sh -c ./.devcontainer/scripts/post-create.sh
Re-running install-azure-tre-oss.sh...
./.devcontainer/scripts/post-create.sh: line 19: UPSTREAM_REPO: unbound variable
[10135 ms] postCreateCommand from devcontainer.json failed with exit code 1. Skipping any further user-provided commands.
Done. Press any key to close the terminal.

The post-create script fails because it tries to use UPSTREAM_REPO, UPSTREAM_REPO_VERSION, and GITHUB_TOKEN as environment variables, but these are only defined as Docker build arguments and don't persist to the running container.

Fix: Update .devcontainer/scripts/post-create.sh to read from the files created during build instead:
UPSTREAM_REPO=$(cat "${AZURETRE_HOME}/repository.txt")
UPSTREAM_REPO_VERSION=$(cat "${AZURETRE_HOME}/version.txt")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions