Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42997

Rerun button shows on UI even when the run cannot be rerun - enhance to have a replayable property

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • blueocean-plugin
    • Blue Ocean - 1.1-beta-1, Blue Ocean - 1.1-beta2

      In Scope

      • Add a replayable property that checks if the run can be replayed
        • This propagates the ReplayAction's has a isEnabled state to the UI
        • It turns out the behavior we saw in JENKINS-37880 is legitimate and isEnabled takes that case into account - we can kill two birds with one stone here!
      • Update the replay component so that instead of checking for a Pipeline capability to hide/show the button, we use replayable on the run model

      Problem
      If a build does not have the "replay" functionality available in the old UI, the "re-run" button in blue ocean still shows up, but does nothing and gives no obvious error to the user when clicked. This often happens when the initial checkout fails, or if the build is cancelled before the checkout finishes.

      UI errors are as follows:

      POST https://<redacted>/blue/rest/organizations/jenkins/pipelines/ops/pipelines/puppet-modules/branches/master/runs/728/replay/ 500 (Server Error)
       (anonymous) @ VM1470:1
       request @ blueocean.js:2436
       dedupe @ blueocean.js:7715
       dedupe @ blueocean.js:7738
       rawFetchJSON @ blueocean.js:2448
       fetchJSON @ blueocean.js:2516
       replayRun @ blueocean.js:4903
       _onReplayClick @ blueocean.js:1568
       onClick @ blueocean.js:1612
       invokeGuardedCallback @ blueocean.js:87861
       executeDispatch @ blueocean.js:79985
       executeDispatchesInOrder @ blueocean.js:80005
       executeDispatchesAndRelease @ blueocean.js:79462
       executeDispatchesAndReleaseTopLevel @ blueocean.js:79473
       forEachAccumulated @ blueocean.js:94130
       processEventQueue @ blueocean.js:79649
       runEventQueueInBatch @ blueocean.js:87919
       handleTopLevel @ blueocean.js:87930
       handleTopLevelImpl @ blueocean.js:87997
       perform @ blueocean.js:93514
       batchedUpdates @ blueocean.js:87197
       batchedUpdates @ blueocean.js:91413
       dispatchEvent @ blueocean.js:88074
      
      blueocean.js:2313 Uncaught (in promise) Error: Server Error
       at checkStatus (blueocean.js:2313)
       checkStatus @ blueocean.js:2313
      

      Response: 

      {
       "message" : "Run was not added to queue.",
       "code" : 500,
       "errors" : [ ]
       }
      

       

      How to reproduce: Check out a large enough repository that it can't finish checking out the build before you can cancel (a few hundred MBs seems to be enough for me). Trigger a build, then cancel it as fast as you can. It should be marked as a failure, not as aborted. If you've done this properly, when you go to the build in the old UI, it won't display the "Replay" button on the left. Next, go to Blue Ocean and hit "re-run". It also fails if you try to re-run from a favorite card, but the "build" button will work from a favorite card.

       

      Easy Solutions?: Maybe the fallback behaviour should be it switches to the "build" button if replay is unavailable, since that does still work from the favorite cards if this happens? At the very least some sort of notification of failure should be presented to the user.

          [JENKINS-42997] Rerun button shows on UI even when the run cannot be rerun - enhance to have a replayable property

          Spencer Malone added a comment - - edited

          Ah, thanks for the cleanup on that description, jamesdumay

          Spencer Malone added a comment - - edited Ah, thanks for the cleanup on that description, jamesdumay

          James Dumay added a comment -

          spencermalone no worries - JIRA markup takes a bit to get used to

          James Dumay added a comment - spencermalone no worries - JIRA markup takes a bit to get used to

          marc young added a comment -

          I just ran into this and it's not intuitive as to why it's not rerunnable.

          I'd like to know why i can/cannot re-run it, instead "nothing happens" with a 500 happening in the background

          marc young added a comment - I just ran into this and it's not intuitive as to why it's not rerunnable. I'd like to know why i can/cannot re-run it, instead "nothing happens" with a 500 happening in the background

          James Dumay added a comment -

          myoung34 sometimes we can get into a state where there is a failure at the start of the pipeline during or before checkout that means we don't get any state for the pipeline run persisted to storage. The rerun only works when we've stored a record of it in storage. I agree that this isn't 100% intuitive and its on our list of issues to fix soon.

          James Dumay added a comment - myoung34 sometimes we can get into a state where there is a failure at the start of the pipeline during or before checkout that means we don't get any state for the pipeline run persisted to storage. The rerun only works when we've stored a record of it in storage. I agree that this isn't 100% intuitive and its on our list of issues to fix soon.

          James Dumay added a comment -

          Will be included in Blue Ocean 1.1

          James Dumay added a comment - Will be included in Blue Ocean 1.1

          Caleb Mayeux added a comment -

          For what it's worth, I hit this issue in Blue Ocean 1.9 and Jenkins 1.138.4 after git checkouts at the start of a pipeline build failed (the remote was having issues at the time of the checkout). The checkout timed out and failed, and subsequent attempts to retry hit the same issue as this bug, albeit on much newer versions of the plugin/Jenkins.

          Caleb Mayeux added a comment - For what it's worth, I hit this issue in Blue Ocean 1.9 and Jenkins 1.138.4 after git checkouts at the start of a pipeline build failed (the remote was having issues at the time of the checkout). The checkout timed out and failed, and subsequent attempts to retry hit the same issue as this bug, albeit on much newer versions of the plugin/Jenkins.

          Ian Katz added a comment -

          I'm seeing this behavior in Blue Ocean 1.19.  Should I file a new ticket?

          It looks like this meets the criteria in the description – it failed during the initial checkout, with this exception:

          Pull request #2922 updated
          Connecting to https://api.github.com using will/****** (GitHub Access Token)
          
          Could not update commit status. Message: Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/repos/<REDACTED>
          
          java.net.SocketTimeoutException: Read timed out
          	at java.net.SocketInputStream.socketRead0(Native Method)
          	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
          	at java.net.SocketInputStream.read(SocketInputStream.java:171)
          	at java.net.SocketInputStream.read(SocketInputStream.java:141)
          	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
          	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
          	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
          	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:933)
          	at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
          	at okio.Okio$2.read(Okio.java:139)
          	at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
          Caused: java.net.SocketTimeoutException: timeout
          	at okio.Okio$3.newTimeoutException(Okio.java:207)
          	at okio.AsyncTimeout.exit(AsyncTimeout.java:261)
          	at okio.AsyncTimeout$2.read(AsyncTimeout.java:215)
          	at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
          	at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
          	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
          	at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
          	at com.squareup.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
          	at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
          	at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:609)
          	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:460)
          	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:399)
          	at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:527)
          	at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
          	at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
          	at org.kohsuke.github.Requester.parse(Requester.java:615)
          Caused: org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/repos/<REDACTED>
          	at org.kohsuke.github.Requester.parse(Requester.java:646)
          	at org.kohsuke.github.Requester.parse(Requester.java:644)
          	at org.kohsuke.github.Requester.parse(Requester.java:644)
          	at org.kohsuke.github.Requester.parse(Requester.java:607)
          	at org.kohsuke.github.Requester._to(Requester.java:285)
          	at org.kohsuke.github.Requester.to(Requester.java:247)
          	at org.kohsuke.github.GHPerson.getRepository(GHPerson.java:140)
          	at org.jenkinsci.plugins.github_branch_source.GitHubSCMFileSystem$BuilderImpl.build(GitHubSCMFileSystem.java:268)
          	at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:294)
          	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100)
          	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
          	at hudson.model.ResourceController.execute(ResourceController.java:97)
          	at hudson.model.Executor.run(Executor.java:429)
          Finished: FAILURE
          

          Ian Katz added a comment - I'm seeing this behavior in Blue Ocean 1.19.  Should I file a new ticket? It looks like this meets the criteria in the description – it failed during the initial checkout, with this exception: Pull request #2922 updated Connecting to https: //api.github.com using will/****** (GitHub Access Token) Could not update commit status. Message: Server returned HTTP response code: -1, message: ' null ' for URL: https: //api.github.com/repos/<REDACTED> java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:933) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at okio.Okio$2.read(Okio.java:139) at okio.AsyncTimeout$2.read(AsyncTimeout.java:211) Caused: java.net.SocketTimeoutException: timeout at okio.Okio$3.newTimeoutException(Okio.java:207) at okio.AsyncTimeout.exit(AsyncTimeout.java:261) at okio.AsyncTimeout$2.read(AsyncTimeout.java:215) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300) at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196) at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186) at com.squareup.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127) at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737) at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:609) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:460) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:399) at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:527) at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25) at org.kohsuke.github.Requester.parse(Requester.java:615) Caused: org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: ' null ' for URL: https: //api.github.com/repos/<REDACTED> at org.kohsuke.github.Requester.parse(Requester.java:646) at org.kohsuke.github.Requester.parse(Requester.java:644) at org.kohsuke.github.Requester.parse(Requester.java:644) at org.kohsuke.github.Requester.parse(Requester.java:607) at org.kohsuke.github.Requester._to(Requester.java:285) at org.kohsuke.github.Requester.to(Requester.java:247) at org.kohsuke.github.GHPerson.getRepository(GHPerson.java:140) at org.jenkinsci.plugins.github_branch_source.GitHubSCMFileSystem$BuilderImpl.build(GitHubSCMFileSystem.java:268) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:294) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:100) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE

            jamesdumay James Dumay
            spencermalone Spencer Malone
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: