How to use @aws-cdk/aws-codepipeline-actions - 10 common examples

To help you get started, we’ve selected a few @aws-cdk/aws-codepipeline-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudcomponents / cdk-components / examples / codepipeline-slack-approval-example / src / codepipeline-slack-approval-stack.ts View on Github external
const repository = new Repository(this, 'Repository', {
            repositoryName: 'MyRepositoryName',
            description: 'Some description.', // optional property
        });

        const sourceArtifact = new Artifact();

        const sourceAction = new CodeCommitSourceAction({
            actionName: 'CodeCommit',
            repository,
            output: sourceArtifact,
        });

        const project = new PipelineProject(this, 'MyProject');

        const buildAction = new CodeBuildAction({
            actionName: 'CodeBuild',
            project,
            input: sourceArtifact,
        });

        const slackBotToken = process.env.SLACK_BOT_TOKEN as string;
        const slackSigningSecret = process.env.SLACK_SIGNING_SECRET as string;
        const slackChannel = process.env.SLACK_CHANNEL as string;

        const approvalAction = new SlackApprovalAction({
            actionName: 'SlackApproval',
            slackBotToken,
            slackSigningSecret,
            slackChannel,
            externalEntityLink: 'http://cloudcomponents.org',
            additionalInformation:
github cloudcomponents / cdk-components / examples / codepipeline-check-parameter-action-example / src / codepipeline-check-parameter-action-stack.ts View on Github external
public constructor(parent: App, name: string, props?: StackProps) {
        super(parent, name, props);

        const repository = new Repository(this, 'Repository', {
            repositoryName: 'MyRepositoryName',
            description: 'Some description.', // optional property
        });

        const sourceArtifact = new Artifact();

        const sourceAction = new CodeCommitSourceAction({
            actionName: 'CodeCommit',
            repository,
            output: sourceArtifact,
            branch: 'master',
        });

        const checkAction = new CodepipelineCheckParameterAction({
            actionName: 'Check',
            parameterName: '/test',
            regExp: /^The.*Spain$/,
            logParameter: true,
        });

        new Pipeline(this, 'MyPipeline', {
            pipelineName: 'MyPipeline',
            stages: [
github humank / EventStormingWorkShop / deployment / coffeeshop-cdk / lib / coffee-shop-code-pipeline.ts View on Github external
});

        const sourceOutputEcr = new codepipeline.Artifact();
        const sourceOutputCodeCommit = new codepipeline.Artifact();
        const sourceActionECR = new codepipeline_actions.EcrSourceAction({
            actionName: 'ECR',
            repository: this.ecrRepository,
            imageTag: 'latest', // optional, default: 'latest'
            output: sourceOutputEcr,
        });

        const codecommitRepo = new codecommit.Repository(this, 'GitRepo', {
            repositoryName: CODECOMMIT_REPO_NAME
        });

        const sourceActionCodeCommit = new codepipeline_actions.CodeCommitSourceAction({
            actionName: 'CodeCommit',
            // repository: codecommit.Repository.fromRepositoryName(this, 'GitRepo', CODECOMMIT_REPO_NAME),
            repository: codecommitRepo,
            output: sourceOutputCodeCommit,
        });

        codePipeline.addStage({
            stageName: 'Source',
            actions: [sourceActionCodeCommit, sourceActionECR],
        });

        codePipeline.addStage({
            stageName: 'Deploy',
            actions: [
                new codepipeline_actions.EcsDeployAction({
                    actionName: 'DeployAction',
github cloudcomponents / cdk-components / examples / codepipeline-slack-approval-example / src / codepipeline-slack-approval-stack.ts View on Github external
public constructor(parent: App, name: string, props?: StackProps) {
        super(parent, name, props);

        const repository = new Repository(this, 'Repository', {
            repositoryName: 'MyRepositoryName',
            description: 'Some description.', // optional property
        });

        const sourceArtifact = new Artifact();

        const sourceAction = new CodeCommitSourceAction({
            actionName: 'CodeCommit',
            repository,
            output: sourceArtifact,
        });

        const project = new PipelineProject(this, 'MyProject');

        const buildAction = new CodeBuildAction({
            actionName: 'CodeBuild',
            project,
            input: sourceArtifact,
        });

        const slackBotToken = process.env.SLACK_BOT_TOKEN as string;
        const slackSigningSecret = process.env.SLACK_SIGNING_SECRET as string;
        const slackChannel = process.env.SLACK_CHANNEL as string;
github fourTheorem / slic-starter / cicd / lib / module-pipeline.ts View on Github external
moduleBuildProject,
      moduleDeployProject,
      pipelineRole,
      ...rest
    } = props

    super(scope, id, {
      pipelineName: `${moduleName}_${stageName}_pipeline`,
      artifactBucket: artifactsBucket,
      role: pipelineRole,
      ...rest
    })

    const sourceOutputArtifact = new Artifact()

    const sourceAction = new S3SourceAction({
      bucket: artifactsBucket,
      bucketKey: `${stageName}_module_pipelines/module_source/${moduleName}.zip`,
      output: sourceOutputArtifact,
      trigger: S3Trigger.EVENTS, // Use EVENTS instead of POLL to avoid triggering. We won't set up CloudTrail for S3.
      actionName: `${moduleName}_src`,
      role: pipelineRole
    })

    this.addStage({
      stageName: 'Source',
      actions: [sourceAction]
    })
    const environmentVars = {
      CROSS_ACCOUNT_ID: {
        type: BuildEnvironmentVariableType.PLAINTEXT,
        value: `${config.accountIds[stageName]}`
github aws / aws-cdk / packages / @aws-cdk / app-delivery / lib / pipeline-deploy-stack-action.ts View on Github external
this.stack = props.stack;
    const assets = this.stack.node.metadata.filter(md => md.type === cxapi.ASSET_METADATA);
    if (assets.length > 0) {
      // FIXME: Implement the necessary actions to publish assets
      throw new Error(`Cannot deploy the stack ${this.stack.stackName} because it references ${assets.length} asset(s)`);
    }

    const createChangeSetRunOrder = props.createChangeSetRunOrder || 1;
    const executeChangeSetRunOrder = props.executeChangeSetRunOrder || (createChangeSetRunOrder + 1);
    if (createChangeSetRunOrder >= executeChangeSetRunOrder) {
      throw new Error(`createChangeSetRunOrder (${createChangeSetRunOrder}) must be < executeChangeSetRunOrder (${executeChangeSetRunOrder})`);
    }

    const changeSetName = props.changeSetName || 'CDK-CodePipeline-ChangeSet';
    const capabilities = cfnCapabilities(props.adminPermissions, props.capabilities);
    this.prepareChangeSetAction = new cpactions.CloudFormationCreateReplaceChangeSetAction({
      actionName: 'ChangeSet',
      changeSetName,
      runOrder: createChangeSetRunOrder,
      stackName: props.stack.stackName,
      templatePath: props.input.atPath(props.stack.templateFile),
      adminPermissions: props.adminPermissions,
      deploymentRole: props.role,
      capabilities,
    });
    this.executeChangeSetAction = new cpactions.CloudFormationExecuteChangeSetAction({
      actionName: 'Execute',
      changeSetName,
      runOrder: executeChangeSetRunOrder,
      stackName: this.stack.stackName,
    });
  }
github humank / EventStormingWorkShop / deployment / coffeeshop-cdk / lib / coffee-shop-code-pipeline.ts View on Github external
fargatesvc.targetGroup.configureHealthCheck({
            interval: Duration.seconds(5),
            healthyHttpCodes: '200',
            healthyThresholdCount: 2,
            unhealthyThresholdCount: 3,
            timeout: Duration.seconds(4),
        })

        // CodePipeline
        const codePipeline = new codepipeline.Pipeline(this, 'CoffeeShopPipeline', {
            pipelineName: 'CoffeeShopPipeline',
        });

        const sourceOutputEcr = new codepipeline.Artifact();
        const sourceOutputCodeCommit = new codepipeline.Artifact();
        const sourceActionECR = new codepipeline_actions.EcrSourceAction({
            actionName: 'ECR',
            repository: this.ecrRepository,
            imageTag: 'latest', // optional, default: 'latest'
            output: sourceOutputEcr,
        });

        const codecommitRepo = new codecommit.Repository(this, 'GitRepo', {
            repositoryName: CODECOMMIT_REPO_NAME
        });

        const sourceActionCodeCommit = new codepipeline_actions.CodeCommitSourceAction({
            actionName: 'CodeCommit',
            // repository: codecommit.Repository.fromRepositoryName(this, 'GitRepo', CODECOMMIT_REPO_NAME),
            repository: codecommitRepo,
            output: sourceOutputCodeCommit,
        });
github humank / EventStormingWorkShop / deployment / coffeeshop-cdk / lib / coffee-shop-code-pipeline.ts View on Github external
const sourceActionCodeCommit = new codepipeline_actions.CodeCommitSourceAction({
            actionName: 'CodeCommit',
            // repository: codecommit.Repository.fromRepositoryName(this, 'GitRepo', CODECOMMIT_REPO_NAME),
            repository: codecommitRepo,
            output: sourceOutputCodeCommit,
        });

        codePipeline.addStage({
            stageName: 'Source',
            actions: [sourceActionCodeCommit, sourceActionECR],
        });

        codePipeline.addStage({
            stageName: 'Deploy',
            actions: [
                new codepipeline_actions.EcsDeployAction({
                    actionName: 'DeployAction',
                    service: fargatesvc.service,
                    // if your file is called imagedefinitions.json,
                    // use the `input` property,
                    // and leave out the `imageFile` property
                    input: sourceOutputCodeCommit,
                    // if your file name is _not_ imagedefinitions.json,
                    // use the `imageFile` property,
                    // and leave out the `input` property
                    // imageFile: sourceOutput.atPath('imageDef.json'),
                }),
            ],
        });
        new cdk.CfnOutput(this, 'ServiceURL', {
            value: `http://${fargatesvc.loadBalancer.loadBalancerDnsName}`
        })
github fourTheorem / slic-starter / cicd / lib / module-pipeline.ts View on Github external
} = props

    super(scope, id, {
      pipelineName: `${moduleName}_${stageName}_pipeline`,
      artifactBucket: artifactsBucket,
      role: pipelineRole,
      ...rest
    })

    const sourceOutputArtifact = new Artifact()

    const sourceAction = new S3SourceAction({
      bucket: artifactsBucket,
      bucketKey: `${stageName}_module_pipelines/module_source/${moduleName}.zip`,
      output: sourceOutputArtifact,
      trigger: S3Trigger.EVENTS, // Use EVENTS instead of POLL to avoid triggering. We won't set up CloudTrail for S3.
      actionName: `${moduleName}_src`,
      role: pipelineRole
    })

    this.addStage({
      stageName: 'Source',
      actions: [sourceAction]
    })
    const environmentVars = {
      CROSS_ACCOUNT_ID: {
        type: BuildEnvironmentVariableType.PLAINTEXT,
        value: `${config.accountIds[stageName]}`
      },
      TARGET_REGION: {
        type: BuildEnvironmentVariableType.PLAINTEXT,
        value: `${config.defaultRegions[stageName]}`
github fourTheorem / slic-starter / cicd / lib / orchestrator-pipeline.ts View on Github external
addTestStage(sourceOutputArtifact: Artifact) {
    const integrationTestProject = new IntegrationTestProject(
      this,
      `IntegrationTests`,
      {
        stageName: StageName.stg
      }
    )

    const integrationTestOutputArtifact = new Artifact()
    const integrationTestAction = new CodeBuildAction({
      actionName: 'integration_tests',
      input: sourceOutputArtifact,
      outputs: [integrationTestOutputArtifact],
      project: integrationTestProject
    })

    const e2eTestProject = new E2ETestProject(this, `e2eTests`, {
      stageName: StageName.stg
    })

    const e2eTestOutputArtifact = new Artifact()
    const e2eTestAction = new CodeBuildAction({
      actionName: 'e2e_tests',
      input: sourceOutputArtifact,
      outputs: [e2eTestOutputArtifact],
      project: e2eTestProject