Do stap only on master branch

Hi,

First of all love the software, it was so easy to set up using github.
But there is one thing i just can’t figure out.
My pipline consists out of two steps:
1 do some python unit tests
2 build docker image and push it
My problem is i only want to build the docker image on the master branch. I tryed using the when option in my drone file build the image is build and pushed on all branches.

kind: pipeline
name: default

steps:
- name: django-tests
  image: python
  commands:
    - pip install -r requirements.txt
    - cd src
    - python manage.py test
- name: docker
  image: plugins/docker
  settings:
    username:
      from_secret: username
    password:
      from_secret: password
    repo: registry.domain.com
    registry: registry.sliceofbits.com/
    tags: latest
    when:
      branch:
        - master

Your indentation of when: is not correct. It needs to be one less indentation be part of the step definition, instead of under settings:.

e.g.

kind: pipeline
name: default

steps:
- name: django-tests
  image: python
  commands:
    - pip install -r requirements.txt
    - cd src
    - python manage.py test
- name: docker
  image: plugins/docker
  settings:
    username:
      from_secret: username
    password:
      from_secret: password
    repo: registry.domain.com
    registry: registry.sliceofbits.com/
    tags: latest
  when:
    branch:
    -   master

That was it now it works perfect.