Skip to content

[CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup#344

Open
carsongee wants to merge 1 commit intodatarobot-oss:mainfrom
carsongee:carsongee/CFX-4857
Open

[CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup#344
carsongee wants to merge 1 commit intodatarobot-oss:mainfrom
carsongee:carsongee/CFX-4857

Conversation

@carsongee
Copy link
Contributor

@carsongee carsongee commented Feb 3, 2026

RATIONALE

Pulumi onboarding is still a challenge for our users. This bakes that into the configuration and allows the user to set a universal securely generated passphrase for all DataRobot templates they might explore without prompting for this configuration.

CHANGES

pulumi-experience


Note

Medium Risk
Introduces new interactive flow that shells out to pulumi and writes a generated passphrase into the user config via viper, so failures or misconfiguration could block setup or persist unintended secrets.

Overview
Pulumi onboarding is now integrated into environment setup. dr dotenv setup (and template setup’s embedded dotenv step) can detect when a template needs PULUMI_CONFIG_PASSPHRASE, then run a new TUI screen to select a Pulumi backend, execute pulumi login, and optionally generate/store a default passphrase in ~/.config/datarobot/drconfig.yaml before continuing the normal wizard.

Validation/prompt loading now consider CLI config for Pulumi passphrase. envbuilder.promptsWithValues can source PULUMI_CONFIG_PASSPHRASE from viper when not present in the environment or .env, and tests were hardened (resetting viper, clearing env leakage) plus new unit tests cover the Pulumi flow and command-path assertions.

Written by Cursor Bugbot for commit b9eae1b. This will update automatically on new commits. Configure here.

@carsongee carsongee changed the title [CFX-4857] Added support for pulumi login during start and dotenv setup [CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup Mar 4, 2026
@carsongee carsongee force-pushed the carsongee/CFX-4857 branch 2 times, most recently from dd1fb86 to cd8718d Compare March 12, 2026 03:30
@carsongee carsongee marked this pull request as ready for review March 12, 2026 03:31
@github-actions
Copy link
Contributor

🔐 Smoke tests approved by maintainer

⏳ Running security scans before executing smoke tests with secrets...

A maintainer has approved this fork PR to run smoke tests. Security scans will run first.

@carsongee carsongee force-pushed the carsongee/CFX-4857 branch from cd8718d to 0422da9 Compare March 12, 2026 04:10
func TestNeedsPulumiSetup_NotLoggedIn_NoPassphrase(t *testing.T) {
prompts := []envbuilder.UserPrompt{{Env: "PULUMI_CONFIG_PASSPHRASE", Active: true}}

assert.True(t, needsPulumiSetup(prompts, false, false), "not logged in + no passphrase → needs setup")
Copy link

Choose a reason for hiding this comment

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

Tests fail when Pulumi CLI not installed

Medium Severity

Several TestNeedsPulumiSetup_* tests assert true but needsPulumiSetup calls exec.LookPath("pulumi") as its first check, returning false when Pulumi isn't installed. Tests like NotLoggedIn_NoPassphrase, NotLoggedIn_PassphraseSet, and LoggedIn_NoPassphrase will all fail in any CI or dev environment without the pulumi binary on PATH, making them environment-dependent and flaky.

Additional Locations (2)
Fix in Cursor Fix in Web

// Skip if already processed (like PULUMI_CONFIG_PASSPHRASE above)
if prompt.Value != "" {
continue
}
Copy link

Choose a reason for hiding this comment

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

Skip logic silently ignores .env file values for matched prompts

Low Severity

The new if prompt.Value != "" { continue } guard in the second loop of promptsWithValues skips the .env file (variables) lookup for any prompt whose Value was already set — currently PULUMI_CONFIG_PASSPHRASE via viper. This means a user-provided value in .env is silently ignored in favor of the viper config value, breaking the expected precedence of env var > .env file > config > default. The skip condition doesn't check the prompt's Env field, so it also affects any future prompt that arrives with a pre-populated Value.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: failure
✅ Windows: success

View run details

@carsongee carsongee force-pushed the carsongee/CFX-4857 branch from 0422da9 to b9eae1b Compare March 12, 2026 13:53
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

}

return nil
}
Copy link

Choose a reason for hiding this comment

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

Hardcoded config path ignores XDG_CONFIG_HOME

Medium Severity

savePassphraseToConfig hardcodes the config directory as filepath.Join(homeDir, ".config", "datarobot"), but the project's config.GetConfigDir() respects XDG_CONFIG_HOME. When XDG_CONFIG_HOME is set to a non-default path, the os.MkdirAll creates the wrong directory, and viper.WriteConfig() may fail because the actual config directory (at the XDG path) might not exist.

Fix in Cursor Fix in Web

// If Pulumi login sub-model is active, delegate to it
if m.pulumiModel != nil {
return m.handlePulumiUpdate(msg)
}
Copy link

Choose a reason for hiding this comment

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

WindowSizeMsg lost during Pulumi login flow

Low Severity

When pulumiModel is active, all messages including tea.WindowSizeMsg are delegated to handlePulumiUpdate, which doesn't update the parent Model's width and height. If the terminal is resized during the Pulumi login flow, the parent model retains stale dimensions, causing potential layout issues when the wizard screen renders afterward.

Fix in Cursor Fix in Web

Copy link
Contributor

@shreyaag-dr shreyaag-dr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding this.

Copy link

@dr-nate-daly-pm dr-nate-daly-pm left a comment

Choose a reason for hiding this comment

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

I like it!

@ajalon1
Copy link
Contributor

ajalon1 commented Mar 20, 2026

@carsongee Is this one in need of review, or stale?

@ajalon1 ajalon1 self-assigned this Mar 20, 2026
@carsongee
Copy link
Contributor Author

@carsongee Is this one in need of review, or stale?

It is in need of review. I just moved it from Draft to Ready for Review last week, and I got Product sign off on Tuesday @ajalon1

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.

4 participants