Open b-dalton opened 2 years ago
Hi @b-dalton you can follow these docs:
Sharing the relevant release notes and API documentation:
Feel free to reach out if you need any help.
Hi @ShruthiHubb , thanks for your response. The issue is not that I'm not able to set a cron job for a branch (I am able to do this with no issues) but that I'm not able to trigger a pipeline by a cron job OR a push to a branch (e.g. trigger pipeline at 5am daily or when there is a push to master branch). As stated in my original post and screenshot which highlight the documentation, both events must be true and therefore it isn't possible as the cron job event is only true at its scheduled time and therefore the pipeline is not triggered on a push to the branch either.
@b-dalton got it! let me get back to you with some solution.
@b-dalton can you share the .drone.yml file?
Hi @ShruthiHubb , here's one of the pipelines we tried to trigger on a specific cron job as well as a push to master. We had to resort to duplicating the pipelines to separate them so this one is only the push event since it's not possible to have both
kind: pipeline
name: Publish ECR images - master
type: docker
trigger:
branch:
- master
event:
- push
common_publish_config: &common_publish_config
registry: REDACTED
region: eu-west-2
tags:
- latest
- ${DRONE_COMMIT_SHA}
- link-${DRONE_BUILD_NUMBER}
- ci-${DRONE_BUILD_NUMBER}
steps:
This one below is a duplicate of the above pipeline but with the cron event trigger with the specific cron job. We specify the cron job defined in drone ("nightly-master-build")
kind: pipeline
name: Publish ECR images - Nightly master build
type: docker
trigger:
branch:
- master
event:
- cron
cron:
- nightly-master-build
common_publish_config: &common_publish_config
registry: REDACTED
region: eu-west-2
tags:
- ${DRONE_COMMIT_SHA}
- nightly-${DRONE_BUILD_NUMBER}
steps:
@b-dalton hey thanks for sharing. Let me check and get back to you.
@ShruthiHubb It would be amazing if we were able to write expressions to be evaluated for the trigger. We would be able to remove a large amount of duplicated pipeline code if that were possible.
I have noticed a limitation with Drone in that in order to trigger by multiple events, all events must be true and therefore it is not possible to trigger by a specific cron event in Drone or a push to master/main for example. (Triggers | Drone)
It is possible to trigger by cron or push to a branch by using
include
, however this will trigger on every cron schedule defined in Drone and it isn't possible to specify a specific cron schedule for the event.Would be great if this functionality could be added in the near future. (I've searched multiple forums to check if I was approaching it wrong or this functionality existed but had no luck. If I've missed something and this is possible to do with Drone, please let me know. Thanks)