Specific pipeline for cron job?


#1

I have a project where build instructions are slightly different for a cron job vs other events like push, tag, etc.

Is it possible to identify that a build is triggered by a cron job? Maybe via an environment variable? Via a trigger? By specifying a different .drone.yml file?

Thanks!


#2

This is something we are working on enabling. We made the necessary changes to the yaml to support the below syntax, however, we now need to make a database change to store the name of the cron that triggers the build so that we can hook it up to the evaluation logic. So unfortunately not ready yet, but should be possible in the future.

when:
  cron: [ <name> ]
trigger:
  cron: [ <name> ]

#3

Great, thanks for the info :+1:


#4

FYI issue here to subscribe to https://github.com/drone/drone/issues/2628


#5

Subscribed, thanks.

I think that allowing to specify the drone.yml file to execute for a cron job would be useful. In my case, my definition file contains a couple of pipelines that don’t need to run during a cron job. So defining the pipeline for the cron job in a separate file would be cleaner/easier than explicitly indicating, for every pipelines, to not run during a cron job.