We started to use Drone last week at my company and we’ve successfully configured a drone pipeline to run our test suite on every push.
We have a separate test suite (smoke tests that run against the deployed app) that we would like to run independently of our main test suite. Specifically, we’d like to schedule it to run periodically. I’ve read that the way to go to achieve that is to use the CLI and a cron job. The thing is that this is a different pipeline than the one that runs on every repo push.
I’m not sure how to solve this, is there a way to specify an alternative .drone.yml in the repo, or maybe parametrize our current pipeline in a way that some steps are run on push and others are run from the cli? (I’ve read the CLI and Conditions docs, but I’m still not sure if there’s a way to combine them to pull this off).
I had exactly the same requirement today.
I thought about something like
pipeline but e.g. called
- go get
- go build
- go test
And then the steps under
tasks could only be triggered with
drone task start <repository> <task_name>
In the example above the
<task_name> would be
A task runner like that directly integrated in drone (with the power of all the available plugins) would be awesome in my opinion!
Or is there already a way to run custom tasks?
custom pipeline executions are planned for a future release, but will not be available in the short term.
Thanks for your fast response!
Nice to hear that this feature is planned for a future release.
Till then, I’ll have to do it manually.
@mamiu You can sort of hack around this using deployments:
drone deploy <repo> <build> <environment>
Technically deployments are just custom tasks. You can then have steps in your pipeline that only execute for a particular deployment environment. For example lets say we want to have a nightly task, we could do this:
- go build
- go test
- echo foo
- echo bar
Note that a deployment must always be tied to a build, however, you can probably just use the latest successful build for your default branch (eg master).
drone deploy <repo> last <environment>
@facundoolano this should support your use case as well. It certainly isn’t the most optimal approach, and I agree different yaml files would be better (this is also in the works). But hopefully this gives you something you can use today, in the short term.
Of course I’ll try it, but as you said, it’s not the most optimal approach.
I’m looking forward to a feature, that solves this use case.
Thanks, I’ll give it a try.
@bradrydzewski I’m trying as you suggested but I can’t seem to make it work. This is what my .drone.yml looks like:
- make test
# dont run default tests on smoke events
# to be used with cli: `drone deploy example/server last smoke --param "HOST=development.example.com"`
- make smoke
But it seems like the
when clause is ignored: it always runs the
test step and never runs the
I’m using drone 0.7.
Got it, the issue was that the condition should be
exclude but I was writing