Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E-mail plugin reports build as succesfull even though other pipelines failed #2553

Closed
jhasse opened this issue Dec 12, 2018 · 18 comments
Closed

Comments

@jhasse
Copy link
Contributor

jhasse commented Dec 12, 2018

After updating to 1.0 I've converted a matrix build to a multi-machine with a notify step which depends on the previous pipelines, similar to what is suggested here: https://docs.drone.io/user-guide/pipeline/multi-machine/

Instead of Slack, I'm using the e-mail plugin though:

---
kind: pipeline
name: notify

clone:
  disable: true

steps:
- name: notify
  image: drillster/drone-email
  settings:
    # ...

depends_on:
- pipeline_a
- pipeline_b

trigger:
  status:
  - failure

Even though all pipeline_a and pipeline_b failed, I'm getting an email with the message "Successful build #xy". I guess this is because the plugin gets the status of its own machine / pipeline, not the status of the whole build?

@bradrydzewski
Copy link
Contributor

the status is local to each pipeline

@jhasse
Copy link
Contributor Author

jhasse commented Jan 4, 2019

Any idea how the email (or any notification) plugin can be used to inform about the job status?

bradrydzewski added a commit that referenced this issue Mar 14, 2019
@bradrydzewski
Copy link
Contributor

Fixed by 4e49325

The behavior is that the DRONE_BUILD_STATUS will report the global status of all pipeline steps and the new DRONE_STAGE_STATUS will report the status of the currently executing pipeline. There should be no changes required to any of the plugins.

Note that long term we will probably rename DRONE_STAGE_ variables to DRONE_PIPELINE_ so that we have consistent naming, but that is out of scope for this issue :)

@jhasse
Copy link
Contributor Author

jhasse commented Mar 15, 2019

Awesome! Thank you :)

I guess this will be part of rc.7, right?

@bradrydzewski
Copy link
Contributor

the fix is available in :latest and will be available in 1.0.0-final

@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

I've tested it now with 1.0.0 and unfortunately the notify pipeline gets skipped now, even if one of the other pipelines failed. https://docs.drone.io/user-guide/pipeline/multi-machine/ mentions that depends_on: mentions "The pipeline does not execute until the dependent pipelines successfully complete.". Maybe that's why?

@bradrydzewski
Copy link
Contributor

@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

Thanks, I will try to narrow down what exactly is going wrong at my end.

Is there a way to see the reason, a pipeline is skipped?

@ghost
Copy link

ghost commented Mar 20, 2019

Thanks, I will try to narrow down what exactly is going wrong at my end.

Is there a way to see the reason, a pipeline is skipped?

you're likely missing

trigger:
  status: [success, failure]

in your notification pipeline

@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

I've found the issue: The notify step get's skipped if pipeline_b finishes before pipeline_a (you'll need multiple agents for that to happen). Here's a .drone.yml to reproduce the problem:

---
kind: pipeline
name: pipeline_a

steps:
- name: build
  image: alpine
  commands:
  - sleep 10
  - exit 1

---
kind: pipeline
name: pipeline_b

steps:
- name: build
  image: alpine
  commands:
  - exit 0

---
kind: pipeline
name: notify

steps:
- name: notify
  image: alpine
  commands:
  - exit 0

depends_on:
- pipeline_a
- pipeline_b

trigger:
  status:
  - failure
...

@bradrydzewski
Copy link
Contributor

bradrydzewski commented Mar 20, 2019

I've found the issue: The notify step get's skipped if pipeline_b finishes before pipeline_a

this is a problem with your yaml. You have pipeline_b referencing itself in depends_on which is not really valid. Also, the trigger is evaluated when the pipeline starts and is based on the state of the build at that time. So I believe Drone is behaving exactly as expected.

@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

You have pipeline_b referencing itself in depends_on which is not really valid.

What do you mean by "referencing itself"? If I'm not mistaken the notify pipeline references pipeline_b.

@bradrydzewski
Copy link
Contributor

bradrydzewski commented Mar 20, 2019

see this valid example https://github.com/drone/hello-world/blob/e3b839278437dbe049498686df77a883aaea1357/.drone.yml

What do you mean by "referencing itself"

a pipeline should not depend on itself

depends_on:
  - pipeline_a
- - pipeline_b

trigger:
  status:
    - failure

@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

But it's notify that depends on pipeline_b???

(there are three pipelines in my example)

@bradrydzewski
Copy link
Contributor

you are right, sorry, I misread

either way, I cannot reproduce or perhaps I am misunderstanding. I am running live tests and drone is working as expected for me https://cloud.drone.io/drone/hello-world/38

I do not really have the energy to argue this, so please send a pull request if you can reproduce.

jhasse added a commit to jhasse/drone-issue-2553 that referenced this issue Mar 20, 2019
jhasse added a commit to jhasse/hello-world that referenced this issue Mar 20, 2019
jhasse added a commit to jhasse/hello-world that referenced this issue Mar 20, 2019
@jhasse
Copy link
Contributor Author

jhasse commented Mar 20, 2019

It seems that it only happens without status: - success on the salutation pipeline. (Note that the salutation pipeline will switch from "waiting" to "skipped" before greeting has finished.)

I've updated your example and it reproduces on cloud.drone.io: https://cloud.drone.io/drone/hello-world/39/3/1

@bradrydzewski
Copy link
Contributor

ok thanks for the example. This is a separate issue than what was previously reported, so I will create a new issue to track.

@jhasse
Copy link
Contributor Author

jhasse commented Mar 22, 2019

Thanks! I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants