[JIRA] (JENKINS-58312) Pipeline from SCM tag already exists

8 views
Skip to first unread message

tobias@tschech-online.de (JIRA)

unread,
Jul 3, 2019, 4:01:02 AM7/3/19
to jenkinsc...@googlegroups.com
Tobias Tschech created an issue
 
Jenkins / Bug JENKINS-58312
Pipeline from SCM tag already exists
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline
Created: 2019-07-03 08:00
Labels: pipeline
Priority: Major Major
Reporter: Tobias Tschech

Hi,

we discovered a bad behaviour when using a pipeline script which is getting loaded from an SCM.

 

Scenario:

We have this simple Jenkins pipeline which is saved in a git repo (lets say https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git)

 

 

@Library('jenkinssharedlib') _

pipeline {
    agent {
        node {
            label 'master'
            customWorkspace "/tmp/workspace/${env.JOB_NAME}/${env.BUILD_NUMBER}"
        }
    }

    stages{

        stage('Tagging Test') {

            steps {
                echo sh("git remote -v")
                echo sh("git show-ref")
                checkout([$class: 'GitSCM', branches: [[name: 'master' ]], userRemoteConfigs: [[credentialsId: 'hudstech-checkout-git', url: "https://bitbucket.myserver/repositories/MyProject.git"]]])
                echo sh("git remote -v")
                echo sh("git show-ref")
                sh("git tag -a -m \"Tag lib1.0.0\" lib1.0.0")
            }
        }
    }
}

 

As you see above we are also using a shared library which is also in the same Git Repo as this Pipeline. This Git Repository contains a Tag called lib1.0.0

 

In the Pipeline script we're trying to create a tag called lib1.0.0 in the checked out repository https://bitbucket.myserver/repositories/MyProject.git. Unfortunately it tells us the tag lib1.0.0 already exists because jenkins fetched the tag lib1.0.0 (and also all branches ...) from the Shared Library Repository.

 

Here is what the pipeline output looks like:

 

