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).
@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:
pipeline:
build:
image: golang
commands:
- go build
- go test
when:
event:
excludes: deployment
nightly:
image: golang
commands:
- echo foo
- echo bar
when:
environment: nightly
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.
@bradrydzewski I’m trying as you suggested but I can’t seem to make it work. This is what my .drone.yml looks like:
pipeline:
test:
image: erlang:20
network_mode: host
commands:
- make test
when:
# dont run default tests on smoke events
event:
excludes: deployment
# to be used with cli: `drone deploy example/server last smoke --param "HOST=development.example.com"`
smoke:
image: erlang:20
environment:
- PORT=443
commands:
- make smoke
when:
environment: smoke
But it seems like the when clause is ignored: it always runs the test step and never runs the smoke one.