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

Job continues to run on password expiration exception #270

Open
Constantin07 opened this issue May 12, 2021 · 2 comments
Open

Job continues to run on password expiration exception #270

Constantin07 opened this issue May 12, 2021 · 2 comments
Labels

Comments

@Constantin07
Copy link

Version report

Jenkins and plugins versions report:

Jenkins 2.277.1
stashNotifier 1.20
  • What Operating System are you using (both controller, and any agents involved in the problem)?
Linux Alpine 3.12.0

Reproduction steps

  • Have the password expired for credentials used to authenticate to Bitbucket Server
  • Send a notification in pipeline:
pipeline {
...
  stages {
    stage('Test') {
      ...
      mlaNotifyBitbucket 'SUCCESSFUL'
    }
  }
...
}

Results

Expected result:

The job should fail if cannot successfully send notification to Bitbucket Server

Actual result:

It continues to run with next stage as there no error happened at all:

[Pipeline] notifyBitbucket
Notifying Bitbucket at "https://some-bitbucket-server-here"
Failed to notify Bitbucket for commit b3e025790f8e28cc87334dfb341c1f085c1da6f6 ({"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":"com.atlassian.bitbucket.auth.ExpiredPasswordAuthenticationException"}]})
[Pipeline] }
[Pipeline] // stage
...
@Constantin07 Constantin07 added the bug Something isn't working label May 12, 2021
@scaytrase
Copy link
Member

Build notification is not a mandatory step in my mind to abort the whole build when notification fails. If you want to catch errors from notifiers - I hope you can wrap it into try..catch clause and do an error step there.

@scaytrase scaytrase removed the bug Something isn't working label May 12, 2021
@Constantin07
Copy link
Author

@scaytrase wrapping in try catch doesn't work. It just continues to run the pipeline.

    try {
        notifyBitbucket(
            stashServerBaseUrl: 'https://*******',
            ....
        )
    } catch (Exception e) {
        echo 'Exception occured: ' + e.toString()
        error("Bitbucket notification failed.")
    }
[Pipeline] notifyBitbucket
Notifying Bitbucket at "https://******"
Failed to notify Bitbucket for commit 0255fe7ba98c0e3103c89341b626d7a64e6b941 ({"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":"com.atlassian.bitbucket.auth.IncorrectPasswordAuthenticationException"}]})
[Pipeline] }
[Pipeline] // stage

I'm using it in multibranch pipeline to notify Bitbucket that Build was successful (or not) so the it can be merged only when someone had reviewed PR and the build was OK.

It does make sense to know somehow when notification to Bitbucket fails or doesn't work (I can use Slack notifications for this if pipeline fails) but at the moment I don't know how this can be done if it just continues even with error.

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

No branches or pull requests

2 participants