How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // create a pipeline
    import * as codecommit from '@aws-cdk/aws-codecommit';
    
    const pipeline = new codepipeline.Pipeline(this, 'Pipeline');
    
    // add a stage
    const sourceStage = pipeline.addStage({ stageName: 'Source' });
    
    // add a source action to the stage
    declare const repo: codecommit.Repository;
    declare const sourceArtifact: codepipeline.Artifact;
    sourceStage.addAction(new codepipeline_actions.CodeCommitSourceAction({
    actionName: 'Source',
    output: sourceArtifact,
    repository: repo,
    }));
    
    // ... add more stages
    
    Docs
  • import * as sns from '@aws-cdk/aws-sns';
    
    const pipeline = new codepipeline.Pipeline(this, 'MyPipeline');
    const approveStage = pipeline.addStage({ stageName: 'Approve' });
    const manualApprovalAction = new codepipeline_actions.ManualApprovalAction({
      actionName: 'Approve',
      notificationTopic: new sns.Topic(this, 'Topic'), // optional
      notifyEmails: [
        'some_email@example.com',
      ], // optional
      additionalInformation: 'additional info', // optional
    });
    approveStage.addAction(manualApprovalAction);
    // `manualApprovalAction.notificationTopic` can be used to access the Topic
    // after the Action has been added to a Pipeline
    
    Docs
  • import * as ecs from '@aws-cdk/aws-ecs';
    
    const service = ecs.BaseService.fromServiceArnWithCluster(this, 'EcsService',
      'arn:aws:ecs:us-east-1:123456789012:service/myClusterName/myServiceName'
    );
    const pipeline = new codepipeline.Pipeline(this, 'MyPipeline');
    const buildOutput = new codepipeline.Artifact();
    // add source and build stages to the pipeline as usual...
    const deployStage = pipeline.addStage({
      stageName: 'Deploy',
      actions: [
        new codepipeline_actions.EcsDeployAction({
          actionName: 'DeployAction',
          service: service,
          input: buildOutput,
        }),
      ],
    });
    
    Docs
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as codepipeline from '@aws-cdk/aws-codepipeline';
    import * as sns from '@aws-cdk/aws-sns';
    import * as pipelines from '@aws-cdk/pipelines';
    
    declare const artifact: codepipeline.Artifact;
    declare const stage: codepipeline.IStage;
    declare const stageHost: pipelines.IStageHost;
    declare const topic: sns.Topic;
    const cdkStage = new pipelines.CdkStage(this, 'MyCdkStage', {
      cloudAssemblyArtifact: artifact,
      host: stageHost,
      pipelineStage: stage,
      stageName: 'stageName',
    
      // the properties below are optional
      confirmBroadeningPermissions: false,
      securityNotificationTopic: topic,
    });
    
    Docs
  • import * as codebuild from '@aws-cdk/aws-codebuild';
    import * as codepipeline from '@aws-cdk/aws-codepipeline';
    import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions';
    import * as cdk from '@aws-cdk/core';
    import * as cicd from '@aws-cdk/app-delivery';
    import * as iam from '@aws-cdk/aws-iam';
    
    class MyServiceStackA extends cdk.Stack {}
    class MyServiceStackB extends cdk.Stack {}
    
    const app = new cdk.App();
    
    // We define a stack that contains the CodePipeline
    const pipelineStack = new cdk.Stack(app, 'PipelineStack');
    const pipeline = new codepipeline.Pipeline(pipelineStack, 'CodePipeline', {
      // Mutating a CodePipeline can cause the currently propagating state to be
      // "lost". Ensure we re-run the latest change through the pipeline after it's
      // been mutated so we're sure the latest state is fully deployed through.
      restartExecutionOnUpdate: true,
      /* ... */
    });
    
    // Configure the CodePipeline source - where your CDK App's source code is hosted
    const sourceOutput = new codepipeline.Artifact();
    const source = new codepipeline_actions.GitHubSourceAction({
      actionName: 'GitHub',
      output: sourceOutput,
      owner: 'myName',
      repo: 'myRepo',
      oauthToken: cdk.SecretValue.plainText('secret'),
    });
    pipeline.addStage({
      stageName: 'source',
      actions: [source],
    });
    
    const project = new codebuild.PipelineProject(pipelineStack, 'CodeBuild', {
      /**
      * Choose an environment configuration that meets your use case.
      * For NodeJS, this might be:
      *
      * environment: {
      *   buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0,
      * },
      */
    });
    const synthesizedApp = new codepipeline.Artifact();
    const buildAction = new codepipeline_actions.CodeBuildAction({
      actionName: 'CodeBuild',
      project,
      input: sourceOutput,
      outputs: [synthesizedApp],
    });
    pipeline.addStage({
      stageName: 'build',
      actions: [buildAction],
    });
    
    // Optionally, self-update the pipeline stack
    const selfUpdateStage = pipeline.addStage({ stageName: 'SelfUpdate' });
    selfUpdateStage.addAction(new cicd.PipelineDeployStackAction({
      stack: pipelineStack,
      input: synthesizedApp,
      adminPermissions: true,
    }));
    
    // Now add our service stacks
    const deployStage = pipeline.addStage({ stageName: 'Deploy' });
    const serviceStackA = new MyServiceStackA(app, 'ServiceStackA', { /* ... */ });
    // Add actions to deploy the stacks in the deploy stage:
    const deployServiceAAction = new cicd.PipelineDeployStackAction({
      stack: serviceStackA,
      input: synthesizedApp,
      // See the note below for details about this option.
      adminPermissions: false,
    });
    deployStage.addAction(deployServiceAAction);
    // Add the necessary permissions for you service deploy action. This role is
    // is passed to CloudFormation and needs the permissions necessary to deploy
    // stack. Alternatively you can enable [Administrator](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator) permissions above,
    // users should understand the privileged nature of this role.
    const myResourceArn = 'arn:partition:service:region:account-id:resource-id';
    deployServiceAAction.addToDeploymentRolePolicy(new iam.PolicyStatement({
      actions: ['service:SomeAction'],
      resources: [myResourceArn],
      // add more Action(s) and/or Resource(s) here, as needed
    }));
    
    const serviceStackB = new MyServiceStackB(app, 'ServiceStackB', { /* ... */ });
    deployStage.addAction(new cicd.PipelineDeployStackAction({
      stack: serviceStackB,
      input: synthesizedApp,
      createChangeSetRunOrder: 998,
      adminPermissions: true, // no need to modify the role with admin
    }));
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples