diff --git a/templates/.devcontainer/devcontainer.json.j2 b/templates/.devcontainer/devcontainer.json.j2 index e2b49a2..c047727 100644 --- a/templates/.devcontainer/devcontainer.json.j2 +++ b/templates/.devcontainer/devcontainer.json.j2 @@ -29,6 +29,12 @@ "description": "Packagist access token, required for installation of composer packages from private packagist", "documentationUrl": "https://packagist.com/orgs/linkorb" } +{% endif %} + }, + "remoteEnv": { +{% if repo.devcontainer.private_packagist and (repo.type in ['application', 'library', 'symfony-bundle'] or repo.type.startswith('php-')) %} + "GITHUB_USER_ON_HOST": "${localEnv:GITHUB_USER}", + "PACKAGIST_TOKEN_ON_HOST": "${localEnv:PACKAGIST_TOKEN}" {% endif %} }, "postCreateCommand": ".devcontainer/postCreate.sh", diff --git a/templates/.devcontainer/postCreate.sh.j2 b/templates/.devcontainer/postCreate.sh.j2 index b265f15..33ac012 100755 --- a/templates/.devcontainer/postCreate.sh.j2 +++ b/templates/.devcontainer/postCreate.sh.j2 @@ -1,10 +1,6 @@ #!/usr/bin/env bash # {{ repo_managed }} -# Workaround for recent Python versions which prevent global pip package installation without an explicit flag -# or removal of a certain file. -sudo rm /usr/lib/python3.*/EXTERNALLY-MANAGED || true - # This is a workaround on an issue with the devcontainer reported on Windows where followup git config commands would # fail. #9067 git config --global --add safe.directory /app @@ -14,7 +10,8 @@ git config commit.template .devcontainer/git/linkorb_commit.template {% if repo.type in ['application', 'library', 'symfony-bundle'] or repo.type.startswith('php-') %} {% if repo.devcontainer.private_packagist %} -composer config --global --auth http-basic.repo.packagist.com "$GITHUB_USER" "$PACKAGIST_TOKEN" +composer config --global --auth http-basic.repo.packagist.com \ + "${GITHUB_USER:-$GITHUB_USER_ON_HOST}" "${PACKAGIST_TOKEN:-$PACKAGIST_TOKEN_ON_HOST}" {% endif %} composer install diff --git a/templates/.devcontainer/postStart.sh.j2 b/templates/.devcontainer/postStart.sh.j2 index 7f2591f..98e2409 100755 --- a/templates/.devcontainer/postStart.sh.j2 +++ b/templates/.devcontainer/postStart.sh.j2 @@ -1,11 +1,4 @@ #!/usr/bin/env bash # {{ repo_managed }} -# pre-push composer-unused hook disabled. See Card #8980 -if [ -f .git/hooks/pre-push ]; then - diff .devcontainer/git/hooks/pre-push .git/hooks/pre-push - if [ $? -eq 0 ]; then - rm .git/hooks/pre-push - fi -fi {{ repo.devcontainer.postStartCommand|default('') }}