Can we set up a cron to promote builds?

Hello everyone! My first post here :slight_smile:

I understand it might not be a good practice, but we would need to schedule a cron job to run promotions on the last successful build.

The idea is to promote to QA nightly the last tag that was successful. Is there a way to do that? I see that in cron jobs I have the ability to select branch, but I do not see how to select the last tag or last successful run to promote.

Thanks for any guidance!

Cheers,

Hi Carim, we do not currently support this capability but we would be happy to accept a pull request. We can otherwise consider this feature for our roadmap, although we do have a bit of a backlog right now so I cannot provide any estimates as to when this could be delivered.

cc @TP_Honey

Hi Brad!

thanks for your quick response! I figured that, so I think I could work with your drone-go API cli and script something up myself. Reading into it now.

Thanks again :slight_smile:

Following up on this in case anyone is interested. What I ended up doing is using the drone-downstream plugin.

I created a downstream pipeline pointing to the same repository, using last successful run promoting to QA. This downstream pipeline is triggered by the cronb

---
kind: pipeline
steps:
... (any steps)

trigger:
  event:
    - promote
  target:
    - qa


---
kind: pipeline
name: cron promote

steps:
- name: nightly build
  image: plugins/downstream
  settings:
    server: https://myserver.com
    token:
      from_secret: drone_token
    deploy: qa
    last_successful: true
    repositories:
      - this_same_repository

trigger:
  event:
    - cron
  cron:
    - nightly
1 Like