Giter Club home page Giter Club logo

Comments (8)

bradrydzewski avatar bradrydzewski commented on September 26, 2024

In the short term you can add multiple rancher blocks to the yaml like this:

deploy:
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest
  rancher:
    url: https://example.rancher.com
    service: drone/drone
    docker_image: drone/drone:latest

If you are interested in the ability to update multiple services in a single block feel free to send a pull request with the functionality. I'm the core drone maintainer and I've never used Rancher -- so we rely on pull requests from the community for these sort of improvements. Cheers!

from drone-rancher.

josmo avatar josmo commented on September 26, 2024

@zacksiri I'm looking over the open issues with the plugin and wondered if with the option @bradrydzewski mentioned, does it still makes sense to add multiple service upgrades due to the complexity it adds. ie. batch size, auto-upgrades, etc are often times different per services even if based on the same image. I can add the above to the docs and that should hit all use cases unless I'm missing something :)

from drone-rancher.

shnhrrsn avatar shnhrrsn commented on September 26, 2024

@josmo This would be helpful in terms of keep everything DRY.

Take for instance the following config:

pipeline:

  # ...

  deploy_api:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_scheduler:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-scheduler
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_high:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-high
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

  deploy_queue_low:
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    service: stack/service-queue-low
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: false
    confirm: true
    batch_size: 5
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

It's super repetitive and if you want to change one of the more 'global' values, you need to change it in multiple spots, which can of course be fairly error prone. Refactoring the above to a single step with multiple services would be great:

pipeline:

  # ...

  deploy:
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    secrets: [ rancher_access_key, rancher_secret_key ]
    services:
      - service: stack/service
        start_first: true
        confirm: true
        timeout: 300
        batch_size: 1
      - service: stack/service-scheduler
        start_first: false
        confirm: true
      - service: stack/stack/service-queue
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-high
        start_first: false
        confirm: true
        batch_size: 5
      - service: stack/stack/service-queue-low
        start_first: false
        confirm: true
        batch_size: 5
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

from drone-rancher.

bradrydzewski avatar bradrydzewski commented on September 26, 2024

@shnhrrsn have you considered using YAML anchors to reduce boilerplate? I believe this can be handled at the YAML level without having to change the plugin itself.

deploy: &deploy
    group: deploy
    image: peloton/drone-rancher
    url: https://rancher.…
    docker_image: "image:${DRONE_BRANCH}.${DRONE_COMMIT_SHA:0:8}"
    start_first: true
    confirm: true
    timeout: 300
    batch_size: 1
    secrets: [ rancher_access_key, rancher_secret_key ]
    when:
      branch: [ production ]
      event:
        exclude: [ pull_request ]

pipeline:
  deploy_api:
    <<: *deploy
    service: stack/service


  deploy_scheduler:
    <<: *deploy
    service: stack/service-scheduler

from drone-rancher.

shnhrrsn avatar shnhrrsn commented on September 26, 2024

I'll give that a try, thanks for the quick reply!

walks away in shame

from drone-rancher.

josmo avatar josmo commented on September 26, 2024

@shnhrrsn I just wanted to check if what Brad mentioned would work :) If it does I'm going to close this out.

from drone-rancher.

shnhrrsn avatar shnhrrsn commented on September 26, 2024

Yep, worked perfect!

from drone-rancher.

josmo avatar josmo commented on September 26, 2024

Glad to hear!

from drone-rancher.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.