Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Drone 1.0 Feature

Bo-Yi Wu
April 22, 2019

Drone 1.0 Feature

This talk will describe all of the reasons for drone CI/CD 1.0, all of its features demonstrate its functionality, I will cover the background of Drone, how we built it, why we built it.

Bo-Yi Wu

April 22, 2019
Tweet

More Decks by Bo-Yi Wu

Other Decks in Technology

Transcript

  1. Drone CI/CD
    Container-Native
    Continuous Delivery Platform
    https://github.com/drone/drone
    2019/04/20

    View full-size slide

  2. Bo-yi Wu (appleboy)
    Software Engineer in Mediatek
    https://blog.wu-boy.com
    https://github.com/appleboy
    appleboy appleboy46

    View full-size slide

  3. Drone cloud
    free for the open source community
    https://cloud.drone.io/

    View full-size slide

  4. ---
    kind: pipeline
    name: default
    steps:
    - name: backend
    image: golang
    commands:
    - go build
    - go test
    - name: frontend
    image: node
    commands:
    - npm install
    - npm test

    View full-size slide

  5. https://github.com/drone/drone-ui

    View full-size slide

  6. Drone 1.0 Features

    View full-size slide

  7. Support Platform

    View full-size slide

  8. Multi-Machine
    Multi-Architecture
    Multi-Cloud

    View full-size slide

  9. ---
    kind: pipeline
    platform:
    arch: arm
    os: linux
    steps:
    - name: build
    image: golang
    commands:
    - go build
    - go test
    Linux amd64, Linux arm, Linux arm64 and Windows server

    View full-size slide

  10. ---
    kind: pipeline
    name: backend
    platform:
    arch: arm
    os: linux
    steps:
    - name: build
    image: golang
    commands:
    - go build
    - go test
    ---
    kind: pipeline
    name: frontend
    platform:
    arch: amd64
    os: linux
    steps:
    - name: build
    image: node
    commands:
    - npm install
    - npm test
    depends_on:
    - backend

    View full-size slide

  11. ---
    kind: pipeline
    name: default
    steps:
    - name: backend
    image: golang
    commands:
    - go build
    - go test
    - name: frontend
    image: golang
    commands:
    - npm install
    - npm test
    - name: build
    image: plugins/slack
    settings:
    channel: general
    depends_on:
    - backend
    - frontend
    Faster Pipelines with Parallelization

    View full-size slide

  12. local pipeline = import 'pipeline.libsonnet';
    local name = 'drone-ssh';
    [
    pipeline.test,
    pipeline.build(name, 'linux', 'amd64'),
    pipeline.build(name, 'linux', 'arm64'),
    pipeline.build(name, 'linux', 'arm'),
    pipeline.release,
    pipeline.notifications(depends_on=[
    'linux-amd64',
    'linux-arm64',
    'linux-arm',
    'release-binary',
    ]),
    ]
    Complex Configurations Simplified

    View full-size slide

  13. Secret Management

    View full-size slide

  14. ---
    kind: secret
    name: slack_webhook
    get:
    path: secret/data/slack
    name: webhook
    ---
    kind: pipeline
    name: default
    steps:
    - name: build
    image: golang
    commands:
    - go build
    - go test
    - name: notify
    image: plugins/slack
    settings:
    channel: general
    webhook:
    from_secret: slack_webhook

    View full-size slide

  15. per-organization
    secrets
    http://bit.ly/drone-org-secrets

    View full-size slide

  16. Cron Scheduling
    @hourly, @dailys, @weekly and @monthly

    View full-size slide

  17. # example when configuration
    when:
    cron: [ nightly ]
    # example trigger configuration
    trigger:
    cron: [ nightly ]

    View full-size slide

  18. Gitlab Pipelines
    image: ruby:2.2
    services:
    - postgres:9.3
    before_script:
    - bundle install
    test:
    script:
    - bundle exec rake spec
    ---
    kind: pipeline
    name: test
    platform:
    os: linux
    arch: amd64
    steps:
    - name: test
    image: ruby:2.2
    commands:
    - bundle install
    - bundle exec rake spec
    services:
    - name: postgres-9-3
    image: postgres:9.3
    ...
    $ drone convert .gitlab-ci.yml

    View full-size slide

  19. automatic runtime conversion

    View full-size slide

  20. Gitlab cache
    cache:
    untracked: true
    key: "$CI_BUILD_REF_NAME"
    paths:
    - node_modules/
    stages:
    - setup
    - test
    setup:
    stage: setup
    script:
    - npm install
    test:
    stage: test
    script:
    - npm test
    ---
    kind: pipeline
    name: setup
    platform:
    os: linux
    arch: amd64
    steps:
    - name: setup
    commands:
    - npm install
    - name: test
    commands:
    - npm test
    depends_on:
    - setup
    ...

    View full-size slide

  21. Bitbucket Pipelines
    pipelines:
    default:
    - step:
    name: Build and test
    image: node:8.5.0
    script:
    - npm install
    - npm test
    - npm build
    definitions:
    services:
    postgres:
    image: postgres:9.6.4
    ---
    kind: pipeline
    name: default
    platform:
    os: linux
    arch: amd64
    steps:
    - name: Build and test
    image: node:8.5.0
    commands:
    - npm install
    - npm test
    - npm build
    services:
    - name: postgres
    image: postgres:9.6.4
    ...
    $ drone convert bitbucket-pipelines.yml

    View full-size slide

  22. automatic runtime conversion

    View full-size slide

  23. Bitbucket cache
    pipelines:
    default:
    - step:
    caches:
    - node
    script:
    - npm install
    - npm test
    kind: pipeline
    name: default
    steps:
    - name: restore
    image: plugins/s3-cache
    settings:
    restore: true
    mount:
    - node_modules
    - name: build
    image: node
    commands:
    - npm install
    - npm test
    - name: rebuild
    image: plugins/s3-cache
    settings:
    rebuild: true
    mount:
    - node_modules

    View full-size slide

  24. Autoscale in Drone
    https://autoscale.drone.io/

    View full-size slide

  25. Agent
    Server
    Agent
    Agent Agent
    autoscaler
    https://github.com/drone/autoscaler

    View full-size slide

  26. Task - Agent
    drone_server=server:9000
    Task - Server
    port: 80/9000
    ECS - Fargate ECS - Service
    Target Group
    Port: 80
    Route 53 Service Discovery
    ALB / SSL
    Cloud Watch
    https://github.com/appleboy/drone-terraform-in-aws

    View full-size slide

  27. Drone CI
    Infrastructure

    View full-size slide

  28. Drone CI Infrastructure
    Agent
    Server
    Step 1
    git clone
    Step 2
    make build
    Step 3
    deploy app
    work space
    extra service
    Agent

    View full-size slide

  29. Drone Server
    • Support SSL
    • Custom SSL
    • Let’s Encrypt
    • Database
    • SQLite
    • MySQL
    • Postgres
    • S3 Storage: Store Large Text Files (build logs)
    • Log to stderr in joss-format by default

    View full-size slide

  30. Drone + Prometheus

    View full-size slide

  31. global:
    scrape_interval: 60s
    scrape_configs:
    - job_name: 'drone'
    bearer_token: your_token
    static_configs:
    - targets: ['domain.com']

    View full-size slide

  32. Drone Agent
    • Linux amd64
    • Linux arm
    • Linux arm64
    • Windows 1803
    • Windows 1809

    View full-size slide

  33. route builds to
    specific agents
    CPU, Memory, GPUS

    View full-size slide

  34. kind: pipeline
    name: default
    steps:
    - name: build
    image: golang
    commands:
    - go build
    - go test
    node:
    instance: highmem

    View full-size slide

  35. Drone Plugin
    Any language you want

    View full-size slide

  36. #!/bin/sh
    curl -X POST \
    -H 'Content-type: application/json' \
    -d '{"text":"hello"}' \
    https://hooks.slack.com/services/...

    View full-size slide

  37. #!/bin/sh
    curl -X POST \
    -H 'Content-type: application/json' \
    -d '{"text":"${PLUGIN_TEXT}"}' \
    ${PLUGIN_WEBHOOK}

    View full-size slide

  38. kind: pipeline
    name: default
    steps:
    - name: webhook
    image: janecitizen/slack
    settings:
    webhook: https://hooks.slack.com/...
    text: hello

    View full-size slide

  39. http://plugins.drone.io

    View full-size slide

  40. http://bit.ly/drone-2019

    View full-size slide