Skip to content

fix(deploy): create deploy/.env from example after control-plane clone - #51

Closed
y-first wants to merge 2 commits into
mainfrom
fix/deploy-dcm-create-env-file
Closed

y-first wants to merge 2 commits into
mainfrom
fix/deploy-dcm-create-env-file

Conversation

@y-first

@y-first y-first commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

control-plane main now requires deploy/.env for podman-compose env_file entries (FLPATH-4806). Copy deploy/.env.example when missing so CI Jenkins deploy-dcm.sh runs succeed without manual setup.

@qodo-code-review

qodo-code-review Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Deploy creates an undocumented env file ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The deployment script now copies deploy/.env.example to deploy/.env when the cloned
control-plane repository lacks the file. This changes deployment setup behavior for CI and other
operators, but no README.md or CLAUDE.md documentation explains the generated file or its
required source.
Code

scripts/deploy-dcm.sh[R1081-1087]

+if [[ ! -f "${CONTROL_PLANE_TMP_DIR}/deploy/.env" ]]; then
+    if [[ ! -f "${CONTROL_PLANE_TMP_DIR}/deploy/.env.example" ]]; then
+        err "deploy/.env.example not found in cloned control-plane repo"
+        exit 1
+    fi
+    cp "${CONTROL_PLANE_TMP_DIR}/deploy/.env.example" "${CONTROL_PLANE_TMP_DIR}/deploy/.env"
+    info "Created deploy/.env from deploy/.env.example"
Evidence
The checklist requires documentation when runtime deployment behavior changes. The added branch
checks for deploy/.env, fails when deploy/.env.example is absent, and otherwise copies the
example file into place; the PR diff contains no corresponding README.md or CLAUDE.md update.

Rule 2901048: Update project documentation and cursor configs when behavior or conventions change
scripts/deploy-dcm.sh[1081-1087]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The deployment script now creates `deploy/.env` from `deploy/.env.example` when the cloned control-plane repository is missing the environment file, changing deployment setup behavior without corresponding project documentation.

## Fix Focus Areas
- scripts/deploy-dcm.sh[1081-1087]
- README.md[1-1]
- CLAUDE.md[1-1]

## Recommended Fix
Update at least one of `README.md` or `CLAUDE.md` to explain that deployment automatically creates `deploy/.env` from `deploy/.env.example` when it is missing, and document the failure condition when the example file is unavailable. Update affected `.cursor/` guidance as well if it describes the old manual setup behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 18 rules
Review mode: 🚀 Fast: This is a localized, self-contained shell-script change that conditionally copies a required example file after cloning, with limited logic and no high-risk boundary.

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Create deploy/.env after cloning control plane

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Creates deploy/.env from the control-plane example when missing.
• Fails clearly when the required example file is unavailable.
• Prevents podman-compose startup failures in Jenkins deployments.
Diagram

sequenceDiagram
    actor CI as Jenkins CI
    participant Script as Deploy Script
    participant Repo as Control Plane
    participant Files as Deploy Files
    participant Compose as Podman Compose
    CI->>Script: Run deployment
    Script->>Repo: Clone branch
    Repo-->>Files: Populate deploy files
    Script->>Files: Check deploy .env
    alt .env absent
        Script->>Files: Check env example
        alt Example exists
            Script->>Files: Copy example
        else Example absent
            Script-->>CI: Report failure
        end
    end
    Script->>Compose: Start stack
    Compose->>Files: Load deploy .env
Loading
High-Level Assessment

Copying the repository-provided example immediately after cloning is the appropriate approach because it preserves control-plane defaults and satisfies podman-compose before startup. Creating an empty file could omit required values, while changing the upstream compose definition is outside this deployment script's responsibility.

Files changed (1) +11 / -0

Bug fix (1) +11 / -0
deploy-dcm.shInitialize the control-plane deployment environment file +11/-0

Initialize the control-plane deployment environment file

• After cloning control-plane, the script copies deploy/.env.example to deploy/.env when needed. It exits with a clear error if the example is unavailable, preventing a less actionable podman-compose failure.

scripts/deploy-dcm.sh

Comment thread scripts/deploy-dcm.sh
y-first and others added 2 commits September 17, 2026 12:01
control-plane main now requires deploy/.env for podman-compose env_file
entries (FLPATH-4806). Copy deploy/.env.example when missing so CI
deploy-dcm.sh runs succeed without manual setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yona First <yfirst@redhat.com>
Explain that deploy-dcm.sh creates deploy/.env from the control-plane
example file when missing, when manual edits are preserved, and when
deploy fails if the example template is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yona First <yfirst@redhat.com>
@y-first
y-first force-pushed the fix/deploy-dcm-create-env-file branch from ef94b37 to 8addbe3 Compare September 17, 2026 09:01
@y-first

y-first commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Subset of 46, closing this PR.

@y-first y-first closed this Sep 17, 2026
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.

1 participant