[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Boyang Song commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin I am new to Jenkins. Now the trend is the declarative pipeline. I find difficult to learn (groovy) scripted pipeline and the hybrid style with 'script{}' in the declarative pipeline. Would you provide an example declarative pipeline using ssh-steps-plugin? Thank you Add Comment This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.13883.1587329700214%40Atlassian.JIRA.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Hokwang Lee commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Naresh Rayapati Hello. Please provide syntax for declarative pipeline. I don't want to use 'script' anymore. Thanks. Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.6117.1576139940176%40Atlassian.JIRA.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Naresh Rayapati closed an issue as Not A Defect Jenkins / JENKINS-57269 Declarative pipeline with ssh-steps-plugin Change By: Naresh Rayapati Status: Open Closed Resolution: Not A Defect Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.24122.1560111540552%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Naresh Rayapati commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Davide F Closing this Jira for now, please don't mind to reopen or log another Jira in case if you need more help. Thank you. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.24119.1560111540426%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Naresh Rayapati edited a comment on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin As mentioned before please use script block to execute these steps within declarative pipelines. And in the above code, it isn't setting the credentials to the remote: please follow the documentation on the readme for more information. https://github.com/jenkinsci/ssh-steps-plugin#configurationusername identityFile Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.16739.1559232180138%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Naresh Rayapati commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin As mentioned before please use script block to execute these steps within declarative pipelines. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.16736.1559232000229%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Davide F commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Hello, Do you have any update regarding this support request ? Best regards Davide Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.199035.1556696089000.23425.1557490800272%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Davide F edited a comment on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Hello [~nrayapati],Thanks for your quick feedback.Here's how I've tried to use script block in a declarative pipeline{{pipeline {}}{{ agent any}}{{ stages {}}{{ stage ('Main Stage') {}}{{ steps {}}{{ script {}}{{ stage ('nothing but display a message') {}}{{ echo 'First stage'}} {{ } }} {{ stage ('ssh') {}}{{ def remote = [:]}}{{ remote.name = "hostname"}}{{ remote.host = "fqdn-hostname"}}{{ remote.port = custom-port}}{{ remote.allowAnyHosts = true}}{{ withCredentials([sshUserPrivateKey(credentialsId: '', keyFileVariable: 'key', passphraseVariable: 'passphrase', usernameVariable: 'username')]) {}}{{ remote.passphrase = passphrase}}{{ sshGet(remote: remote, from: 'abc.sh', into: 'abc.sh', override: true)}} {{ } }} {{ } }} {{ } }} {{ } }} {{ } }} {{ }}}{{}}}The job is "stuck" at sshGet step and I have to terminate the step manually to get the job finish.But if I use the example below (using sshagent), the job works just fine.{{pipeline {}}{{ agent any}}{{ stages {}}{{ stage ('Main Stage') {}}{{ steps {}}{{ script {}}{{ stage ('nothing but display a message') {}}{{ echo 'First stage'}} {{ } }} {{ stage ('ssh') {}}{{ withCredentials([sshUserPrivateKey(credentialsId: ' }}{{ x }}{{ ', keyFileVariable: 'key', passphraseVariable: 'passphrase', usernameVariable: 'username')]) {}} \ {{ remote.passphrase = passphrase}}{{ sshagent(['x']) {}}{{ sh 'scp -o StrictHostKeyChecking=no $username@hostname:~/abc.sh .'}} {{ } }} {{ } }} {{ } }} {{ } }} {{ } }} {{ } }} {{ } }} {{}}}Any idea ?Thanks for your helpDavide Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Davide F commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Hello Naresh Rayapati, Thanks for your quick feedback. Here's how I've tried to use script block in a declarative pipeline pipeline { agent any stages { stage ('Main Stage') { steps { script { stage ('nothing but display a message') { echo 'First stage' {{ }}} stage ('ssh') { def remote = [:] remote.name = "hostname" remote.host = "fqdn-hostname" remote.port = custom-port remote.allowAnyHosts = true withCredentials([sshUserPrivateKey(credentialsId: '', keyFileVariable: 'key', passphraseVariable: 'passphrase', usernameVariable: 'username')]) { remote.passphrase = passphrase sshGet(remote: remote, from: 'abc.sh', into: 'abc.sh', override: true) {{ }}} {{ }}} {{ }}} {{ }}} {{ }}} } } The job is "stuck" at sshGet step and I have to terminate the step manually to get the job finish. But if I use the example below (using sshagent), the job works just fine. pipeline { agent any stages { stage ('Main Stage') { steps { script { stage ('nothing but display a message') { echo 'First stage' {{ }}} stage ('ssh') { withCredentials([sshUserPrivateKey(credentialsId: '}}{{x}}{{', keyFileVariable: 'key', passphraseVariable: 'passphrase', usernameVariable: 'username')]) { {{ remote.passphrase = passphrase}} sshagent(['x']) { sh 'scp -o StrictHostKeyChecking=no $username@hostname:~/abc.sh .' {{ }}} {{ }}} {{ }}} {{ }}} {{ }}} {{ }}} {{ }}} } Any idea ? Thanks for your help Davide Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Naresh Rayapati commented on JENKINS-57269 Re: Declarative pipeline with ssh-steps-plugin Can you post your declarative pipeline snippets also please? The Declarative model for Jenkins Pipelines has a restricted subset of syntax that it allows in the stage blocks - see the syntax guide for more info. You can bypass that restriction by wrapping your steps in a script { ... } block. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-57269) Declarative pipeline with ssh-steps-plugin
Title: Message Title Davide F created an issue Jenkins / JENKINS-57269 Declarative pipeline with ssh-steps-plugin Issue Type: Bug Assignee: Naresh Rayapati Components: ssh-steps-plugin Created: 2019-05-01 07:34 Environment: Jenkins (version 2.150.2) ssh steps plugin (version 1.2.1) Priority: Minor Reporter: Davide F Hello, This is a question more than a bug report. I'd like to use ssh private key account (with passphrase) from Jenkins credentials store. I did successfully used this plugin with an ssh key pair in a scripted pipeline using the provided code sample below https://github.com/jenkinsci/ssh-steps-plugin#withcredentials My groovy code looks like this def remote = [:] remote.name = "hostname" remote.host = "hostname" remote.allowAnyHosts = true node { withCredentials([sshUserPrivateKey(credentialsId: 'x-x-', keyFileVariable: 'identity', passphraseVariable: 'passphrase', usernameVariable: 'userName')]) { remote.user = userName remote.identityFile = identity remote.passphrase = passphrase stage("SSH Steps Rocks!") { writeFile file: 'abc.sh', text: 'ls' sshPut remote: remote, from: 'abc.sh', into: '.' } } I've tried in several way to use Declarative Pipeline but without success. Do you have any tips or samples to share ? Thanks for your help. Davide