Skip to content

Commit

Permalink
Ability to provide secrets and env vars in deploy wizzard
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Aug 13, 2024
1 parent 1c5c91c commit 4b8ff55
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions web/src/views/deployWizzard/deployWizzard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Confetti from 'react-confetti'
import { Loading } from '../repo/deployStatus';
import { ACTION_TYPE_CLEAR_DEPLOY, ACTION_TYPE_POPUPWINDOWSUCCESS } from "../../redux/redux";
import { v4 as uuidv4 } from 'uuid';
import SealedSecretWidget from "../envConfig/sealedSecretWidget";

export function DeployWizzard(props) {
const { store, gimletClient } = props
Expand Down Expand Up @@ -158,6 +159,12 @@ export function DeployWizzard(props) {

const customFields = {
imageWidget: ImageWidget,
sealedSecretWidget: (props) => <SealedSecretWidget
{...props}
gimletClient={gimletClient}
store={store}
env={env}
/>,
ingressWidget: IngressWidget
}

Expand Down Expand Up @@ -336,7 +343,8 @@ export function DeployWizzard(props) {
validationCallback={validationCallback}
/>
</div>
{ onechart && !staticSite &&
{ onechart &&
<>
<div className='w-full card p-6 pb-8'>
<HelmUI
key={`helmui-envvars`}
Expand All @@ -349,6 +357,19 @@ export function DeployWizzard(props) {
validationCallback={validationCallback}
/>
</div>
<div className='w-full card p-6 pb-8'>
<HelmUI
key={`helmui-sealedsecrets`}
schema={patchedTemplate.schema}
config={[patchedTemplate.uiSchema[3]]}
fields={customFields}
values={configFile.values}
setValues={setValues}
validate={true}
validationCallback={validationCallback}
/>
</div>
</>
}
<div className='w-full card p-6 pb-8'>
<HelmUI
Expand Down Expand Up @@ -478,10 +499,10 @@ export function DeployWizzard(props) {
</div>
</div>
</div>
<div className={`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-8 flex ${!deployed ? "opacity-25 dark:opacity-30" : ""}`}>
<div className={`max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-8 flex ${!deployed && !deploying ? "opacity-25 dark:opacity-30" : ""}`}>
<div className="w-80 relative">
<div className={`absolute h-8 left-0 top-0 flex w-2 -mt-10 justify-center`}>
<div className={`w-px ${deployed ? 'bg-neutral-400' : 'bg-neutral-200'}`} />
<div className={`w-px ${deployed || deploying ? 'bg-neutral-400' : 'bg-neutral-200'}`} />
</div>
<h2 className='text-lg font-medium flex items-center'>
<span className={`inline-block h-2 w-2 rounded-full bg-neutral-900 dark:bg-neutral-100 mr-2`} />
Expand All @@ -491,10 +512,10 @@ export function DeployWizzard(props) {
<div className="w-full ml-14 space-y-6">
<button
onClick={saveConfig}
disabled={!deployed || savingConfigInProgress}
className={`w-full ${deployed ? "primaryButton" : "primaryButtonDisabled"}`}>
disabled={!(deployed || deploying) || savingConfigInProgress}
className={`w-full ${deployed ? "primaryButton" : deploying ? "secondaryButton" : "primaryButtonDisabled"}`}>
<p className='w-full flex text-center justify-center'>
{savingConfigInProgress ? <><Loading />Writing Configuration to Git</> : 'Write Configuration to Git'}
{savingConfigInProgress ? <><Loading />Writing Configuration to Git</> : `Write Configuration to Git ${deploying ? " (even though the app is not deployed yet)" : ""}`}
</p>
</button>
</div>
Expand Down Expand Up @@ -551,6 +572,17 @@ export const patchUIWidgets = (chart, registries, preferredDomain) => {
}
}

if (chart.uiSchema.length >= 3) {
chart.uiSchema[3].uiSchema = {
...chart.uiSchema[3].uiSchema,
"#/properties/sealedSecrets": {
"additionalProperties": {
"ui:field": "sealedSecretWidget"
}
},
}
}

return chart
}

Expand Down

0 comments on commit 4b8ff55

Please sign in to comment.