-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-codepipeline): Jenkins build and test Actions.
- Loading branch information
Showing
11 changed files
with
939 additions
and
55 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
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
145 changes: 145 additions & 0 deletions
145
packages/@aws-cdk/aws-codepipeline/lib/custom-action-registration.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,145 @@ | ||
import cpapi = require('@aws-cdk/aws-codepipeline-api'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import { cloudformation } from './codepipeline.generated'; | ||
|
||
/** | ||
* The creation attributes used for defining a configuration property | ||
* of a custom Action. | ||
*/ | ||
export interface CustomActionProperty { | ||
/** | ||
* The name of the property. | ||
* You use this name in the `configuration` attribute when defining your custom Action class. | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* The description of the property. | ||
* | ||
* @default the description will be empty | ||
*/ | ||
description?: string; | ||
|
||
// because of @see URLs | ||
// tslint:disable:max-line-length | ||
|
||
/** | ||
* Whether this property is a key. | ||
* | ||
* @default false | ||
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-key | ||
*/ | ||
key?: boolean; | ||
|
||
/** | ||
* Whether this property is queryable. | ||
* Note that only a single property of a custom Action can be queryable. | ||
* | ||
* @default false | ||
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-customactiontype-configurationproperties.html#cfn-codepipeline-customactiontype-configurationproperties-queryable | ||
*/ | ||
queryable?: boolean; | ||
|
||
// tslint:enable:max-line-length | ||
|
||
/** | ||
* Whether this property is required. | ||
*/ | ||
required: boolean; | ||
|
||
/** | ||
* Whether this property is secret, | ||
* like a password, or access key. | ||
* | ||
* @default false | ||
*/ | ||
secret?: boolean; | ||
|
||
/** | ||
* The type of the property, | ||
* like 'String', 'Number', or 'Boolean'. | ||
* | ||
* @default 'String' | ||
*/ | ||
type?: string; | ||
} | ||
|
||
/** | ||
* Properties of registering a custom Action. | ||
*/ | ||
export interface CustomActionRegistrationProps { | ||
/** | ||
* The category of the Action. | ||
*/ | ||
category: cpapi.ActionCategory; | ||
|
||
/** | ||
* The artifact bounds of the Action. | ||
*/ | ||
artifactBounds: cpapi.ActionArtifactBounds; | ||
|
||
/** | ||
* The provider of the Action. | ||
*/ | ||
provider: string; | ||
|
||
/** | ||
* The version of your Action. | ||
* | ||
* @default '1' | ||
*/ | ||
version?: string; | ||
|
||
/** | ||
* The URL shown for the entire Action in the Pipeline UI. | ||
*/ | ||
entityUrl?: string; | ||
|
||
/** | ||
* The URL shown for a particular execution of an Action in the Pipeline UI. | ||
*/ | ||
executionUrl?: string; | ||
|
||
/** | ||
* The properties used for customizing the instance of your Action. | ||
* | ||
* @default [] | ||
*/ | ||
actionProperties?: CustomActionProperty[]; | ||
} | ||
|
||
/** | ||
* The resource representing registering a custom Action with CodePipeline. | ||
* For the Action to be usable, it has to be registered for every region and every account it's used in. | ||
* In addition to this class, you should most likely also provide your clients a class | ||
* representing your custom Action, extending the Action class, | ||
* and taking the `actionProperties` as properly typed, construction properties. | ||
*/ | ||
export class CustomActionRegistration extends cdk.Construct { | ||
constructor(parent: cdk.Construct, id: string, props: CustomActionRegistrationProps) { | ||
super(parent, id); | ||
|
||
new cloudformation.CustomActionTypeResource(this, 'Resource', { | ||
category: props.category, | ||
inputArtifactDetails: { | ||
minimumCount: props.artifactBounds.minInputs, | ||
maximumCount: props.artifactBounds.maxInputs, | ||
}, | ||
outputArtifactDetails: { | ||
minimumCount: props.artifactBounds.minOutputs, | ||
maximumCount: props.artifactBounds.maxOutputs, | ||
}, | ||
provider: props.provider, | ||
version: props.version, | ||
settings: { | ||
entityUrlTemplate: props.entityUrl, | ||
executionUrlTemplate: props.executionUrl, | ||
}, | ||
configurationProperties: props.actionProperties === undefined ? undefined : props.actionProperties.map((ap) => { return { | ||
key: ap.key || false, | ||
secret: ap.secret || false, | ||
...ap, | ||
}; }), | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.