Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ COPY scripts /app/scripts
# to the repository.
# The .env file (and other environment files) is copied into the image, as it
# may be needed by Composer scripts to access additional variables.
COPY composer.json composer.* patches.lock.* .env* auth* /app/
COPY composer.json composer.* patches.lock.* .env* /app/

#;< VORTEX_DEV
# Copy the in-tree drevops/vortex-tooling package so the path repository
Expand Down
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
.vscode
**/.DS_Store

# Credentials. The package token reaches the build through a build secret.
auth*

# Drupal directories generated by Composer during the image build.
web/core
web/libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ COPY scripts /app/scripts
# to the repository.
# The .env file (and other environment files) is copied into the image, as it
# may be needed by Composer scripts to access additional variables.
COPY composer.json composer.* patches.lock.* .env* auth* /app/
COPY composer.json composer.* patches.lock.* .env* /app/

# Install PHP dependencies without development packages to avoid exposing
# potential security vulnerabilities in the production environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
.vscode
**/.DS_Store

# Credentials. The package token reaches the build through a build secret.
auth*

# Drupal directories generated by Composer during the image build.
web/core
web/libraries
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@@ -12,28 +12,28 @@
**/.DS_Store
@@ -15,28 +15,28 @@
auth*

# Drupal directories generated by Composer during the image build.
-web/core
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@@ -12,28 +12,28 @@
**/.DS_Store
@@ -15,28 +15,28 @@
auth*

# Drupal directories generated by Composer during the image build.
-web/core
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -39,7 +39,6 @@
@@ -42,7 +42,6 @@
**/.artifacts
**/.data
**/.logs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -39,11 +39,7 @@
@@ -42,11 +42,7 @@
**/.artifacts
**/.data
**/.logs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -39,7 +39,6 @@
@@ -42,7 +42,6 @@
**/.artifacts
**/.data
**/.logs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -39,11 +39,7 @@
@@ -42,11 +42,7 @@
**/.artifacts
**/.data
**/.logs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -42,9 +42,6 @@
@@ -45,9 +45,6 @@
**/.phpunit.cache
**/.twig-cs-fixer.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -40,7 +40,6 @@
@@ -43,7 +43,6 @@
**/.data
**/.logs
**/.phpunit.cache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -40,10 +40,6 @@
@@ -43,10 +43,6 @@
**/.data
**/.logs
**/.phpunit.cache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -39,8 +39,6 @@
@@ -42,8 +42,6 @@
**/.artifacts
**/.data
**/.logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,20 @@ public function testDockerComposePackageToken(): void {
$this->assertFileContainsString('composer.json', 'drevops/test-private-package', 'composer.json should contain private package');
File::remove('composer.lock');

$this->logSubstep('Adding a decoy auth.json to the build context');
// The bogus token leaves both build outcomes unchanged, so the assertion
// below tests only whether the file reaches the image.
File::dump('auth.json', json_encode(['github-oauth' => ['github.com' => 'decoy-token']], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n");

$this->logSubstep('Building without PACKAGE_TOKEN - should fail');
$this->cmdFail('docker compose build cli --no-cache', '* did not complete successfully', txt: 'Build stack images without token should fail', env: ['PACKAGE_TOKEN' => FALSE], tio: 900);

$this->logSubstep('Building with PACKAGE_TOKEN - should succeed');
$this->cmd('docker compose build cli --no-cache', txt: 'Build stack images with token should succeed', env: ['PACKAGE_TOKEN' => $package_token], tio: 900);

$this->logSubstep('Asserting that auth.json is absent from the built image');
$this->assertFileExists('auth.json', 'auth.json should still exist in the build context');
$this->cmd('docker compose run --rm --no-deps -T --entrypoint bash cli -c "test ! -f /app/auth.json"', txt: 'Built image should not contain auth.json');
}

}
2 changes: 1 addition & 1 deletion .vortex/tests/phpunit/Traits/SutTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function injectTestingTooling(): void {
$dockerfile_path = $sut_root . DIRECTORY_SEPARATOR . '.docker' . DIRECTORY_SEPARATOR . 'cli.dockerfile';
if (file_exists($dockerfile_path)) {
$content = (string) file_get_contents($dockerfile_path);
$needle = 'COPY composer.json composer.* patches.lock.* .env* auth* /app/';
$needle = 'COPY composer.json composer.* patches.lock.* .env* /app/';
$replacement = $needle . "\n\n# Test-only: enables path-repo resolution.\nCOPY .tooling-source /app/.tooling-source";
file_put_contents($dockerfile_path, str_replace($needle, $replacement, $content));
}
Expand Down