forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/display-lots-of-parameters
* master: (28 commits) feat(kubernetes): feature-flagged support for kubernetes traffic management strategies (spinnaker#6816) feat(cf): Create Service Key pipeline stage (spinnaker#6821) feat(core): Create pipeline from v2 template list fix(provider/cf): Clone model so Orca monitors the correct foundation for up instances (spinnaker#6817) chore(kubernetes): refactor BasicSettings component to be usable in stages (spinnaker#6820) fix(triggers): Remove RunAsUser if pipeline permissions enabled for react triggers. (spinnaker#6818) feat(provider/azure): Add redblack strategy for azure (spinnaker#6801) fix(mptv2): clicking a view link on template list screen throws exception (spinnaker#6815) fix(artifacts): helm artifact, replace object assignw with object spread (spinnaker#6814) fix(provider/cf): Fix provider selection for resize stage in pipeline (spinnaker#6754) fix(artifacts): default helm artifact editor is broken (spinnaker#6811) fix(google): revert "select all zones by default when deploying a regional gce server group (spinnaker#6751)" (spinnaker#6808) fix(google): GCE create server group and load balancer fixes (spinnaker#6806) Bump package core to 0.0.350 and amazon to 0.0.184 (spinnaker#6807) fix(amazon): hide security groups on NLBs (spinnaker#6803) refactor(core): de-angularize ApplicationModelBuilder, fix project executions (spinnaker#6802) fix(google): fix autohealing health checks in deploy stages (spinnaker#6804) fix(kubernetes): show Deployment clusters in Find Artifacts from Resource stages (spinnaker#6794) fix(triggers): Add lastSuccessfulBuild as a build option in Jenkins default artifact (spinnaker#6797) fix(provider/cf): Make expected artifacts selectable as clone manifests (spinnaker#6796) ...
- Loading branch information
Showing
28 changed files
with
793 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...dry/src/pipeline/stages/createServiceKey/CloudfoundryCreateServiceKeyExecutionDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as React from 'react'; | ||
import { get } from 'lodash'; | ||
|
||
import { | ||
AccountTag, | ||
ExecutionDetailsSection, | ||
IExecutionDetailsSectionProps, | ||
StageExecutionLogs, | ||
StageFailureMessage, | ||
} from '@spinnaker/core'; | ||
|
||
export function CloudfoundryCreateServiceKeyExecutionDetails(props: IExecutionDetailsSectionProps) { | ||
const { stage } = props; | ||
const { context } = stage; | ||
const account = get(context, 'service.account', undefined); | ||
const region = get(context, 'service.region', undefined); | ||
const serviceInstanceName = get(context, 'serviceInstanceName', undefined); | ||
const serviceKeyName = get(context, 'serviceKeyName', undefined); | ||
return ( | ||
<ExecutionDetailsSection name={props.name} current={props.current}> | ||
<div className="step-section-details"> | ||
<div className="row"> | ||
<div className="col-md-12"> | ||
<dl className="dl-horizontal"> | ||
<dt>Account</dt> | ||
<dd> | ||
<AccountTag account={account} /> | ||
</dd> | ||
<dt>Region</dt> | ||
<dd> | ||
{region} | ||
<br /> | ||
</dd> | ||
<dt>Service Instance Name</dt> | ||
<dd> | ||
{serviceInstanceName} | ||
<br /> | ||
</dd> | ||
<dt>Service Key Name</dt> | ||
<dd> | ||
{serviceKeyName} | ||
<br /> | ||
</dd> | ||
</dl> | ||
</div> | ||
</div> | ||
</div> | ||
<StageFailureMessage stage={props.stage} message={props.stage.failureMessage} /> | ||
<StageExecutionLogs stage={props.stage} /> | ||
</ExecutionDetailsSection> | ||
); | ||
} | ||
|
||
// TODO: refactor this to not use namespace | ||
// eslint-disable-next-line | ||
export namespace CloudfoundryCreateServiceKeyExecutionDetails { | ||
export const title = 'cloudfoundryCreateServiceKeyConfig'; | ||
} |
114 changes: 114 additions & 0 deletions
114
...dfoundry/src/pipeline/stages/createServiceKey/CloudfoundryCreateServiceKeyStageConfig.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import * as React from 'react'; | ||
|
||
import { Option } from 'react-select'; | ||
|
||
import { | ||
AccountService, | ||
IAccount, | ||
IRegion, | ||
IStageConfigProps, | ||
ReactSelectInput, | ||
StageConfigField, | ||
TextInput, | ||
} from '@spinnaker/core'; | ||
|
||
interface ICloudfoundryCreateServiceKeyStageConfigState { | ||
accounts: string[]; | ||
regions: string[]; | ||
} | ||
|
||
export class CloudfoundryCreateServiceKeyStageConfig extends React.Component< | ||
IStageConfigProps, | ||
ICloudfoundryCreateServiceKeyStageConfigState | ||
> { | ||
constructor(props: IStageConfigProps) { | ||
super(props); | ||
props.stage.cloudProvider = 'cloudfoundry'; | ||
this.state = { | ||
accounts: [], | ||
regions: [], | ||
}; | ||
} | ||
|
||
public componentDidMount = () => { | ||
AccountService.listAccounts('cloudfoundry').then((rawAccounts: IAccount[]) => { | ||
this.setState({ accounts: rawAccounts.map(it => it.name) }); | ||
}); | ||
if (this.props.stage.credentials) { | ||
this.clearAndReloadRegions(); | ||
} | ||
}; | ||
|
||
private clearAndReloadRegions = () => { | ||
this.setState({ regions: [] }); | ||
AccountService.getRegionsForAccount(this.props.stage.credentials).then((regionList: IRegion[]) => { | ||
const regions = regionList.map(r => r.name); | ||
regions.sort((a, b) => a.localeCompare(b)); | ||
this.setState({ regions }); | ||
}); | ||
}; | ||
|
||
private serviceInstanceNameUpdated = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
this.props.updateStageField({ serviceInstanceName: event.target.value }); | ||
}; | ||
|
||
private serviceKeyNameUpdated = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
this.props.updateStageField({ serviceKeyName: event.target.value }); | ||
}; | ||
|
||
private accountUpdated = (option: Option<string>) => { | ||
const credentials = option.target.value; | ||
this.setState({ | ||
regions: [], | ||
}); | ||
this.props.updateStageField({ | ||
credentials, | ||
region: '', | ||
}); | ||
this.clearAndReloadRegions(); | ||
}; | ||
|
||
private regionUpdated = (option: Option<string>) => { | ||
const region = option.target.value; | ||
this.props.updateStageField({ | ||
region, | ||
}); | ||
}; | ||
|
||
public render() { | ||
const { credentials, region, serviceInstanceName, serviceKeyName } = this.props.stage; | ||
const { accounts, regions } = this.state; | ||
|
||
return ( | ||
<div className="form-horizontal"> | ||
<StageConfigField label="Account"> | ||
<ReactSelectInput | ||
clearable={false} | ||
onChange={this.accountUpdated} | ||
value={credentials} | ||
stringOptions={accounts} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Region"> | ||
<ReactSelectInput clearable={false} onChange={this.regionUpdated} value={region} stringOptions={regions} /> | ||
</StageConfigField> | ||
<StageConfigField label="Service Instance Name"> | ||
<TextInput | ||
type="text" | ||
className="form-control" | ||
onChange={this.serviceInstanceNameUpdated} | ||
value={serviceInstanceName} | ||
/> | ||
</StageConfigField> | ||
<StageConfigField label="Service Key Name"> | ||
<TextInput | ||
type="text" | ||
className="form-control" | ||
onChange={this.serviceKeyNameUpdated} | ||
value={serviceKeyName} | ||
/> | ||
</StageConfigField> | ||
</div> | ||
); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...dfoundry/src/pipeline/stages/createServiceKey/cloudfoundryCreateServiceKeyStage.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CloudfoundryCreateServiceKeyStageConfig } from './CloudfoundryCreateServiceKeyStageConfig'; | ||
import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core'; | ||
import { CloudfoundryCreateServiceKeyExecutionDetails } from './CloudfoundryCreateServiceKeyExecutionDetails'; | ||
|
||
Registry.pipeline.registerStage({ | ||
accountExtractor: (stage: IStage) => stage.context.credentials, | ||
configAccountExtractor: (stage: IStage) => [stage.credentials], | ||
cloudProvider: 'cloudfoundry', | ||
component: CloudfoundryCreateServiceKeyStageConfig, | ||
controller: 'BaseProviderStageCtrl as baseProviderStageCtrl', | ||
description: 'Create a service key', | ||
executionDetailsSections: [CloudfoundryCreateServiceKeyExecutionDetails, ExecutionDetailsTasks], | ||
key: 'createServiceKey', | ||
label: 'Create Service Key', | ||
validators: [ | ||
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' }, | ||
{ type: 'requiredField', fieldName: 'region', preventSave: true }, | ||
{ type: 'requiredField', fieldName: 'serviceInstanceName', preventSave: true }, | ||
{ type: 'requiredField', fieldName: 'serviceKeyName', preventSave: true }, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/scripts/modules/core/src/domain/IPipelineTemplateConfigV2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { IPipeline } from 'core/domain'; | ||
|
||
export interface IPipelineTemplateConfigV2 extends IPipeline { | ||
inherit?: string[]; | ||
schema: string; | ||
template: { | ||
artifactAccount: string; | ||
reference: string; | ||
type: string; | ||
}; | ||
type: string; | ||
variables?: { [key: string]: any }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/scripts/modules/core/src/pipeline/config/templates/v2/ApplicationSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import Select, { Option } from 'react-select'; | ||
|
||
import { IApplicationSummary } from 'core/application'; | ||
|
||
interface IApplicatonSelectorProps { | ||
applications: IApplicationSummary[]; | ||
applicationSelectCallback: (selection: Option) => void; | ||
selectedApplication: IApplicationSummary; | ||
} | ||
|
||
export default class ApplicationSelector extends React.Component<IApplicatonSelectorProps> { | ||
public render() { | ||
const { applications, applicationSelectCallback, selectedApplication } = this.props; | ||
|
||
const selectedApplicationOption: Option = selectedApplication | ||
? { label: selectedApplication.name, value: selectedApplication.name } | ||
: null; | ||
|
||
return ( | ||
<div className="form-group clearfix"> | ||
<div className="col-md-3 sm-label-right"> | ||
<b>Application</b> | ||
</div> | ||
<div className="col-md-7"> | ||
<Select | ||
options={applications.map(({ name }: IApplicationSummary): Option => ({ label: name, value: name }))} | ||
clearable={true} | ||
value={selectedApplicationOption} | ||
onChange={applicationSelectCallback} | ||
onSelectResetsInput={false} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.