logo

Drone pipeline

#Drone pipeline overview

#.drone.yml example

steps:
# Update application version
- name: git-tag-and-push
  image: quay.io/openware/sdk-tools:#{latest_tag} # don't forget to fill latest_tag
  environment:
    BOT_USERNAME: kite-bot
    BOT_NAME: Kite Bot
    BOT_EMAIL: [email protected]
    BRANCH_NAME: ${DRONE_BRANCH}
    REPO_NAME: ${DRONE_REPO}
    GITHUB_API_KEY:
      from_secret: kite_bot_key # don't forget to set up secret key in drone setting
  commands:
    - BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:prebuild
  when:
    branch:
      - master
      - 2-3-stable # you need to put all stable branches here

# Build and push docker image using ".tags" file.
- name: docker-build-and-push
  image: plugins/docker
  settings:
    username:
      from_secret: quay_username
    password:
      from_secret: quay_password
    repo: quay.io/openware/#{component_name} # don't forget to fill component name
    registry: quay.io
  when:
    branch:
      - master
      - 2-3-stable # you need to put all stable branches here

# notify telegram and slack
- name: telegram-and-slack-notifying
  image: quay.io/openware/sdk-tools:#{latest_tag} # don't forget to fill latest_tag
  environment:
    REPO_NAME: ${DRONE_REPO}
    BRANCH_NAME: ${DRONE_BRANCH}
    TELEGRAM_BOT_TOKEN:
      from_secret: telegram_bot_token
    TELEGRAM_CHAT_ID:
      from_secret: telegram_chat_id
    GITHUB_API_KEY:
      from_secret: kite_bot_key
    SLACK_TOKEN:
      from_secret: slack_token # don't forget to set up secret key in drone setting
    SLACK_CHANNEL:
      from_secret: slack_channel
  commands:
    - BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:notify:all
   # If you want to get only telegram or slack notification, just write following
   # - BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:notify:telegram OR ci:notify:slack
  when:
    branch:
      - master
      - 2-3-stable # you need to put all stable branches here