Skip to content

Fix: respect required: false for env_file in publish command#13652

Open
maks2134 wants to merge 1 commit intodocker:mainfrom
maks2134:fix/env-file-required-false-final
Open

Fix: respect required: false for env_file in publish command#13652
maks2134 wants to merge 1 commit intodocker:mainfrom
maks2134:fix/env-file-required-false-final

Conversation

@maks2134
Copy link

What I did
Fixed docker compose publish command to respect required: false setting on env_file entries. Previously, the command would fail when optional env files were missing, even when explicitly marked as not required.

Changes made:

  • Modified checkForSensitiveData() to skip env files with required: false
  • Updated processFile() to only process required env files into publish layers
  • Fixed checkEnvironmentVariables() to only consider required env files for environment warnings
  • Added comprehensive tests to verify the fix works correctly

Related issue
fixes #13648

(not mandatory) A picture of a cute animal, if possible in relation to what you did

Fixes docker#13648

The docker compose publish command was ignoring required: false
setting on env_file entries, causing failures when optional env files
were missing.

Changes made:
- Modified checkForSensitiveData() to skip env files with required: false
- Updated processFile() to only process required env files into layers
- Fixed checkEnvironmentVariables() to only consider required env files
- Added comprehensive tests to verify the fix

Signed-off-by: Maks Kozlov <maks@example.com>
Signed-off-by: maks2134 <maks210306@yandex.by>
@maks2134 maks2134 requested a review from a team as a code owner March 20, 2026 20:54
@maks2134 maks2134 requested review from glours and ndeloof March 20, 2026 20:54
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/compose/publish.go 75.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] docker compose publish ignores required: false on env_file

2 participants