Obtained pipelines/testPipeline.groovy from git https://bitbucket.myserver/repositories/jenkinsSharedLibrary.gitObtained pipelines/testPipeline.groovy from git https://bitbucket.myserver/repositories/jenkinsSharedLibrary.gitRunning in Durability level: MAX_SURVIVABILITYLoading library jenkinssharedlib@masterAttempting to resolve master from remote references... > git --version # timeout=10using GIT_ASKPASS to set credentials Github user for RW operations > git ls-remote -h https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout=10Found match: refs/heads/master revision a4e28168cd1514b262a5de832090af5a14deea4ausing credential hudstech-checkout-git > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout=10Fetching without tagsFetching upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git > git --version # timeout=10using GIT_ASKPASS to set credentials Github user for RW operations > git fetch --no-tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/master:refs/remotes/origin/masterChecking out Revision a4e28168cd1514b262a5de832090af5a14deea4a (master) > git config core.sparsecheckout # timeout=10 > git checkout -f a4e28168cd1514b262a5de832090af5a14deea4aCommit message: "testPipeline" > git rev-list --no-walk a4e28168cd1514b262a5de832090af5a14deea4a # timeout=10[Pipeline] Start of Pipeline[Pipeline] nodeRunning on Jenkins in XXX/workspace[Pipeline] {[Pipeline] wsRunning in XXX/92[Pipeline] {[Pipeline] stage[Pipeline] { (Declarative: Checkout SCM)[Pipeline] checkoutusing credential hudstech-checkout-gitCloning the remote Git repositoryCloning repository https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git > git init XXX/92 # timeout=10Fetching upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git > git --version # timeout=10using GIT_ASKPASS to set credentials Github user for RW operations > git fetch --tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout=10Fetching upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary.gitusing GIT_ASKPASS to set credentials Github user for RW operations > git fetch --tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/master:refs/remotes/origin/master > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10Checking out Revision a4e28168cd1514b262a5de832090af5a14deea4a (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f a4e28168cd1514b262a5de832090af5a14deea4aCommit message: "testPipeline"[Pipeline] }[Pipeline] // stage[Pipeline] withEnv[Pipeline] {[Pipeline] stage[Pipeline] { (Tagging Test)[Pipeline] sh+ git remote -vorigin https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git (fetch)origin https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git (push)[Pipeline] echonull[Pipeline] sh+ git show-ref02f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7 refs/remotes/origin/GLSL-1679e0e87cf929d1cb05516a36bb5a7ddb534ec3320f refs/remotes/origin/GLSL-17014fcdfb24ff67a804a8896de4444a2847b0ef38e7 refs/remotes/origin/deployBranch0025f675e2212827a57cd500e74426475f59b906 refs/remotes/origin/dev871fe0bf05eb1ab069bc15c0d1805ac8cae41520 refs/remotes/origin/feature/GLSL-1390f2e5294499d73596e87c4fc17d9f9059a62e548d refs/remotes/origin/feature/refactoring221921b700ddfbfbfc132b38ac58cce4bad44e23 refs/remotes/origin/gitflowa4e28168cd1514b262a5de832090af5a14deea4a refs/remotes/origin/masterd47d9de8fc5df17d6668aa63d3a2053d823f92d9 refs/tags/lib1.0.0[Pipeline] echonull[Pipeline] checkoutusing credential hudstech-checkout-git > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://bitbucket.myserver/repositories/MyProject.git # timeout=10Fetching upstream changes from https://bitbucket.myserver/repositories/MyProject.git > git --version # timeout=10using GIT_ASKPASS to set credentials Github user for RW operations > git fetch --tags --progress https://bitbucket.myserver/repositories/MyProject.git +refs/heads/*:refs/remotes/origin/* > git rev-parse origin/master^{commit} # timeout=10Checking out Revision 3b236cdd354ebb0d637d138007cd676f7ba75e29 (origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 3b236cdd354ebb0d637d138007cd676f7ba75e29Commit message: "XXX" > git rev-list --no-walk 3b236cdd354ebb0d637d138007cd676f7ba75e29 # timeout=10[Pipeline] sh+ git remote -vorigin https://bitbucket.myserver/repositories/MyProject.git (fetch)origin https://bitbucket.myserver/repositories/MyProject.git (push)[Pipeline] echonull[Pipeline] sh+ git show-ref3047ce864ae0c40afc1445eab0b863cec362422d refs/remotes/origin/GLSL-123402f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7 refs/remotes/origin/GLSL-1679e0e87cf929d1cb05516a36bb5a7ddb534ec3320f refs/remotes/origin/GLSL-17014fcdfb24ff67a804a8896de4444a2847b0ef38e7 refs/remotes/origin/deployBranch6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871 refs/remotes/origin/dev871fe0bf05eb1ab069bc15c0d1805ac8cae41520 refs/remotes/origin/feature/GLSL-1390f2e5294499d73596e87c4fc17d9f9059a62e548d refs/remotes/origin/feature/refactoring221921b700ddfbfbfc132b38ac58cce4bad44e23 refs/remotes/origin/gitflow3b236cdd354ebb0d637d138007cd676f7ba75e29 refs/remotes/origin/master6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871 refs/remotes/origin/test6dc81e7df69d81d8bf86163d57b08ad88245e940 refs/remotes/origin/updateb2760cb9d6dad7f50c9238e3eec827f9284a5913 refs/tags/1.0.01f48bba77b244fb947ce3b80dc7158def9f42ccb refs/tags/1.0.0-SNAPSHOT507dc8d542e5dc4e13693a9a1718b867182ebdba refs/tags/1.0.2bd14a5b4bde5f3fc56a6642dad5356c82624113d refs/tags/1.1.0813a119062d7f0ae2cf467207f08c97625591042 refs/tags/1.1.1e8db0e1bc384f84deb358d99bcfc3c4d1692c947 refs/tags/1.2.0573a4173f1ec322ce339e0641a84386091eb2cd4 refs/tags/1.2.17a3d685bfdfcce8e20628e4dd5aa23b4360b792c refs/tags/1.2.1-132852d180c6f186d71b9f9e65e23e8562d8d3d8a refs/tags/1.2.1-2aab43aad4b38d68673cc26ba1756abdd2cd60070 refs/tags/1.2.1-35b69912a8471181c5a7776a33f82cf9f134ebb3b refs/tags/1.2.1-4f2b38551b2572bceb7456e23035d93f9eeecfc48 refs/tags/1.2.1-5b8bce4b1f84fece5558f3fd7c0b71c4a9d4ddc0c refs/tags/1.2.1-6f40bf5f34246d740ff1a3b79f67d72f6f9ff73ae refs/tags/1.2.1-7926a9f013085762c3d206ea90534f5362793d8cb refs/tags/1.2.1-8f1fb30f659e863d6f78720c0e4cf416b82206f11 refs/tags/1.2.1-94e24ba81219ef84721a5c4075d6b19cc46052d28 refs/tags/1.2.2372f57fecdd186ab4ec51453ddfe9183578e7879 refs/tags/1.3.0785a7d0f496d6930429bdd545bbfeedfce6d3543 refs/tags/1.4.0d47d9de8fc5df17d6668aa63d3a2053d823f92d9 refs/tags/lib1.0.0[Pipeline] echonull[Pipeline] script[Pipeline] {[Pipeline] withCredentialsMasking supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD[Pipeline] {[Pipeline] sh+ git tag -a -m 'Tag lib1.0.0' lib1.0.0fatal: tag 'lib1.0.0' already exists[Pipeline] }[Pipeline] // withCredentials[Pipeline] }[Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // withEnv[Pipeline] }[Pipeline] // ws[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: script returned exit code 128Finished: FAILURE

 

