lundi 21 mai 2018

Jenkins script bitbucket repository error

I a have a testing project on bitbucket at the address : "https://user1@bitbucket.org/user2/api_refactoring_automation.git", shared with a colleague (user2).

I did i pipeline on my local jenkins to run the tests that are inside that bitbucket repository. I used a script like this in the configuration and all works good.

node {

stage('Api Luoghi') {

   git 'https://user1@bitbucket.org/user2/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'
}

stage('Api Carte di Credito') {
     git 'https://user1@bitbucket.org/user2/api_refactoring_automation.git'


     bat 'npm install'

       try{

         bat 'npm run api_Carte_di_credito'

         currentBuild.result = 'SUCCESS'

     } catch(Exception ex){

            currentBuild.result = 'FAILURE' 

     }

     junit 'newman_cartedicredito.xml'
} 

 stage('Api Viaggi')         {

        git 'https://user1@bitbucket.org/user2/api_refactoring_automation.git'


        bat 'npm install'
         try{

         bat 'npm run api_Viaggi'

         currentBuild.result = 'SUCCESS'

     } catch(Exception ex){

            currentBuild.result = 'FAILURE' 

     }

     junit 'newman_viaggi.xml'

    }
   }

Then, we decided to host this pipeline on his localhost jenkins, so he gave me access to his Jenkins ip address and port.

I created the same pipeline with the same configuration, but here in the console it gives me this authentication error:

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://user1@bitbucket.org/user2/api_refactoring_automation.git/'.

I don't understand how i can give credentials to join the repository, and overall i don't understand why i don't have this error on my localhost jenkins.

Aucun commentaire:

Enregistrer un commentaire