Skip to content

feat: config variable initialization only#49

Merged
KevyVo merged 4 commits into
mainfrom
lio/env-vars-init
Jun 26, 2026
Merged

feat: config variable initialization only#49
KevyVo merged 4 commits into
mainfrom
lio/env-vars-init

Conversation

@lionello

@lionello lionello commented Jun 25, 2026

Copy link
Copy Markdown
Member

Added new input config-env-vars-init for initializing config variables and updated related logic in the action.

Summary by CodeRabbit

  • New Features

    • Expanded config deployment to include new “init” config variables sourced from environment inputs.
    • Added support for initializing listed config variables only when they aren’t already set, including optional randomized initialization.
  • Bug Fixes

    • Improved handling of empty/unset values across both standard and init config inputs so initialization runs only when intended.
    • Updated execution and cleanup logic to align with the new init and random init variables, reducing incorrect/noisy warnings.

Added new input for initializing config variables and updated related logic in the action.
@lionello lionello requested a review from a team as a code owner June 25, 2026 19:34
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b83e345-a99f-4fef-ba25-521be111a40e

📥 Commits

Reviewing files that changed from the base of the PR and between a86f348 and 7352d5f.

📒 Files selected for processing (1)
  • action.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • action.yaml

📝 Walkthrough

Walkthrough

The action now recognizes config-env-vars-init, checks both config env-var groups for empty values, adds explicit init-variable handling with random initialization, and updates later env wiring plus variable cleanup to match the renamed random-init variable.

Changes

Config init handling

Layer / File(s) Summary
Input declaration and gate
action.yaml
The config-env-vars description is updated, and Defang Config Set now also runs when config-env-vars-init is provided.
Empty checks and init blocks
action.yaml
The empty-value check now includes both config env-var groups, and the init logic adds explicit config-env-vars-init handling alongside the random initializer.
Env wiring and cleanup
action.yaml
The config-set and command-execution steps now pass CONFIG_ENV_VARS_INIT and CONFIG_VARS_INIT_RANDOM, and the command step unsets the renamed random-init variable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Hop, hop, I sniffed the config breeze,
Two init paths danced among the trees.
I tucked the random flag away with glee,
Then bounced through defang merrily.
(/)ᐠ•ᴥ•ᐟ(/)

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the main change: adding config variable initialization behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lio/env-vars-init

Comment @coderabbitai help to get the list of available commands.

lionello added 2 commits June 25, 2026 12:36
Added CONFIG_VARS_INIT to the unset command and environment variables.
@lionello lionello requested a review from KevyVo June 25, 2026 19:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
action.yaml (1)

204-219: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Unset config-env-vars-init values before running the command.

The new init list is used to read secret/env-backed values in Defang Config Set, but the command step only unsets CONFIG_ENV_VARS and CONFIG_VARS_INIT_RANDOM. Wire CONFIG_ENV_VARS_INIT into this step and unset its named variables too, otherwise those config values remain visible to the later defang $COMMAND process and can still trigger the warning this cleanup is meant to avoid.

Proposed cleanup fix
-        unset $CONFIG_VARS_INIT_RANDOM $CONFIG_ENV_VARS dont_complain_on_empty
+        unset $CONFIG_VARS_INIT_RANDOM $CONFIG_ENV_VARS $CONFIG_ENV_VARS_INIT dont_complain_on_empty
@@
         CONFIG_ENV_VARS: ${{ inputs['config-env-vars'] }}
+        CONFIG_ENV_VARS_INIT: ${{ inputs['config-env-vars-init'] }}
         CONFIG_VARS_INIT_RANDOM: ${{ inputs['config-vars-init-random'] }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@action.yaml` around lines 204 - 219, The command step only clears
CONFIG_ENV_VARS and CONFIG_VARS_INIT_RANDOM, so config-env-vars-init values can
still leak into the later defang invocation. Update this step to accept
CONFIG_ENV_VARS_INIT from inputs/env and unset each named variable from that
init list alongside the existing cleanup before running defang $COMMAND, keeping
the change localized to this shell block and its env wiring.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@action.yaml`:
- Line 18: The init input description in the action metadata is unclear because
it says variables are initialized “with if they are not already set” without
stating where values come from. Update the description in the action definition
to explicitly say the listed config variables are initialized from environment
variable values when they are not already set, keeping the existing format
example intact.

---

Outside diff comments:
In `@action.yaml`:
- Around line 204-219: The command step only clears CONFIG_ENV_VARS and
CONFIG_VARS_INIT_RANDOM, so config-env-vars-init values can still leak into the
later defang invocation. Update this step to accept CONFIG_ENV_VARS_INIT from
inputs/env and unset each named variable from that init list alongside the
existing cleanup before running defang $COMMAND, keeping the change localized to
this shell block and its env wiring.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c52bc8c8-d9b8-434c-9334-2f7471ae9529

📥 Commits

Reviewing files that changed from the base of the PR and between c34f401 and 8fe9854.

📒 Files selected for processing (1)
  • action.yaml

Comment thread action.yaml Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@KevyVo KevyVo merged commit 2202660 into main Jun 26, 2026
5 checks passed
@KevyVo KevyVo deleted the lio/env-vars-init branch June 26, 2026 17:17
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.

3 participants