我是詹金斯的新手。我在bitbucket上有一个测试项目,与其他同事共享。
' HTTPS://***@bitbucket.org/*****/api_refactoring_automation.git/'
我尝试将它连接到我的localhost上的jenkins,它完美无缺。
但是当我在另一个地址(我的同事的IP地址)上使用相同的配置时,它会返回给我这个错误:
致命:身份验证失败 ' HTTPS://***@bitbucket.org/*****/api_refactoring_automation.git/' ;.
这只发生在管道控制台中,因为在项目的设置中,当我插入git url和凭据时,它可以正常工作。
这是控制台消息:
> Started by user Marco Pagano
Obtained Jenkinsfile from git https://****@bitbucket.org/******/api_refactoring_automation.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/api_refactoring_automation
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Postman tests)
[Pipeline] git
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://****@bitbucket.org/******/api_refactoring_automation.git # timeout=10
Fetching upstream changes from https://****@bitbucket.org/******/api_refactoring_automation.git
> git --version # timeout=10
> git fetch --tags --progress https://****@bitbucket.org/******/api_refactoring_automation.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://****@bitbucket.org/******/api_refactoring_automation.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
...
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://***@bitbucket.org/*******/api_refactoring_automation.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://****@bitbucket.org/*****/api_refactoring_automation.git/'
这是我的Jenkisfile:
node {
stage('Postman tests') {
git 'https://marcopagano@bitbucket.org/mguillermaz/api_refactoring_automation.git'
bat 'npm install'
try{
bat 'npm run api_Luoghi/Comuni'
currentBuild.result = 'SUCCESS'
} catch(Exception ex){
currentBuild.result = 'FAILURE'
}
junit 'newman_comuni.xml'
try{
bat 'npm run api_Luoghi/Province'
currentBuild.result = 'SUCCESS'
} catch(Exception ex){
currentBuild.result = 'FAILURE'
}
junit 'newman_province.xml'
try{
bat 'npm run api_Luoghi/Stati'
currentBuild.result = 'SUCCESS'
} catch(Exception ex){
currentBuild.result = 'FAILURE'
}
junit 'newman_stati.xml'
try{
bat 'npm run api_Carte_di_credito'
currentBuild.result = 'SUCCESS'
} catch(Exception ex){
currentBuild.result = 'FAILURE'
}
junit 'newman_cartedicredito.xml'
}
}
我再说一遍,配置与我的localhost上的配置完全相同,但是那个配置正常。这是另一个控制台:
> Obtained Jenkinsfile from git https://****@bitbucket.org/*****/api_refactoring_automation.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\api_refactoring_automation
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Postman tests)
[Pipeline] git
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://****@bitbucket.org/*****/api_refactoring_automation.git # timeout=10
Fetching upstream changes from https://****@bitbucket.org/*****/api_refactoring_automation.git
> git.exe --version # timeout=10
> git.exe fetch --tags --progress https://****@bitbucket.org/*****/api_refactoring_automation.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 0ec720b69aeb07834f916e91566e27d73fe2f6f6 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f 0ec720b69aeb07834f916e91566e27d73fe2f6f6
> git.exe branch -a -v --no-abbrev # timeout=10
> git.exe branch -D master # timeout=10
> git.exe checkout -b master 0ec720b69aeb07834f916e91566e27d73fe2f6f6
Commit message: "test suite modified"
> git.exe rev-list --no-walk 5a2aff1eb97d6a796206c498bfa5728fa5ede11c # timeout=10
> [Pipeline] bat [api_refactoring_automation] Running batch script
>
> C:\Program Files
> (x86)\Jenkins\workspace\api_refactoring_automation>npm install npm
> WARN api_refactoring_automation@1.0.0 No repository field. npm WARN
> api_refactoring_automation@1.0.0 No license field. etc.