1.3.2 • Published 10 months ago

serverless-codepipeline-plugin v1.3.2

Weekly downloads
52
License
MIT
Repository
github
Last release
10 months ago

serverless-codepipeline-plugin

Plugin for serverless to create a code pipeline.

Installation

npm i serverless-codepipeline-plugin

Usage

Minimal Example:

custom:
  codePipeline:
    image: aws/cli
    artifactBucket: my-bucket
    source:
      repository: my-repository
    stages:
      - name: build
        spec: ci/build.yml
      - name: deploy-dev
        spec: ci/deploy-dev.yml
      - name: deploy-prod
        spec: ci/deploy-prod.yml

General Properties

PropertyTypeRequiredDescription
computeTypestringfalseDefaults to BUILD_GENERAL1_SMALL. See allowed values.
enabledbooleanfalseSet to false if pipeline should not be deployed. This is useful for stage dependent creation of pipeline. Defaults to true.
enabledOnstringfalseSpecify name of stage during which the pipeline should be created. This overrides enabled.
imagestringtrueProvide a docker image name.
artifactBucketstringtrueBucket name for stored artifacts
envRecord<string, string>falseMap of environment variables that are made available to each stage.
sourceSource ObjecttrueConfiguration for source.
stagesArray\trueList of stages.
logRetentionnumberfalseNumber of days for which codebuild logs are retained in cloudwatch. See allowed values. Defaults to no limit.
tagsRecord<string, string>falseMap of tags. Merged with tags defined in provider. The tags are applied to all created resources (IAM Role, CodeBuild Projects and Pipeline).
vpcVPCConfig ObjectfalseContains the configuration for a VPC. This will be used for all stages.

Source Properties

Currently, the plugin supports CodeCommit, GitHub and S3 as sources.

CodeCommit Source Properties

PropertyTypeRequiredDescription
type'codecommit'falseWhen no type is defined, it defaults to codecommit.
repositorystringtrueName of repository in codecommit.
branchstringfalseBranch that should be checked out. Defaults to master.
triggerbooleanfalseSet to false if the pipeline should not be triggered on source changes. Defaults to true.

Note: With version 1.3.x and above the trigger is no longer polling. Instead, an event rule is created that triggers the pipeline.

GitHub Source Properties

PropertyTypeRequiredDescription
type'github'trueType must be set to github to use it as a source.
repositorystringtrueName of repository with prepended owner (e.g. 0ptional/serverless-codepipeline)
branchstringfalseBranch that should be checked out. Defaults to master.
triggerbooleanfalseSet to false if the pipeline should not be triggered on source changes. Defaults to true.
githubTokenstringtrueTo use repositories on GitHub you must provide an OAuth token for a GitHub user. For a guide on how to create the token, read this.

S3 Source Properties

PropertyTypeRequiredDescription
type's3'trueType must be set to s3 to use it as a source.
s3BucketstringtrueName of S3 Bucket.
s3KeystringfalseKey to object (must be zip archive).
triggerbooleanfalseSet to false if the pipeline should not be triggered on source changes. Defaults to true.

Stage Properties

PropertyTypeRequiredDescription
namestringtrueStage name. Output names are also based on stage name.
specstringtrueLocation of the CodeBuild spec file within the primary input (source).
inputsstring[]falseSpecify all stage names from which a stage should receive additional input. The source input is always the primary.
imagestringfalseSpecify a docker image if this stage should use a different image.
envRecord<string, string>falseAdds stage specifc environment variables. Stage variables are merged with global variables.
computeTypestringfalseSpecify if this stage should run with a different compute type than provided in general config.
manualExecutionbooleanfalseSet to true, if this stage should not run automatically. Defaults to false.

VPCConfig Properties

PropertyTypeRequiredDescription
idstringtrueVPC ID.
subnetsstring[]trueList of VPC subnets to use.
securityGroupIdsstring[]trueList of security group ids.

Full Example

custom:
  codepipeline:
    # global config
    computeType: BUILD_GENERAL1_SMALL
    # enabled: ${self:custom.${self:provider.stage}.deployPipeline}
    enabledOn: staging # use this for a single stage dependent deployment
    image: aws/cli
    artifactBucket: my-bucket
    logRetention: 7
    tags:
      PipelineTag: value
    env:
      PIPELINE_ENV_VAR: hello

    # source config
    source:
      type: github
      repository: '0ptional/serverless-codepipeline'
      branch: master
      trigger: false
      githubToken: abc*******

    # stage config
    stages:
      - name: build
        spec: ci/build.yml
        image: aws/cli
        computeType: BUILD_GENERAL1_SMALL
        env:
          STAGE_ENV_VAR: world
      - name: deploy-dev
        spec: ci/deploy-dev.yml
        inputs: [ build ]
      - name: deploy-prod
        manualExecution: true
        spec: ci/deploy-prod.yml
        inputs: [ build ]

Todos

  • Support ECR as source
1.2.0

11 months ago

1.2.8

11 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.3.2

10 months ago

1.2.3

11 months ago

1.3.1

10 months ago

1.2.2

11 months ago

1.3.0

11 months ago

1.2.1

11 months ago

1.2.9

11 months ago

1.2.12

11 months ago

1.2.10

11 months ago

1.2.11

11 months ago

1.1.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago