# Clone on "skipped" steps

**URL:** <https://drone.discourse.group/t/clone-on-skipped-steps/11198>\
**Category:** Drone Support\
**Created:** [February 10, 2019, 11:37pm UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198 "2019-02-10T23:37:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![s0undt3ch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/s0undt3ch/32/5654_2.png) [@s0undt3ch](https://drone.discourse.group/u/s0undt3ch)\
**Post date:** [February 10, 2019, 11:37pm UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/1 "2019-02-10T23:37:27Z")

</div>

At least on drone 1.0(latest RC), there are steps for which the default clone step is always executed, even if the step is not meant to be executed.

Lets say a drone config defines a pipeline for push events and another for pull\_request events.  
Both pipelines will execute the default clone step even though only one runs at a time.  
For big projects, one might grow as big as 50 pipelines(this is a rough low estimate for one of our projects).

Drone knows which piipelines are involved before starting to run them or, how would the UI know what to show?

So, why not go as far as inspecting if a pipeline is suppose to run for the current event?  
If its not supposed to run, don’t even clone.

And, as a feature request(suggestion), don’t even show steps on the UI which are not supposed to run.

Can you imagine going through 100+ pipelines, half of which are skipped and the other half runs?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [February 11, 2019, 1:00am UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/2 "2019-02-11T01:00:50Z")

</div>

> So, why not go as far as inspecting if a pipeline is suppose to run for the current event?  
> If its not supposed to run, don’t even clone.

hmm, I would probably need more details because this is how Drone works. You should be using the `trigger` section of the Pipeline to prevent the entire pipeline from being executed. The only exception is when you define `trigger.status` which is evaluated at runtime, and results in an entry in the database and user-interface.

Example configuration:

```plaintext
kind: pipeline
name: foo

steps: [...]

trigger:
  event: [push]

---
kind: pipeline
name: bar

steps: [...]

trigger:
  event: [pull_request]

```

Pipeline foo in the above example is executed for a push event, and Pipeline bar is ignored and no entry is created in the database (nor displayed in the user-interface) because we know up front that it can be skipped.

---

<div class="post-metadata">

**Author:** ![s0undt3ch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/s0undt3ch/32/5654_2.png) [@s0undt3ch](https://drone.discourse.group/u/s0undt3ch)\
**Post date:** [February 11, 2019, 10:24am UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/3 "2019-02-11T10:24:13Z")

</div>

We’re actually using `when`, here’s 2 example pipelines:

```auto
---
kind: pipeline
name: lint-arch-2019-01-09

platform:
  os: linux
  arch: amd64

steps:
- name: lint-arch-2019-01-09
  image: hashicorp/packer
  commands:
  - apk --no-cache add make
  - make validate OS=arch OS_REV=2019-01-09
  when:
    event:
    - pull_request

---
kind: pipeline
name: arch-2019-01-09-2017.7

platform:
  os: linux
  arch: amd64

steps:
- name: throttle build
  image: alpine
  commands:
  - "sh -c 't=$(shuf -i 20-120 -n 1); echo Sleeping $t seconds; sleep $t'"
  when:
    branch:
    - ci

- name: 2017.7
  image: hashicorp/packer
  commands:
  - apk --no-cache add make curl grep gawk sed
  - make build OS=arch OS_REV=2019-01-09 SALT_BRANCH=2017.7
  environment:
    AWS_ACCESS_KEY_ID:
      from_secret: username
    AWS_DEFAULT_REGION: us-west-2
    AWS_SECRET_ACCESS_KEY:
      from_secret: password
  when:
    branch:
    - ci

```

I’ll try using triggers instead.

---

<div class="post-metadata">

**Author:** ![s0undt3ch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/s0undt3ch/32/5654_2.png) [@s0undt3ch](https://drone.discourse.group/u/s0undt3ch)\
**Post date:** [February 11, 2019, 10:41am UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/4 "2019-02-11T10:41:18Z")

</div>

Yep, we were using it the wrong way.  
This topic should be marked as solved.

Thank You!

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [February 11, 2019, 6:10pm UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/5 "2019-02-11T18:10:44Z")

</div>

excellent, glad this was helpful. I would still ask that, if you have a build with 50+ pipelines that perhaps you provide a screenshot. We can show this to our UX designers so that future iterations of the UI can be optimized for such complex configurations.

---

<div class="post-metadata">

**Author:** ![s0undt3ch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/s0undt3ch/32/5654_2.png) [@s0undt3ch](https://drone.discourse.group/u/s0undt3ch)\
**Post date:** [February 11, 2019, 6:23pm UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/6 "2019-02-11T18:23:50Z")

</div>

![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/b/bec23c7ff0ab196daed6a524834f9b31bfb96221.png)  
and  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/8/81dd6027c3bd696def5139b89304c6f2b7ccee2e.png)

---

<div class="post-metadata">

**Author:** ![s0undt3ch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/s0undt3ch/32/5654_2.png) [@s0undt3ch](https://drone.discourse.group/u/s0undt3ch)\
**Post date:** [February 11, 2019, 6:27pm UTC](https://drone.discourse.group/t/clone-on-skipped-steps/11198/7 "2019-02-11T18:27:24Z")

</div>

It would be awesome if we could group some pipelines(just for UI’s sake, not to mix with serial vs parallel execution).
