GithubHelp home page GithubHelp logo

drone-sls's Introduction

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

drone-sls's People

Contributors

kgruszka avatar nodefortytwo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.