pipeline:

  docker-build:
    image: plugins/docker:17.05
    repo: quay.io/ipedrazas/drone-helm
    tags: 
      - ${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:7}
    registry: quay.io
    email: "info@info.com"
    secrets: [ docker_username, docker_password ]
    when:
      branch:
        exclude: [ master]

  docker-build-master:
    image: plugins/docker:17.05
    repo: quay.io/ipedrazas/drone-helm
    tags: 
      - latest
      - ${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:7}
    registry: quay.io
    email: "info@info.com"
    secrets: [ docker_username, docker_password ]
    when:
      branch: [master]

  test_deploy:
    image: quay.io/ipedrazas/drone-helm:latest
    skip_tls_verify: true
    chart: ./charts/plugintest
    release: ${DRONE_BRANCH}
    prefix: TEST
    secrets: [ test_api_server, test_kubernetes_token]
    when:
      branch: [master]

  slack:
    image: plugins/slack
    channel: deploys
    username: drone
    template: >
      {{ build.author }} finished building  *<https://github.com/ipedrazas/{{ repo.name }}/{{ build.number }}|{{ build.branch }} ({{ build.number }})>* of {{ repo.name }}  with a {{ build.status }} status
    secrets: ["slack_webhook"]

plugin:
  name: drone-helm
  desc: Execute helm to
  type: deploy
  image: quay.io/ipedrazas/drone-helm
  labels:
    - deploy
    - kubernetes
    - helm
