Skip to content

[RAPTOR-19721] feat(workload): update declared .env values and re-send rotated secrets - #1

Closed
wojtekwdr wants to merge 1 commit into
wojtekw/RAPTOR-19721-import-envfrom
wojtekw/RAPTOR-19721-update-env
Closed

[RAPTOR-19721] feat(workload): update declared .env values and re-send rotated secrets#1
wojtekwdr wants to merge 1 commit into
wojtekw/RAPTOR-19721-import-envfrom
wojtekw/RAPTOR-19721-update-env

Conversation

@wojtekwdr

Copy link
Copy Markdown
Owner

RATIONALE

Stacked on the --import-env PR. That one adds names and never touches a value; this one is the opposite act, and it is the case the original report was about: a key rotated in .env had no way to reach a workload short of creating a second credential by hand and editing the manifest to point at it.

CHANGES

  • dr workload config --update-env rewrites a declared literal to match .env, and re-sends the credential behind a secret, keeping the id the manifest already names.
  • A secret is re-sent without being compared, because the platform never returns a stored value. Only a credential this CLI would have written is touched: the reference must name the apiToken field, and the credential must carry the name setup gives it.
  • internal/workload.UpdateCredential sends only the secret. The update route rejects credentialType, which the create route requires.
  • A run that only re-sent secrets no longer claims to have updated the file, and names the restart that makes the new value the one being served.
  • A failed re-send is named on the terminal and counted in the envelope (envSecretsRotated, envSecretsNotRotated), because it changes no file and stops nothing.
  • A plain run now also names a declared value that has drifted, the ones stored as credentials that cannot be compared at all, and the two neither flag will settle: a value that is not a plain string, and a name whose kind has changed.

TESTING

task test and task lint pass. Exercised against a live instance, which is where the credentialType rejection turned up: with that field present every rotation fails with 422 credentialType is not allowed key, and no mock shows it. After the fix, a rotation re-sends to the id already in the file, creates no second credential, leaves the manifest byte-identical, and the container serves the new value once it restarts. Also verified live: a basic credential is refused rather than overwritten, and the platform does accept that write, so the guard is the only thing preventing it.

NOTES

Second of a stack of three. Merge after the --import-env PR.

…d rotated secrets

--import-env adds names and never touches a value. This is the other half: a
literal the manifest already declares is rewritten to match .env, and the
credential behind a secret is re-sent, so a key rotated locally reaches the
workload without a new credential, a new id or an edit to the manifest.

A secret is re-sent without being compared first, because it cannot be: the
platform never returns a stored value, so nothing can tell a rotated key from
an untouched one, and a run reporting "no change" for a key you had just
rotated would be worse than one request too many. Only a credential this CLI
would have written is re-sent: the reference must name the apiToken field and
the credential must carry the name setup gives it, because the store is
tenant-wide and the platform accepts an apiToken write onto a credential of
any type.

The update route rejects credentialType, which the create route requires, so
only the secret is sent. Verified against a live instance: with the field
present every rotation fails with 422 "credentialType is not allowed key",
which no mock would have shown.

A re-sent secret reaches the workload when its containers next start, so the
run says that outright and names the restart rather than leaving a rotation
that looks applied. A re-send that fails is named too, and counted in the JSON
envelope, because it leaves the old value serving, changes no file, and stops
nothing.

A plain run now also names a declared variable whose .env value no longer
matches, the variables stored as credentials whose values cannot be compared at
all, and the ones neither flag can settle: a value that is not a plain string,
and a name whose kind has changed since it was written.
@wojtekwdr

Copy link
Copy Markdown
Owner Author

Moved to datarobot-oss/cli.

@wojtekwdr wojtekwdr closed this Aug 31, 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