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

When I update Jenkins version, failed to publish my file through agent node

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Incomplete
    • None
    • Jenkins version 2.330 one master one slave
      java version "11.0.12" 2021-07-20 LTS
      Publish Over SSH version 1.22
      OS: CentOS 8.2
      Agent connects to master through agent.jar

    Description

      I update my Jenkins from version 2.26 to version 2.330, when I deploy my java project and publish my jar file to remote servers through the Jenkins agent(slave) node, it is hanged, after a long long time, I got an error:

      SSH: Connecting from host [xx-xx-xx-xx]
      SSH: Connecting with configuration [my-server] ...
      ERROR: Exception when publishing, exception message [Failed to add SSH key. Message [invalid privatekey: [B@28e21477]]
      Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
      Finished: UNSTABLE

       

      I have tested the login from agent node to remote host, and it worked well, it works well before I updated my Jenkins version.

       

      Attachments

        Activity

          dannyarcher Danny Archer added a comment -

          Have solved, I dropped the version to 2.319.2 and it worked again.

          dannyarcher Danny Archer added a comment - Have solved, I dropped the version to 2.319.2 and it worked again.
          ericthieme Eric Thieme added a comment - - edited

          Had the same issue:

          • Jenkins: 2.332.1
          • publish-over-ssh: 1.24

          >> ERROR: Exception when publishing, exception message [Failed to add SSH key. Message [invalid privatekey: [B@4ab2e565]]

          Downgrade to 2.319.2 helped as well.


          Update:

          As I had too many other plugin updates a downgrade was no option (although it would have solved the problem)

          I figured out another workaround.

          1. Go to the configuration page /configure
          2. Go to the "Publish over SSH" section
          3. Remove entries from "Path to key" and "Key"
          4. Go to every configured SSH Server and click "Advanced"
          5. Select "Use password authentication, or use a different", leave the "Path to key" empty and add the private key directly to "Key"

          • Before the upgrade to Jenkins: 2.332.1 I just used the path to my private key ".ssh/id_rsa" and it worked.
          • After the upgrade to Jenkins: 2.332.1 I still could use the path to my private key and if I clicked "Test configuration" it still worked. But every job where I used this configured server just got stuck with the error message: "[Failed to add SSH key. Message [invalid privatekey: [B@730bf83f]]"
          • The private key was created with "ssh-keygen t rsa -b 4096 -m PEM" and it begins with "---BEGIN RSA PRIVATE KEY----"

          I hope that helps a bit.

           

          ericthieme Eric Thieme added a comment - - edited Had the same issue: Jenkins: 2.332.1 publish-over-ssh: 1.24 >> ERROR: Exception when publishing, exception message [Failed to add SSH key. Message [invalid privatekey: [B@4ab2e565] ] Downgrade to 2.319.2 helped as well. Update: As I had too many other plugin updates a downgrade was no option (although it would have solved the problem) I figured out another workaround. Go to the configuration page /configure Go to the "Publish over SSH" section Remove entries from "Path to key" and "Key" Go to every configured SSH Server and click "Advanced" Select "Use password authentication, or use a different", leave the "Path to key" empty and add the private key directly to "Key" Before the upgrade to Jenkins: 2.332.1 I just used the path to my private key ".ssh/id_rsa" and it worked. After the upgrade to Jenkins: 2.332.1 I still could use the path to my private key and if I clicked "Test configuration" it still worked. But every job where I used this configured server just got stuck with the error message: "[Failed to add SSH key. Message [invalid privatekey: [B@730bf83f] ]" The private key was created with "ssh-keygen t rsa -b 4096 -m PEM" and it begins with " --- BEGIN RSA PRIVATE KEY ----" I hope that helps a bit.  
          sratz Sebastian Ratz added a comment - - edited

          This is caused by

          Notable changes since 2.319.3:
          Always enable the agent-to-controller security subsystem. Remove the admin-customizable allowlists for callables and file paths. Remove the ability to access some files on the controller from agents. Use the Plugin Manager to upgrade incompatible plugins. (pull 5885, issue 67173, the issue tracker)

           

          In the pull request, there was a comment specifically about this issue with publish-over-ssh:

          https://github.com/jenkinsci/jenkins/pull/5885#issuecomment-996650551

           

          sratz Sebastian Ratz added a comment - - edited This is caused by Notable changes since 2.319.3: Always enable the agent-to-controller security subsystem. Remove the admin-customizable allowlists for callables and file paths. Remove the ability to access some files on the controller from agents. Use the Plugin Manager to upgrade incompatible plugins. ( pull 5885 , issue 67173 , the issue tracker )   In the pull request, there was a comment specifically about this issue with publish-over-ssh: https://github.com/jenkinsci/jenkins/pull/5885#issuecomment-996650551  

          JENKINS-67236 needs to be solved to fix this.

          sratz Sebastian Ratz added a comment - JENKINS-67236 needs to be solved to fix this.

          For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues

          Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/66
          And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-67614%22

          (Note: this is an automated bulk comment)

          gmcdonald Gavin McDonald added a comment - For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/66 And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-67614%22 (Note: this is an automated bulk comment)

          Closing ticket, please use the corresponding Github Issue as linked above.

          gmcdonald Gavin McDonald added a comment - Closing ticket, please use the corresponding Github Issue as linked above.

          People

            dannyarcher Danny Archer
            dannyarcher Danny Archer
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: