Skip to content

sdomagala/drone-sls

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drone-sls

Drone plugin deploying Serverless Framework stacks.

At present, only AWS Lambda is supported.

Configuration

The following parameters are used to configure the plugin:

Drone configuration examples

The following pipeline will build and deploy to the selected environment

pipeline:
  deploy:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1

If you have a api-gateway domain

pipeline:
  serverless:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    create_domain: true

To populate lambda version to the alias

pipeline:
  serverless:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    version_alias: true
    when:
      event: push

  serverless-live:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    region: eu-central-1
    alias: LIVE
    when:
      event: deployment

The key parameter in serverless pipeline is version_alias: true. It enables marking all built lambda versions with short commit SHA aliases. That is how serverless-live is able to determine which lambda version should be switched.

Alias switching can be also used together with regular deployment

pipeline:
  serverless:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    version_alias: true
    alias: TEST
    when:
      event: push

The full monty

pipeline:
  serverless:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    version_alias: true
    create_domain: true
    conceal: true
    accelerate: true

  serverless-live:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    region: eu-central-1
    alias: LIVE
    when:
      event: deployment

Attaching S3 bucket events function

To run this step you need to have instaleed serverless-plugin-existing-s3 plugin (https://www.npmjs.com/package/serverless-plugin-existing-s3)

Following example will build, deploy and connect S3 bucket events to the selected environment

pipeline:
  deploy:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    s3_deploy: true

Options

DRONE_DEPLOY_TO_OVERRIDE (true by default) if set to false does not override $STAGE with $DRONE_DEPLOY_TO

pipeline:
  deploy:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    drone_deploy_to_override: false

CUSTOM_DIR (./ by default) lets you specify directory where your lambda function lays

pipeline:
  deploy:
    image: nodefortytwo/sls:v2.2.1
    role: arn:aws:iam::***:role/***
    action: deploy
    stage: dev
    region: eu-central-1
    custom_dir: ./custom/dir

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 95.9%
  • Dockerfile 4.1%