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

how to use pipeline sh git add tag?

XMLWordPrintable

    • Icon: Patch Patch
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • None

      my jenkins in running k8s

      i want use pipeline script

      sh 'git tag'

       it can't work, error  code 127

      Here's my pipeline code

       

      podTemplate(label: 'docker-pod-git', containers: [
      containerTemplate(
      name: 'docker',
      image: 'docker:stable',
      ttyEnabled: true,
      command: 'cat'
      ),

      containerTemplate(
      name: 'jnlp',
      image: 'registry.cn-hangzhou.aliyuncs.com/google-containers/jnlp-slave:alpine',
      args: '${computer.jnlpmac} ${computer.name}',
      command: ''
      )],
      volumes: [
      /persistentVolumeClaim(mountPath: '/home/jenkins', claimName: 'jenkins', readOnly: false),/
      hostPathVolume(hostPath: '/root/work/jenkins', mountPath: '/home/jenkins'),
      hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'),
      hostPathVolume(hostPath: '/tmp/', mountPath: '/tmp/'),
      ])
      {
      node ('docker-pod-git') {
      container('docker')

      { git url: 'http://*****/git/saasvshop.git' , branch: 'release',credentialsId:'**' sh'git tag' }

      }
      }

       

      here is console log

       
      Fetching changes from the remote Git repository
      > git rev-parse --is-inside-work-tree # timeout=10
      > git config remote.origin.url ***# timeout=10
      Fetching upstream changes from *** > git --version # timeout=10
      using GIT_ASKPASS to set credentials
      > git fetch --tags --progress *** +refs/heads/:refs/remotes/origin/
      Checking out Revision b0381fb26733eaa594ee6f38beb50d94915b31cb (refs/remotes/origin/release)
      > git rev-parse refs/remotes/origin/release^{commit} # timeout=10
      > git rev-parse refs/remotes/origin/origin/release^{commit} # timeout=10
      > git config core.sparsecheckout # timeout=10
      > git checkout -f b0381fb26733eaa594ee6f38beb50d94915b31cb
      > git branch -a -v --no-abbrev # timeout=10
      > git branch -D release # timeout=10
      > git checkout -b release b0381fb26733eaa594ee6f38beb50d94915b31cb
      Commit message: "修改"
      > git rev-list --no-walk b0381fb26733eaa594ee6f38beb50d94915b31cb # timeout=10[Pipeline] sh[Pipeline] }[Pipeline] // container[Pipeline] }[Pipeline] // node[Pipeline] }[Pipeline] // podTemplate[Pipeline] End of PipelineERROR: script returned exit code 127
      Finished: FAILURE
       

            Unassigned Unassigned
            329247072 chongjing zhao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: