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

Jenkins pipeline - sh - git push fails randomly - ERROR: script returned exit code 128

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      Jenkins Operator
      Jenkins 2.249.1
    • Similar Issues:

      Description

      FAILURE 
       
      [master cc6be50] New customer test60
      1 file changed, 32 insertions
      create mode 100644 deployment/test60.yaml
      + git push origin

      [Pipeline] }

      [Pipeline] // stage[Pipeline] }

      [Pipeline] // withEnv[Pipeline] }

      [Pipeline] // withCredentials[Pipeline] }

      [Pipeline] // node[Pipeline] }

      [Pipeline] // podTemplate

      [Pipeline] End of Pipeline

      ERROR: script returned exit code 128
      Finished: FAILURE
      SAME CODE SUCCESSFUL RUN:

      + git commit -m New customer test49
      [master 9c0b093] New customer test49
      1 file changed, 32 insertions
      create mode 100644 deployment/helm/workflow/test49.yaml
      + git push origin
      To https://github.com/****/xxxxxxxxx.git 770e517..9c0b093 master -> master

       

      PLEASE HELP THIS HAS BEEN GOING ON FOR SOMETIME NOW, I AM NOT ABLE TO FIGURE OUT WHAT IS THE ISSUE.

      1. I am storing credentials from Jenkins to checkout code.
      2. Using sh ''' multi commands 
           '''
      3. This used to work in  older version of Jenkins and git version 2.20.2
      Recently jenkins operator got restarted and pulled recent version of Jenkins 2.249.1 & git version 2.11.0

      4. I am mostly seeing the issue with "git push" or in "git" related cmds

      FAILURE ON "git ls-remote". 

      + git ls-remote --heads origin test47
      [Pipeline] }[Pipeline] // stage

      [Pipeline] }

      [Pipeline] // withEnv[Pipeline] }

      [Pipeline] // withCredentials[Pipeline] }

      [Pipeline] // node[Pipeline] }

      [Pipeline] // podTemplate

      [Pipeline] End of Pipeline

      ERROR: script returned exit code 128
      Finished: FAILURE
      My earlier working code was based on create new branch and pushing to repo which has random failures so changed the logic to directly push to master.

      PLEASE HELP.
      THANK YOU

        Attachments

          Activity

          Hide
          prabhukasisekar Prabhu Kasisekar added a comment - - edited

          Another failure while deleting the remote branch

          Branch name test58 already exists, deleting it
          + git push -d origin test58
          [Pipeline] }[Pipeline] // stage[Pipeline] }
          [Pipeline] // withEnv[Pipeline] }
          [Pipeline] // withCredentials[Pipeline] }
          [Pipeline] // withEnv[Pipeline] }
          [Pipeline] // node[Pipeline] }
          [Pipeline] // podTemplate[Pipeline]
          End of Pipeline
          ERROR: script returned exit code 128
          Finished: FAILURE

          Show
          prabhukasisekar Prabhu Kasisekar added a comment - - edited Another failure while deleting the remote branch Branch name test58 already exists, deleting it + git push -d origin test58 [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // podTemplate [Pipeline] End of Pipeline ERROR: script returned exit code 128 Finished: FAILURE
          Hide
          prabhukasisekar Prabhu Kasisekar added a comment -

          CMD FAILED

          + git ls-remote --heads origin test81
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // withEnv
          [Pipeline] }
          [Pipeline] // withCredentials
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] }
          [Pipeline] // podTemplate
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 128
          Finished: FAILURE

          SAME CMD SUCCESS
          wc=$(git ls-remote --heads origin $BR |wc |awk '{print$1}')
          + git ls-remote --heads origin test81
          75dfaff2153dec5730066e716c37ad67a46d733a refs/heads/test81
          + git ls-remote --heads origin test81
          + wc + awk {print$1}
          + wc=1
          + echo Value of wc is $wc Value of wc is $wc
          + [ 1 -ne 0 ]
          + echo Branch name test81 already exists, deleting it Branch name test81 already exists, deleting it
          + git config push.default simple
          + git push -d origin test81
          To https://github.com/****/svc_workflowexecutor.git

          • [deleted] test81

           

          RANDOM FAILURES.

          Show
          prabhukasisekar Prabhu Kasisekar added a comment - CMD FAILED + git ls-remote --heads origin test81 [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // podTemplate [Pipeline] End of Pipeline ERROR: script returned exit code 128 Finished: FAILURE SAME CMD SUCCESS wc=$(git ls-remote --heads origin $BR |wc |awk '{print$1}') + git ls-remote --heads origin test81 75dfaff2153dec5730066e716c37ad67a46d733a refs/heads/test81 + git ls-remote --heads origin test81 + wc + awk {print$1} + wc=1 + echo Value of wc is $wc Value of wc is $wc + [ 1 -ne 0 ] + echo Branch name test81 already exists, deleting it Branch name test81 already exists, deleting it + git config push.default simple + git push -d origin test81 To https://github.com/****/svc_workflowexecutor.git [deleted] test81   RANDOM FAILURES.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            prabhukasisekar Prabhu Kasisekar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: