---
kind: pipeline
type: docker
name: default

steps:
  - name: Update Submodules
    image: alpine/git
    commands:
      - git submodule update --init --recursive
  - name: Test Dotfiles Install
    image: ubuntu:20.04
    commands:
      - apt-get -y update && apt-get install -y git
      - chmod +x ./bin/dotfiles
      - ./bin/dotfiles
  - name: Trigger Ansible Deployment
    image: plugins/downstream
    settings:
      server:
        from_secret: drone_server
      token:
        from_secret: drone_token
      fork: true
      repositories:
      - dueyfinster/ansible
  - name: Slack Notifications
    image: plugins/slack
    settings:
      channel: dev
      link_names: true
      template: >
        {{#failure build.status}}
          Broken build of `{{repo.name}}:{{build.branch}}` {{build.author}} with <${DRONE_COMMIT_LINK}|#{{truncate build.commit 8}}> <@neil>
          :new: :zombie: {{build.message}}
        {{/failure}}
        :stopwatch: {{ since build.started}}
        :gear: {{build.link}}
    environment:
      SLACK_WEBHOOK:
        from_secret: slack_webhook
    when:
      status: failure

---
kind: pipeline
type: docker
name: default

steps:
  - name: Update Submodules
    image: alpine/git
    commands:
      - git submodule update --init --recursive
  - name: Test Dotfiles Install
    image: ubuntu:20.04
    commands:
      - apt-get -y update && apt-get install -y git
      - chmod +x ./bin/dotfiles
      - ./bin/dotfiles
  - name: Trigger Ansible Deployment
    image: plugins/downstream
    settings:
      last_successful: true
      server:
        from_secret: drone_server
      token:
        from_secret: drone_token
      fork: true
      repositories:
      - dueyfinster/ansible
  - name: Slack Notifications
    image: plugins/slack
    settings:
      channel: dev
      link_names: true
      template: >
        {{#failure build.status}}
          Broken build of `{{repo.name}}:{{build.branch}}` {{build.author}} with <${DRONE_COMMIT_LINK}|#{{truncate build.commit 8}}> <@neil>
          :new: :zombie: {{build.message}}
        {{/failure}}
        :stopwatch: {{ since build.started}}
        :gear: {{build.link}}
    environment:
      SLACK_WEBHOOK:
        from_secret: slack_webhook
    when:
      status: failure

Use last successful for DS build Ansible
Use last successful for DS build Ansible