josmo / drone-rancher

Drone plugin for triggering Rancher deployments
53 stars 35 forks source link

Added tag-filter param to support Continuous Delivery #26

Closed digitalbanana closed 5 years ago

digitalbanana commented 6 years ago

I have added a tag-filter parameter to the plugin this will allow the same drone file to be used in a continuous delivery environment where only a single environment (integration in our case) will be published to. Any builds with a tag that does not match the filter will be skipped but not cause the build to fail. Realise this may require tweaking etc but we're using this functionality already so feel its useful.

josmo commented 6 years ago

Thanks for the PR @digitalbanana! I did have a quick question on the use case. Is there a reason that conditions from drone won't work to select which image to deploy? ie.

  deploy:
    image: peloton/drone-rancher
    url: http://serverurl
    secrets: [ rancher_access_key, rancher_secret_key ]
    service: ${DRONE_REPO}
    docker_image: ${DRONE_REPO}:${DRONE_BUILD_NUMBER}
    when:
      branch: whatever realease you're needing
      event: push
digitalbanana commented 6 years ago

Hey @josmo, yes principally because we're using logic other than the branch info to workout the tag for the image to be published. So for continuous delivery environments we look at various conditions (branch, commit message etc) to determine the tag of the image to publish to docker and also then whether or not to automatically deploy it. In the same way as the docker plugin works, I altered this fork to look at the contents of the local .tags file to determine if this plugin should upgrade Rancher or not.

Basically built in drone conditions dont offer the flexibility needed to implement this kind of logic

digitalbanana commented 6 years ago

will update the PR shortly and confirm

josmo commented 6 years ago

@digitalbanana Just wanted to let you know that I merged a PR that moved the the V2 apis. So once you get the deps in for the build we'll probably want to pull that in too :)