kind: pipeline
name: default

platform:
  os: linux
  arch: amd64

clone:
  disable: true

steps:
- name: hg
  pull: default
  image: plugins/hg

- name: flake8
  depends:
  - hg
  pull: always
  image: alpine/flake8
  commands:
  - flake8

- name: isort
  depends:
  - hg
  pull: always
  image: xcgd/isort:odoo
  commands:
  - isort -c -df

- name: docker_docker_build_copy
  depends:
  - flake8
  - isort
  pull: default
  image: plugins/docker
  settings:
    dockerfile: Dockerfile.docker_build_copy
    repo: xcgd/odoo_scripts
    tag: docker_build_copy
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password

- name: docker_import_csv
  depends:
  - flake8
  - isort
  pull: default
  image: plugins/docker
  settings:
    dockerfile: Dockerfile.import_csv
    repo: xcgd/odoo_scripts
    tags:
    - import_csv
    - latest
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password

- name: mattermost
  depends:
  - docker_docker_build_copy
  - docker_import_csv
  pull: default
  image: plugins/slack
  settings:
    channel:
      from_secret: slack_channel
    username: drone
    webhook:
      from_secret: slack_webhook
  when:
    status:
    - failure
    - success
