-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cf): add user provided service support (#6293)
Co-Authored-By: Stu Pollock <spollock@pivotal.io>
- Loading branch information
1 parent
16fd07d
commit f3d35e1
Showing
13 changed files
with
581 additions
and
377 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
5 changes: 0 additions & 5 deletions
5
app/scripts/modules/cloudfoundry/src/pipeline/config/validation/ManifestConfigValidator.ts
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...cripts/modules/cloudfoundry/src/pipeline/config/validation/ServiceFieldValidatorConfig.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,5 @@ | ||
import { IValidatorConfig } from '@spinnaker/core'; | ||
|
||
export interface IServiceFieldValidatorConfig extends IValidatorConfig { | ||
serviceInputType: string; | ||
} |
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
24 changes: 0 additions & 24 deletions
24
...es/cloudfoundry/src/pipeline/config/validation/validateManifestRequiredField.validator.ts
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...les/cloudfoundry/src/pipeline/config/validation/validateServiceRequiredField.validator.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,22 @@ | ||
import { get, upperFirst } from 'lodash'; | ||
|
||
import { IPipeline, IStage, IStageOrTriggerValidator, ITrigger, PipelineConfigValidator } from '@spinnaker/core'; | ||
import { IServiceFieldValidatorConfig } from 'cloudfoundry/pipeline/config/validation/ServiceFieldValidatorConfig'; | ||
|
||
export class RequiredServiceFieldValidator implements IStageOrTriggerValidator { | ||
public validate( | ||
_pipeline: IPipeline, | ||
stage: IStage | ITrigger, | ||
validationConfig: IServiceFieldValidatorConfig, | ||
): string { | ||
const serviceInput: any = get(stage, 'manifest'); | ||
if (serviceInput.type !== validationConfig.serviceInputType) { | ||
return null; | ||
} | ||
const content: any = get(serviceInput, validationConfig.fieldName); | ||
const fieldLabel = upperFirst(validationConfig.fieldName); | ||
return content ? null : `<strong>${fieldLabel}</strong> is a required field for Deploy Service stages.`; | ||
} | ||
} | ||
|
||
PipelineConfigValidator.registerValidator('requiredServiceField', new RequiredServiceFieldValidator()); |
Oops, something went wrong.