Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error and disable deployment when environment and secrets have duplicates #2338

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

dotNomad
Copy link
Collaborator

@dotNomad dotNomad commented Oct 1, 2024

This PR adds a new error that disables deployment - similar to a missing credential error in style - when there are names shared in Environment and Secrets in the selected Configuration.

Preview

CleanShot 2024-10-01 at 16 15 42@2x

CleanShot 2024-10-01 at 16 15 30@2x

The duplicated names are present in the error to make it easier to resolve, along with a link to edit the configuration similar to other errors.

Intent

Resolves #2326

Type of Change

    • Bug Fix
    • New Feature
    • Breaking Change
    • Documentation
    • Refactor
    • Tooling

@dotNomad dotNomad linked an issue Oct 1, 2024 that may be closed by this pull request
Comment on lines 33 to 47
<template v-if="home.duplicatedEnvironmentVariables.length === 1">
A duplicate name was
</template>
<template v-if="home.duplicatedEnvironmentVariables.length > 1">
Duplicate names were
</template>
found in Secrets and Environment.
<a
class="webview-link"
role="button"
@click="
onEditConfiguration(home.selectedConfiguration!.configurationPath)
"
>Edit the Configuration</a
>.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about saying something like "(A variable was|Variables were) set as both a secret and environment variable. (It|They) must only be in one or the other. Edit the Configuration." It's true that the names are the problem that's an issue, but at this point in the UX I think most people think of them more holistically and the names are below so it's clear that the names are the issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great suggestion. I really struggled coming up with text here and I think yours is a huge improvement. I'll make that change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here is the UI with that text change with very minor adjustments. Let me know what you think.

Images

CleanShot 2024-10-02 at 11 13 09
CleanShot 2024-10-02 at 11 13 21

@sagerb
Copy link
Collaborator

sagerb commented Oct 2, 2024

@dotNomad The work you've done here definitely overlaps/conflicts with the work in #2331. We should discuss how we'll move forward and resolve this.

Issue has been resolved!

@dotNomad
Copy link
Collaborator Author

dotNomad commented Oct 3, 2024

We should discuss how we'll move forward and resolve this.

We could merge this prior since it is a relatively simpler change, and componentize it with the other work.

Copy link
Collaborator

@sagerb sagerb left a comment

Choose a reason for hiding this comment

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

Let me know what you think about my question. Thanks!

Copy link
Collaborator

@sagerb sagerb left a comment

Choose a reason for hiding this comment

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

Concerns resolved.

Base automatically changed from dotnomad/secret-add to main October 4, 2024 15:29
@dotNomad dotNomad merged commit 79117e1 into main Oct 4, 2024
14 checks passed
@dotNomad dotNomad deleted the dotnomad/envvar-overlap-err branch October 4, 2024 15:29
@kgartland-rstudio
Copy link
Collaborator

Verified the proper warning is shown if a Secret/Env Var collision occurs within the config. Deployment button remains active and deploys properly even if you forgo the warning.

Verified an error message is thrown when adding a Secret where an already-existing Environment Variable.

Tested on:

  • Positron on MacOS + Windows + Linux
  • VSCode MacOS + Windows + Linux
Screenshot 2024-10-07 at 11 14 39 AM Screenshot 2024-10-07 at 11 16 08 AM

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.

Secrets and Environment collision
4 participants