Full list of "When" conditions

Hello,

Is there a complete list of “When” conditions documented anywhere? (or a link to the code, I had a look but couldn’t find it).

By this, I mean, what options you can put in the “when” conditions on each step i.e event, branch, ref, status etc

Many thanks!

1 Like

Hi @microadam, here is the documentation for step conditions: http://docs.drone.io/step-conditions/

There are also pipeline conditions (apply to all steps): http://docs.drone.io/pipeline-conditions/

Please take a look and send a PR if you feel like something is missing.

Hi @tonglil. Yes, I am aware of those pages. However that literally only mentions branch and event. I am aware of others (only through seeing people mention things in discourse) such as ref and status, but I was hoping to find out a FULL list (unless those are literally the only 4 things available?). Happy to look through code for the list if needs be, but I am not a GO developer so wasn’t sure where I should be looking. If you could point me in the right direction, that would be great

Here are the constraints and some tests for them:


As far as I can tell, the documentation contains info for

There is no documentation for refs as mentioned in “Execute a build step only when a feature branch is tagged with a specific pattern?”.

Feel free to send a PR to the docs about that one!

Have the docs recently been updated? As I swear all that information wasn’t there last time I looked! Apologies for the oversight… I must be going mad.

Many thanks for all the links. Good to know that is the full list.

You might have been viewing a cached version of the docs.
CTRL+SHIFT+R :slight_smile:

In drone 1.0.0, the URL changed for the “when” conditions.
They now live here: https://docs.drone.io/user-guide/pipeline/conditions/

they are here now https://docs.drone.io/pipeline/conditions/

1 Like
// helper function pretty prints the conditions mapping.
func printConditions(w writer, name string, v yaml.Conditions) {
	w.WriteTag(name)
	w.IndentIncrease()
	if !isConditionEmpty(v.Action) {
		printCondition(w, "action", v.Action)
	}
	if !isConditionEmpty(v.Branch) {
		printCondition(w, "branch", v.Branch)
	}
	if !isConditionEmpty(v.Cron) {
		printCondition(w, "cron", v.Cron)
	}
	if !isConditionEmpty(v.Event) {
		printCondition(w, "event", v.Event)
	}
	if !isConditionEmpty(v.Instance) {
		printCondition(w, "instance", v.Instance)
	}
	if !isConditionEmpty(v.Paths) {
		printCondition(w, "paths", v.Paths)
	}
	if !isConditionEmpty(v.Ref) {
		printCondition(w, "ref", v.Ref)
	}
	if !isConditionEmpty(v.Repo) {
		printCondition(w, "repo", v.Repo)
	}
	if !isConditionEmpty(v.Status) {
		printCondition(w, "status", v.Status)
	}
	if !isConditionEmpty(v.Target) {
		printCondition(w, "target", v.Target)
	}
	w.IndentDecrease()
}