workspace:
  base: /go
  path: src/github.com/josmo/drone-rancher
pipeline:
  build:
    image: golang:1.6
    environment:
      - CGO_ENABLED=0
    commands:
      - go vet
      - go test -cover -coverprofile=coverage.out
      - go build -ldflags "-s -w -X main.build=$DRONE_BUILD_NUMBER" -a -tags netgo

  publish:
    image: plugins/docker
    username: josmo
    secrets: [ docker_password ]
    repo: peloton/drone-rancher
    tag:
      - ${DRONE_BUILD_NUMBER}
      - latest
    when:
      branch: master
      event: push

plugin:
  name: Rancher
  desc: Deploy or update a project on Rancher
  type: deploy
  image: peloton/rancher
  labels:
    - rancher
    - docker