If we run the same Pipeline script by copy paste it into a Pipeline and not tell Jenkins to load it from an SCM it works perfectly. So it seems to be a problem with the Checkout from SCM in the Pipeline and maybe together with the fact that the Pipeline script is in the same git repository as the shared library?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

tobias@tschech-online.de (JIRA)

unread,
Jul 3, 2019, 4:03:03 AM7/3/19
to jenkinsc...@googlegroups.com
Tobias Tschech updated an issue
Change By: Tobias Tschech
Hi,

we discovered a bad behaviour when using a pipeline script which is getting loaded from an SCM.

 

Scenario:

We have this simple Jenkins pipeline which is saved in a git repo (lets say [https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git])

 

 
{code:java}

@Library('jenkinssharedlib') _

pipeline {
    agent {
        node {
            label 'master'
            customWorkspace "/tmp/workspace/${env.JOB_NAME}/${env.BUILD_NUMBER}"
        }
    }

    stages{

        stage('Tagging Test') {

            steps {
                echo sh("git remote -v")
                echo sh("git show-ref")
                checkout([$class: 'GitSCM', branches: [[name: 'master' ]], userRemoteConfigs: [[credentialsId: 'hudstech-checkout-git', url:

                echo sh("git remote -v")
                echo sh("git show-ref")
                sh("git tag -a -m \"Tag lib1.0.0\" lib1.0.0")
            }
        }
    }
}
{code}

 

As you see above we are also using a shared library which is also in the same Git Repo as this Pipeline. This Git Repository contains a Tag called lib1.0.0

 

In the Pipeline script we're trying to create a tag called lib1.0.0 in the checked out repository [https://bitbucket.myserver/repositories/MyProject.git.] Unfortunately it tells us the tag lib1.0.0 already exists because jenkins fetched the tag lib1.0.0 (and also all branches ...) from the Shared Library Repository.

 

Here is what the pipeline output looks like:

 
{code :java }
Obtained pipelines/testPipeline.groovy from git https://bitbucket.myserver/repositories/jenkinsSharedLibrary.
gitObtained pipelines/testPipeline.groovy from git https://bitbucket.myserver/repositories/jenkinsSharedLibrary.gitRunning
Running
in Durability level: MAX_SURVIVABILITYLoading MAX_SURVIVABILITY
Loading
library jenkinssharedlib@ masterAttempting master
Attempting
to resolve master from remote references...  
> git --version # timeout= 10using 10
using
GIT_ASKPASS to set credentials Github user for RW operations  
> git ls-remote -h https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout= 10Found 10
Found
match: refs/heads/master revision a4e28168cd1514b262a5de832090af5a14deea4ausing a4e28168cd1514b262a5de832090af5a14deea4a
using
credential hudstech-checkout-git  
> git rev-parse --is-inside-work-tree # timeout= 10Fetching 10
Fetching
changes from the remote Git repository  
> git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout= 10Fetching 10
Fetching
without tagsFetching tags
Fetching
upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git  
> git --version # timeout= 10using 10
using
GIT_ASKPASS to set credentials Github user for RW operations  
> git fetch --no-tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/master:refs/remotes/origin/ masterChecking master
Checking
out Revision a4e28168cd1514b262a5de832090af5a14deea4a (master)  
> git config core.sparsecheckout # timeout=10  
> git checkout -f a4e28168cd1514b262a5de832090af5a14deea4aCommit a4e28168cd1514b262a5de832090af5a14deea4a
Commit
message: "testPipeline"  
> git rev-list --no-walk a4e28168cd1514b262a5de832090af5a14deea4a # timeout=10
[Pipeline] Start of Pipeline
[Pipeline] nodeRunning node
Running
on Jenkins in XXX/workspace
[Pipeline] {
[Pipeline] wsRunning ws
Running
in XXX/92
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkoutusing checkout
using
credential hudstech-checkout- gitCloning git
Cloning
the remote Git repositoryCloning repository
Cloning repository
https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git  
> git init XXX/92 # timeout= 10Fetching 10
Fetching
upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git  
> git --version # timeout= 10using 10
using
GIT_ASKPASS to set credentials Github user for RW operations  
> git fetch --tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/*:refs/remotes/origin/*  
> git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout=10  
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10  
> git config remote.origin.url https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git # timeout= 10Fetching 10
Fetching
upstream changes from https://bitbucket.myserver/repositories/jenkinsSharedLibrary. gitusing git
using
GIT_ASKPASS to set credentials Github user for RW operations  
> git fetch --tags --progress https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git +refs/heads/master:refs/remotes/origin/master  
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10  
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout= 10Checking 10
Checking
out Revision a4e28168cd1514b262a5de832090af5a14deea4a (refs/remotes/origin/master)  
> git config core.sparsecheckout # timeout=10  
> git checkout -f a4e28168cd1514b262a5de832090af5a14deea4aCommit a4e28168cd1514b262a5de832090af5a14deea4a
Commit
message: "testPipeline"
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Tagging Test)
[Pipeline] sh
+ git remote - vorigin v
origin
https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git (fetch)
origin https://bitbucket.myserver/repositories/jenkinsSharedLibrary.git (push)
[Pipeline] echonull echo
null
[Pipeline] sh
+ git show- ref02f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7 ref
02f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7
refs/remotes/origin/GLSL- 1679e0e87cf929d1cb05516a36bb5a7ddb534ec3320f 1679
e0e87cf929d1cb05516a36bb5a7ddb534ec3320f
refs/remotes/origin/GLSL- 17014fcdfb24ff67a804a8896de4444a2847b0ef38e7 1701
4fcdfb24ff67a804a8896de4444a2847b0ef38e7
refs/remotes/origin/ deployBranch0025f675e2212827a57cd500e74426475f59b906 deployBranch
0025f675e2212827a57cd500e74426475f59b906
refs/remotes/origin/ dev871fe0bf05eb1ab069bc15c0d1805ac8cae41520 dev
871fe0bf05eb1ab069bc15c0d1805ac8cae41520
refs/remotes/origin/feature/GLSL- 1390f2e5294499d73596e87c4fc17d9f9059a62e548d 1390
f2e5294499d73596e87c4fc17d9f9059a62e548d
refs/remotes/origin/feature/ refactoring221921b700ddfbfbfc132b38ac58cce4bad44e23 refactoring
221921b700ddfbfbfc132b38ac58cce4bad44e23
refs/remotes/origin/ gitflowa4e28168cd1514b262a5de832090af5a14deea4a gitflow
a4e28168cd1514b262a5de832090af5a14deea4a
refs/remotes/origin/ masterd47d9de8fc5df17d6668aa63d3a2053d823f92d9 master
d47d9de8fc5df17d6668aa63d3a2053d823f92d9
refs/tags/lib1.0.0
[Pipeline] echonull echo
null
[Pipeline] checkoutusing checkout
using
credential hudstech-checkout-git  
> git rev-parse --is-inside-work-tree # timeout= 10Fetching 10
Fetching
changes from the remote Git repository  
> git config remote.origin.url https://bitbucket.myserver/repositories/MyProject.git # timeout= 10Fetching 10
Fetching
upstream changes from https://bitbucket.myserver/repositories/MyProject.git  
> git --version # timeout= 10using 10
using
GIT_ASKPASS to set credentials Github user for RW operations  
> git fetch --tags --progress https://bitbucket.myserver/repositories/MyProject.git +refs/heads/*:refs/remotes/origin/*  
> git rev-parse origin/master^{commit} # timeout= 10Checking 10
Checking
out Revision 3b236cdd354ebb0d637d138007cd676f7ba75e29 (origin/master)  
> git config core.sparsecheckout # timeout=10  
> git checkout -f 3b236cdd354ebb0d637d138007cd676f7ba75e29Commit 3b236cdd354ebb0d637d138007cd676f7ba75e29
Commit
message: "XXX"  
> git rev-list --no-walk 3b236cdd354ebb0d637d138007cd676f7ba75e29 # timeout=10
[Pipeline] sh
+ git remote - vorigin v
origin
https://bitbucket.myserver/repositories/MyProject.git (fetch)
origin https://bitbucket.myserver/repositories/MyProject.git (push)
[Pipeline] echonull echo
null
[Pipeline] sh
+ git show- ref3047ce864ae0c40afc1445eab0b863cec362422d ref
3047ce864ae0c40afc1445eab0b863cec362422d
refs/remotes/origin/GLSL- 123402f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7 1234
02f1b0773ae70b74ea73a5ffd1a8efbc5cb97aa7
refs/remotes/origin/GLSL- 1679e0e87cf929d1cb05516a36bb5a7ddb534ec3320f 1679
e0e87cf929d1cb05516a36bb5a7ddb534ec3320f
refs/remotes/origin/GLSL- 17014fcdfb24ff67a804a8896de4444a2847b0ef38e7 1701
4fcdfb24ff67a804a8896de4444a2847b0ef38e7
refs/remotes/origin/ deployBranch6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871 deployBranch
6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871
refs/remotes/origin/ dev871fe0bf05eb1ab069bc15c0d1805ac8cae41520 dev
871fe0bf05eb1ab069bc15c0d1805ac8cae41520
refs/remotes/origin/feature/GLSL- 1390f2e5294499d73596e87c4fc17d9f9059a62e548d 1390
f2e5294499d73596e87c4fc17d9f9059a62e548d
refs/remotes/origin/feature/ refactoring221921b700ddfbfbfc132b38ac58cce4bad44e23 refactoring
221921b700ddfbfbfc132b38ac58cce4bad44e23
refs/remotes/origin/ gitflow3b236cdd354ebb0d637d138007cd676f7ba75e29 gitflow
3b236cdd354ebb0d637d138007cd676f7ba75e29
refs/remotes/origin/ master6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871 master
6e5f04fc3cfa082a45fd6cf48dddc9c4899a5871
refs/remotes/origin/ test6dc81e7df69d81d8bf86163d57b08ad88245e940 test
6dc81e7df69d81d8bf86163d57b08ad88245e940
refs/remotes/origin/ updateb2760cb9d6dad7f50c9238e3eec827f9284a5913 update
b2760cb9d6dad7f50c9238e3eec827f9284a5913
refs/tags/1.0. 01f48bba77b244fb947ce3b80dc7158def9f42ccb 0
1f48bba77b244fb947ce3b80dc7158def9f42ccb
refs/tags/1.0.0- SNAPSHOT507dc8d542e5dc4e13693a9a1718b867182ebdba SNAPSHOT
507dc8d542e5dc4e13693a9a1718b867182ebdba
refs/tags/1.0. 2bd14a5b4bde5f3fc56a6642dad5356c82624113d 2
bd14a5b4bde5f3fc56a6642dad5356c82624113d
refs/tags/1.1. 0813a119062d7f0ae2cf467207f08c97625591042 0
813a119062d7f0ae2cf467207f08c97625591042
refs/tags/1.1. 1e8db0e1bc384f84deb358d99bcfc3c4d1692c947 1
e8db0e1bc384f84deb358d99bcfc3c4d1692c947
refs/tags/1.2. 0573a4173f1ec322ce339e0641a84386091eb2cd4 0
573a4173f1ec322ce339e0641a84386091eb2cd4
refs/tags/1.2. 17a3d685bfdfcce8e20628e4dd5aa23b4360b792c 1
7a3d685bfdfcce8e20628e4dd5aa23b4360b792c
refs/tags/1.2.1- 132852d180c6f186d71b9f9e65e23e8562d8d3d8a 1
32852d180c6f186d71b9f9e65e23e8562d8d3d8a
refs/tags/1.2.1- 2aab43aad4b38d68673cc26ba1756abdd2cd60070 2
aab43aad4b38d68673cc26ba1756abdd2cd60070
refs/tags/1.2.1- 35b69912a8471181c5a7776a33f82cf9f134ebb3b 3
5b69912a8471181c5a7776a33f82cf9f134ebb3b
refs/tags/1.2.1- 4f2b38551b2572bceb7456e23035d93f9eeecfc48 4
f2b38551b2572bceb7456e23035d93f9eeecfc48
refs/tags/1.2.1- 5b8bce4b1f84fece5558f3fd7c0b71c4a9d4ddc0c 5
b8bce4b1f84fece5558f3fd7c0b71c4a9d4ddc0c
refs/tags/1.2.1- 6f40bf5f34246d740ff1a3b79f67d72f6f9ff73ae 6
f40bf5f34246d740ff1a3b79f67d72f6f9ff73ae
refs/tags/1.2.1- 7926a9f013085762c3d206ea90534f5362793d8cb 7
926a9f013085762c3d206ea90534f5362793d8cb
refs/tags/1.2.1- 8f1fb30f659e863d6f78720c0e4cf416b82206f11 8
f1fb30f659e863d6f78720c0e4cf416b82206f11
refs/tags/1.2.1- 94e24ba81219ef84721a5c4075d6b19cc46052d28 9
4e24ba81219ef84721a5c4075d6b19cc46052d28
refs/tags/1.2. 2372f57fecdd186ab4ec51453ddfe9183578e7879 2
372f57fecdd186ab4ec51453ddfe9183578e7879
refs/tags/1.3. 0785a7d0f496d6930429bdd545bbfeedfce6d3543 0
785a7d0f496d6930429bdd545bbfeedfce6d3543
refs/tags/1.4. 0d47d9de8fc5df17d6668aa63d3a2053d823f92d9 0
d47d9de8fc5df17d6668aa63d3a2053d823f92d9
refs/tags/lib1.0.0
[Pipeline] echonull echo
null
[Pipeline] script
[Pipeline] {
[Pipeline] withCredentialsMasking withCredentials
Masking
supported pattern matches of $GIT_USERNAME or $GIT_PASSWORD
[Pipeline] {
[Pipeline] sh
+ git tag -a -m 'Tag lib1.0.0' lib1.0. 0fatal 0
fatal
: tag 'lib1.0.0' already exists
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // ws
[Pipeline] }
[Pipeline] // node
[Pipeline] End of PipelineERROR Pipeline
ERROR
: script returned exit code 128Finished 128
Finished
: FAILURE
{code}

 

If we run the same Pipeline script by copy paste it into a Pipeline and not tell Jenkins to load it from an SCM it works perfectly. So it seems to be a problem with the Checkout from SCM in the Pipeline and maybe together with the fact that the Pipeline script is in the same git repository as the shared library?

bogdan.ailiesei@gmail.com (JIRA)

unread,
Dec 10, 2019, 8:19:02 AM12/10/19
to jenkinsc...@googlegroups.com
Bogdan Ailiesei commented on Bug JENKINS-58312
 
Re: Pipeline from SCM tag already exists

Hi,

 

You can tell your checkout not to pull tags in your local copy. 

checkout([$class: 'GitSCM', branches: [[name: 'master' ]], extensions: [[$class: 'CloneOption', noTags: true, shallow: true, reference: '']], userRemoteConfigs: [[credentialsId: 'hudstech-checkout-git', url: https://bitbucket.myserver/repositories/MyProject.git" ]]])

Then your git tag command would work

 

Regards

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages