2017-10-08 9 views
0

私は上の明確化をしたいと思います:ジェンキンスGitのタグ/プッシュエラー

ジェンキンスマスター・ノードとワーカーノードはgitの両方のノードがgitの
  • ときに認証するための認証情報とsshのプラグインを使用する方法
  • と通信する方法
    • CredentialsプラグインとSSHAgentプラグインを使用する

    現時点では、マスターノードはすべての資格情報を保存し、これらの資格情報をワーカーエージェントに渡すと考えられます。これにより、マスターノードであるgitにはsshキーが1つしかないと信じられます。

    これまでのところ、これは真であると思われます。なぜなら、ビルドがマスター上でトリガーされると、ワーカーエージェントにsshキーが設定されていなくても、ワーカーノードはgit cloneとgit initを実行できます。だから、

    Started by user deploy-user 
    Replayed #23 
    18:01:03 Connecting to https://api.github.com using deploy-user/****** (username-with-password) 
    Obtained Jenkinsfile from a12ea59545db96fc8681dbdd5d44923108c01b40 
    [Pipeline] node 
    Running on nodejs in /home/server/jenkins/workspace/K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7 
    [Pipeline] { 
    [Pipeline] stage 
    [Pipeline] { (Declarative: Checkout SCM) 
    [Pipeline] checkout 
    Cloning the remote Git repository 
    Cloning with configured refspecs honoured and without tags 
    Cloning repository https://github.com/WaterBottleInce/Frontend.git 
    > git init /home/server/jenkins/workspace/K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7 # timeout=10 
    Fetching upstream changes from https://github.com/WaterBottleInce/Frontend.git 
    > git --version # timeout=10 
    using GIT_ASKPASS to set credentials username-with-password 
    > git fetch --no-tags --progress https://github.com/WaterBottleInce/Frontend.git +refs/heads/feature-jenkinsfile:refs/remotes/origin/feature-jenkinsfile 
    > git config remote.origin.url https://github.com/WaterBottleInce/Frontend.git # timeout=10 
    > git config --add remote.origin.fetch +refs/heads/feature-jenkinsfile:refs/remotes/origin/feature-jenkinsfile # timeout=10 
    > git config remote.origin.url https://github.com/WaterBottleInce/Frontend.git # timeout=10 
    Fetching without tags 
    Fetching upstream changes from https://github.com/WaterBottleInce/Frontend.git 
    using GIT_ASKPASS to set credentials username-with-password 
    > git fetch --no-tags --progress https://github.com/WaterBottleInce/Frontend.git +refs/heads/feature-jenkinsfile:refs/remotes/origin/feature-jenkinsfile 
    Checking out Revision a12ea59545db96fc8681dbdd5d44923108c01b40 (feature-jenkinsfile) 
    > git config core.sparsecheckout # timeout=10 
    > git checkout -f a12ea59545db96fc8681dbdd5d44923108c01b40 
    Commit message: "removes error in customworkspace" 
    > git rev-list a12ea59545db96fc8681dbdd5d44923108c01b40 # timeout=10 
    

    このステップない理由:完全

    fatal: could not read Username for 'https://github.com': No such device or address 
    

    :上記のエラープリントアウトからこのライン

    [Pipeline] } 
    [Pipeline] // withEnv 
    [Pipeline] } 
    [Pipeline] // stage 
    [Pipeline] stage 
    [Pipeline] { (Deploy-Staging) 
    [Pipeline] tool 
    [Pipeline] envVarsForTool 
    [Pipeline] withEnv 
    [Pipeline] { 
    [Pipeline] sh 
    [K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7] Running shell script 
    + git remote -v 
    origin https://github.com/WaterBottleInc/Reactjs-Front.git (fetch) 
    origin https://github.com/WaterBottleInc/Reactjs.git (push) 
    [Pipeline] sh 
    [K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7] Running shell script 
    + git show-ref 
    a12ea59545db96fc8681dbdd5d44923108c01b40 refs/remotes/origin/feature-jenkinsfile 
    [Pipeline] sh 
    [K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7] Running shell script 
    + git tag -a feature-jenkinsfile.24 -m git sha is a12ea59545db96fc8681dbdd5d44923108c01b40 
    [Pipeline] sh 
    [K-Front_feature-jenkinsfile-KHCSHNIRHLZUOTSCIQPWI7] Running shell script 
    + git push origin HEAD:development --tags 
    fatal: could not read Username for 'https://github.com': No such device or address 
    [Pipeline] } 
    [Pipeline] // withEnv 
    [Pipeline] } 
    [Pipeline] // stage 
    [Pipeline] stage 
    [Pipeline] { (Declarative: Post Actions) 
    [Pipeline] deleteDir 
    [Pipeline] } 
    [Pipeline] // stage 
    [Pipeline] } 
    [Pipeline] // withEnv 
    [Pipeline] } 
    [Pipeline] // withEnv 
    [Pipeline] } 
    [Pipeline] // withEnv 
    [Pipeline] } 
    [Pipeline] // node 
    [Pipeline] End of Pipeline 
    

    :このエラーで

    steps{ 
        sh('git remote -v') 
        sh('git show-ref') 
        sh('git tag -a $BRANCH_NAME.$BUILD_NUMBER -m "git sha is $GIT_COMMIT"') 
        sh('git push origin HEAD:development --tags') 
    } 
    

    結果を私が私がどこにいないのか分からないので私を捨てますtはユーザー名を探しています。

    誰かお手伝いできますか?ありがとう。

  • 答えて

    1

    この:マスターノードで定義されている資格情報が自動的に構築ジョブに渡さ/バインドされていないので、

    steps{ 
        sh('git remote -v') 
        sh('git show-ref') 
        sh('git tag -a $BRANCH_NAME.$BUILD_NUMBER -m "git sha is $GIT_COMMIT"') 
        sh('git push origin HEAD:development --tags') 
    } 
    

    は失敗します。

    資格情報をバインドするには、suite of Credentials Pluginsが必要です。それらがインストールされると、withCredentials() functionを使用して、gitとの認証/通信に必要な資格情報を渡します。

    この記事はjenkins-user forumに詳しい説明が必要な場合は

    関連する問題