Re: Kubernetes pligin for jenkins

2020-02-05 Thread Liejun Tao
Suggest to run a test pod from your cluster and check network connectivity
to your jenkins,
http://ec2-18-140-64-62.ap-southeast-1.compute.amazonaws.com:8080/


On Wed, Feb 5, 2020 at 7:57 PM adrian lee  wrote:

>
>
> On Thursday, February 6, 2020 at 9:53:53 AM UTC+8, adrian lee wrote:
>>
>> Hi all
>>
>> I am trying to use jenkins and kubernetes plugin. I deployed a kubernetes
>> cluster in AWS using kubeadm and I installed jenkins on a EC2 VM.
>>
>>
>> I configured the plugin such that its using Kubernetes server
>> certificate key to connect
>>
>>
>> I am trying to initiate the deployment of pods in the kubernetes clusters
>> using pipelines in jenkins.
>>
>> However I keep getting an agent time out
>>
>>
>> Any help?
>>
>> Error in provisioning; agent=KubernetesSlave name: mypod-j3d11-nwjvt, 
>> template=PodTemplate{, name='mypod-j3d11', label='mypod', 
>> nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume 
>> [memory=false], containers=[ContainerTemplate{name='golang', 
>> image='golang:1.8.0', command='cat', ttyEnabled=true}], 
>> annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}.
>>  Container jnlp exited with error 255. Logs: Feb 06, 2020 1:32:28 AM 
>> org.jenkinsci.remoting.engine.WorkDirManager setupLogging
>> INFO: Both error and output logs will be printed to 
>> /home/jenkins/agent/remoting
>> Feb 06, 2020 1:32:28 AM hudson.remoting.jnlp.Main$CuiListener status
>> INFO: Locating server among 
>> [http://xxx.ap-southeast-1.compute.amazonaws.com:8080/]
>> Feb 06, 2020 1:32:58 AM hudson.remoting.jnlp.Main$CuiListener error
>> SEVERE: Failed to connect to 
>> http://xxx.ap-southeast-1.compute.amazonaws.com:8080/tcpSlaveAgentListener/:
>>  connect timed out
>> java.io.IOException: Failed to connect to 
>> http://ec2-18-140-64-62.ap-southeast-1.compute.amazonaws.com:8080/tcpSlaveAgentListener/:
>>  connect timed out
>>  at 
>> org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:206)
>>  at hudson.remoting.Engine.innerRun(Engine.java:527)
>>  at hudson.remoting.Engine.run(Engine.java:488)
>> Caused by: java.net.SocketTimeoutException: connect timed out
>>  at java.net.PlainSocketImpl.socketConnect(Native Method)
>>  at 
>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
>>  at 
>> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
>>  at 
>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
>>  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>>  at java.net.Socket.connect(Socket.java:589)
>>  at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
>>  at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
>>  at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
>>  at sun.net.www.http.HttpClient.(HttpClient.java:242)
>>  at sun.net.www.http.HttpClient.New(HttpClient.java:339)
>>  at sun.net.www.http.HttpClient.New(HttpClient.java:357)
>>  at 
>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
>>  at 
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
>>  at 
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
>>  at 
>> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
>>  at 
>> org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:203)
>>  ... 2 more
>>
>>
>>
>> Feb 06, 2020 1:32:59 AM WARNING 
>> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
>>
>> Error in provisioning; agent=KubernetesSlave name: mypod-j3d11-nwjvt, 
>> template=PodTemplate{, name='mypod-j3d11', label='mypod', 
>> nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume 
>> [memory=false], containers=[ContainerTemplate{name='golang', 
>> image='golang:1.8.0', command='cat', ttyEnabled=true}], 
>> annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}
>> java.lang.IllegalStateException: Containers are terminated with exit codes: 
>> {jnlp=255}
>>  at 
>> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.checkTerminatedContainers(KubernetesLauncher.java:224)
>>  at 
>> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:181)
>>  at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:292)
>>  at 
>> jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
>>  at 
>> jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
>>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>  at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto

Re: Kubernetes pligin for jenkins

2020-02-05 Thread adrian lee


On Thursday, February 6, 2020 at 9:53:53 AM UTC+8, adrian lee wrote:
>
> Hi all
>
> I am trying to use jenkins and kubernetes plugin. I deployed a kubernetes 
> cluster in AWS using kubeadm and I installed jenkins on a EC2 VM.
>
>
> I configured the plugin such that its using Kubernetes server certificate 
> key to connect
>
>
> I am trying to initiate the deployment of pods in the kubernetes clusters 
> using pipelines in jenkins.
>
> However I keep getting an agent time out 
>
>
> Any help?
>
> Error in provisioning; agent=KubernetesSlave name: mypod-j3d11-nwjvt, 
> template=PodTemplate{, name='mypod-j3d11', label='mypod', 
> nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume 
> [memory=false], containers=[ContainerTemplate{name='golang', 
> image='golang:1.8.0', command='cat', ttyEnabled=true}], 
> annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}.
>  Container jnlp exited with error 255. Logs: Feb 06, 2020 1:32:28 AM 
> org.jenkinsci.remoting.engine.WorkDirManager setupLogging
> INFO: Both error and output logs will be printed to 
> /home/jenkins/agent/remoting
> Feb 06, 2020 1:32:28 AM hudson.remoting.jnlp.Main$CuiListener status
> INFO: Locating server among 
> [http://xxx.ap-southeast-1.compute.amazonaws.com:8080/]
> Feb 06, 2020 1:32:58 AM hudson.remoting.jnlp.Main$CuiListener error
> SEVERE: Failed to connect to 
> http://xxx.ap-southeast-1.compute.amazonaws.com:8080/tcpSlaveAgentListener/:
>  connect timed out
> java.io.IOException: Failed to connect to 
> http://ec2-18-140-64-62.ap-southeast-1.compute.amazonaws.com:8080/tcpSlaveAgentListener/:
>  connect timed out
>   at 
> org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:206)
>   at hudson.remoting.Engine.innerRun(Engine.java:527)
>   at hudson.remoting.Engine.run(Engine.java:488)
> Caused by: java.net.SocketTimeoutException: connect timed out
>   at java.net.PlainSocketImpl.socketConnect(Native Method)
>   at 
> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
>   at 
> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
>   at 
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
>   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>   at java.net.Socket.connect(Socket.java:589)
>   at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
>   at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
>   at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
>   at sun.net.www.http.HttpClient.(HttpClient.java:242)
>   at sun.net.www.http.HttpClient.New(HttpClient.java:339)
>   at sun.net.www.http.HttpClient.New(HttpClient.java:357)
>   at 
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
>   at 
> sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
>   at 
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
>   at 
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
>   at 
> org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:203)
>   ... 2 more
>
>
>
> Feb 06, 2020 1:32:59 AM WARNING 
> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
>
> Error in provisioning; agent=KubernetesSlave name: mypod-j3d11-nwjvt, 
> template=PodTemplate{, name='mypod-j3d11', label='mypod', 
> nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume 
> [memory=false], containers=[ContainerTemplate{name='golang', 
> image='golang:1.8.0', command='cat', ttyEnabled=true}], 
> annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}
> java.lang.IllegalStateException: Containers are terminated with exit codes: 
> {jnlp=255}
>   at 
> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.checkTerminatedContainers(KubernetesLauncher.java:224)
>   at 
> org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:181)
>   at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:292)
>   at 
> jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
>   at 
> jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>   at java.lang.Thread.run(Thread.java:748)
>
>
>
> this is my template below which I am using in my pipeline
>
> podTemplate(cloud: 'kubernetes', label: 'mypod',containers: [
> containerTemplate(name: 'golang', image: 'golang:1.8.0', ttyEnabled: 
> true

Kubernetes pligin for jenkins

2020-02-05 Thread adrian lee
Hi all

I am trying to use jenkins and kubernetes plugin. I deployed a kubernetes 
cluster in AWS using kubeadm and I installed jenkins on a EC2 VM.


I configured the plugin such that its using Kubernetes server certificate 
key to connect


I am trying to initiate the deployment of pods in the kubernetes clusters 
using pipelines in jenkins.

However I keep getting an agent time out 


Any help?


Feb 06, 2020 1:32:59 AM WARNING 
org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch

Error in provisioning; agent=KubernetesSlave name: mypod-j3d11-nwjvt, 
template=PodTemplate{, name='mypod-j3d11', label='mypod', 
nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume 
[memory=false], containers=[ContainerTemplate{name='golang', 
image='golang:1.8.0', command='cat', ttyEnabled=true}], 
annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}
java.lang.IllegalStateException: Containers are terminated with exit codes: 
{jnlp=255}
at 
org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.checkTerminatedContainers(KubernetesLauncher.java:224)
at 
org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:181)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:292)
at 
jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at 
jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)


this is my template below which I am using in my pipeline

podTemplate(cloud: 'kubernetes', label: 'mypod',containers: [
containerTemplate(name: 'golang', image: 'golang:1.8.0', ttyEnabled: true, 
command: 'cat')
  ]) {

node('mypod') {

stage('Get a Golang project') {
git url: 'https://github.com/hashicorp/terraform.git'
container('golang') {
stage('Build a Go project') {
sh 'echo hello world'
}
}
}

}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3c000217-f6ef-44bf-976e-a05156570db3%40googlegroups.com.


Re: [SOCIAL NETWORK] RE: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

2020-02-05 Thread Ivan Fernandez Calvo
Hi,

I am confused, Do you try to connect an SSH agent to a Jenkins instance to 
build your jobs or you are trying to configure totter thing?
https://plugins.jenkins.io/ssh-slaves

or execute SSH remote commands on a host that it is not an Agent?
https://plugins.jenkins.io/ssh

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5e416e8d-aed2-4477-b42f-52322495b4e3%40googlegroups.com.


freeze that doesn't work for Jobs in the subfolder

2020-02-05 Thread sharmil kumar
Hi,

   In the jenkins-jobs repo I have a few jobs defined in the jobs/ 

subjobs folder. When trying to freeze one of those jobs, they're not 
selectable in the drop-down list for freezable jobs(example jobs within the 
subjobs folder) .Jobs that are not in that folder, do appear and are 
freezable. The folder *subjobs* itself is available in the drop-down, but 
running the freeze job on it does not freeze the jobs contained within that

// loop over jobs and list them
import com.cloudbees.hudson.plugins.folder.*
import jenkins.model.*
hudson.model.Hudson.instance.items.collect { it.getName() }.sort()

Would somebody help me to list all the jobs including the jobs within the 
subjobs folder.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e654fb65-a766-422d-981d-63728d9b5e95%40googlegroups.com.


RE: [SOCIAL NETWORK] RE: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

2020-02-05 Thread Mahima Mishra
Suggest you to add a Jenkins user on the Linux slave and generate a key for 
that user and use the same in credentials.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2e3f1c3d-bba1-46f3-a794-5c2d4bb0fa36%40googlegroups.com.


RE: [SOCIAL NETWORK] RE: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

2020-02-05 Thread Sanders, Sholom
The keys were generated on the Linux machine as the mdmadmin user. Yes I am 
pasting in the generated private key as the mdmadmin user into the Jenkins 
Credentials for the linux machine. It is called jenkinsAgent_rsa

-Original Message-
From: jenkinsci-users@googlegroups.com  On 
Behalf Of Mahima Mishra
Sent: Wednesday, February 5, 2020 2:05 PM
To: Jenkins Users 
Subject: [SOCIAL NETWORK] RE: [SOCIAL NETWORK] Re: SSH Remote Host not being 
able to connect

Are you using the private key for user - mdmadmin?
Were the keys generated on jenkins master?

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fjenkinsci-users%2F464ff2f3-8d30-4266-a432-955f2b4b9617%2540googlegroups.com&data=02%7C01%7Cssanders%40nycopportunity.nyc.gov%7C7ac12069a302494f684c08d7aa6e4970%7C73d61799c28440228d4154cc4f1929ef%7C0%7C0%7C637165263763117174&sdata=d76wjP2%2BbyKdoxee0OHahmy9HvMQyWD6H5UtM4SHsYc%3D&reserved=0.



This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/BL0PR0901MB4356130960CFF9D8F901B608F2020%40BL0PR0901MB4356.namprd09.prod.outlook.com.


RE: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

2020-02-05 Thread Mahima Mishra
Are you using the private key for user - mdmadmin?
Were the keys generated on jenkins master?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/464ff2f3-8d30-4266-a432-955f2b4b9617%40googlegroups.com.


RE: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

2020-02-05 Thread Sanders, Sholom


From: jenkinsci-users@googlegroups.com  On 
Behalf Of Ivan Fernandez Calvo
Sent: Wednesday, February 5, 2020 11:12 AM
To: Jenkins Users 
Subject: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect

I understand you have a Jenkins instance that runs on a windows machine and you 
want to use a Linux machine as an agent connected by SSH
* Create an SSH key pair (public/private)   Ran the command “ssh-keygen -t rsa 
-C "Jenkins agent key" -f "jenkinsAgent_rsa"  “
* Create an SSH credential in the Jenkins machine and put the private key there 
Created the credentials and put jenkinsAgent_rsa into it.
* Create an SSH agent see 
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#configure-launch-agents-via-ssh
 – This is creating a node which I didn’t do before – so I created the node and 
selected the credential with the private key. The verification strategy slect 
is non-verifying.
  * Select the SSH credential created before as credentials
  * Chose the verification strategy that you want, see the documentation, if 
you have problems start with the "Non verifying Verification Strategy" you can 
change it later
* Add the public key on ~/.ssh/authorized_keys This was done

I tried to relaunch the node and got the following:

[02/05/20 12:57:13] [SSH] Opening SSH connection to 
msslva-hhsmdm07.csc.nycnet:22.
[02/05/20 12:57:13] [SSH] WARNING: SSH Host Keys are not being verified. 
Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for mdmadmin 
(credentialId:c6bf4c24-0a05-43ca-a9be-3dfc149c6d0f/method:publickey)
[02/05/20 12:57:13] [SSH] Authentication failed.
Authentication failed.
[02/05/20 12:57:13] Launch failed - cleaning up connection
[02/05/20 12:57:13] [SSH] Connection closed.

Not sure where this log you are talking about. Is this on the Windows machine 
running Jenkins?

Previously I did not create a Node. I simply added an entry in the Manage 
Jenkins --> Configure System --> SSH Remote Host section – added an entry here 
selecting that credential. In the Project I would select “Execute shell script 
on remote host using SSH” . But the SSH Remote Host entry is also failing on 
connecting to the machine. I am able to do WinSCP from the Jenkins machine to 
the remote host with the same user id.

this should work, if not you should see some error messages on the agent logs 
page "JENKISN_URL/computer/AGENT_NAME/log", if nothing works see 
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/TROUBLESHOOTING.md#common-info-needed-to-troubleshooting-a-bug
 there you have the information needed to troubleshoot an SSH issue

El martes, 4 de febrero de 2020, 21:53:45 (UTC+1), Sholom Sanders escribió:
On my remote Linux machine I created a private/public key to communicate with 
Jenkins on my Windows machine. I put the public key into authorized_keys. In 
Jenkins, I created a credential for this user and pasted in the private key. I 
then went to Manage  Jenkins --> Configure System to the SSH Remote Hosts. I 
created a new one with the Linux machine name and port 22 and selected the 
newly created credential. When I click on check connection, I am getting "Can't 
connect to server".  I had created two other SSH remote hosts successfully. But 
this lone is not going through and I am not sure how to track down the solution.
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/72ae6f7e-fa54-4be5-add3-9337d70835d4%40googlegroups.com

Re: Jenkins docker not found

2020-02-05 Thread Simon Richter
Hi,

On Wed, Feb 05, 2020 at 07:44:57AM -0800, adrian lee wrote:

> however, it keeps throwing me an error
> 
> ```
> + docker ps
> /var/lib/jenkins/workspace/openFaaS_getdata@tmp/durable-270f2b11/script.sh: 
> line 1: docker: command not found
> 
> ```

> I tried referencing other posts on stack overflow but could not find what 
> is wrong. 

That is the same problem I'm having: the plugin responsible for handling
"agent { docker ... }" and "agent { dockerfile ... }" uses the Docker CLI
instead of the Docker API, so the "docker" program must be in the search
path.

There was a proposed fix[1] for that, but it seems that is dead.

What I'm doing now, until someone makes a better suggestion, is to build a
derived Jenkins container that adds the "docker" CLI tool to the image
using wget, and limit all builds to run on master so the tool is available.

Since the actual build happens inside a fresh container anyway, the only
annoying thing about this is that the build counts against master's
executors.

   Simon

[1] https://github.com/jenkinsci/docker-workflow-plugin/pull/195

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/20200205171925.GA8541%40psi5.com.


Re: SSH Remote Host not being able to connect

2020-02-05 Thread Ivan Fernandez Calvo
I understand you have a Jenkins instance that runs on a windows machine and 
you want to use a Linux machine as an agent connected by SSH
* Create an SSH key pair (public/private)
* Create an SSH credential in the Jenkins machine and put the private key 
there
* Create an SSH agent see 
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#configure-launch-agents-via-ssh
  * Select the SSH credential created before as credentials
  * Chose the verification strategy that you want, see the documentation, 
if you have problems start with the "Non verifying Verification Strategy" 
you can change it later
* Add the public key on ~/.ssh/authorized_keys 

this should work, if not you should see some error messages on the agent 
logs page "JENKISN_URL/computer/AGENT_NAME/log", if nothing works see 
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/TROUBLESHOOTING.md#common-info-needed-to-troubleshooting-a-bug
 there 
you have the information needed to troubleshoot an SSH issue

El martes, 4 de febrero de 2020, 21:53:45 (UTC+1), Sholom Sanders escribió:
>
> On my remote Linux machine I created a private/public key to communicate 
> with Jenkins on my Windows machine. I put the public key into 
> authorized_keys. In Jenkins, I created a credential for this user and 
> pasted in the private key. I then went to Manage  Jenkins --> Configure 
> System to the SSH Remote Hosts. I created a new one with the Linux machine 
> name and port 22 and selected the newly created credential. When I click on 
> check connection, I am getting "Can't connect to server".  I had created 
> two other SSH remote hosts successfully. But this lone is not going through 
> and I am not sure how to track down the solution.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/72ae6f7e-fa54-4be5-add3-9337d70835d4%40googlegroups.com.


Jenkins docker not found

2020-02-05 Thread adrian lee
Hi all, 

I am trying to use docker with Jenkins. 

I installed it as a global toolconfiguration call myDocker. 

I then tried to write a pipeline script as below

```
pipeline {
   agent any

   // set path
   stages {
  stage ('set docker path'){
  steps{
  script{
  def dockerHome = tool 'myDocker'
  env.PATH = "${dockerHome}/bin:${env.PATH}"
  }
sh 'docker ps'
  }
  }

  //delete
  stage('node') {
agent {
docker { image 'node:7-alpine' }
}
steps {
sh 'node --version'
}
  }


   }
}
```

however, it keeps throwing me an error

```
+ docker ps
/var/lib/jenkins/workspace/openFaaS_getdata@tmp/durable-270f2b11/script.sh: 
line 1: docker: command not found

```

I tried referencing other posts on stack overflow but could not find what 
is wrong. 

Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2c4833ee-1210-4815-9b82-e4efb6f1f95f%40googlegroups.com.


Best Practices for Dockerfile in repository

2020-02-05 Thread Simon Richter
Hi,

Looking at https://jenkins.io/doc/book/pipeline/docker/#dockerfile , I've
set up a repository for our project with a Dockerfile to describe the build
environment, and a simple Jenkinsfile describing the build:

pipeline {
agent {
dockerfile true
}
stages {
stage('Build') {
steps {
sh 'make'
}
}
}
}

To make this build correctly, I had to install Docker CLI inside the
Jenkins container and give Jenkins access to control Docker.

The latter is kind of obvious, and Jenkins already had that access in order
to spawn agents as required, but I'm wondering if it makes sense to require
the Docker CLI, as I have to make sure it is present on whatever agent
builds the project, so the assertion in the documentation that it is only
Windows and MacOS agents that would have trouble running such a pipeline is
a bit bold.

I can certainly work around that, so I'm wondering what is the best
approach:

 - continue to build a derived image for Jenkins, adding the Docker CLI as
   a statically linked executable, and limit execution of Docker pipelines
   to master
 - set up a single agent that has the Docker CLI installed, give it an
   appropriate label, and use that
 - use the Docker cloud plugin to create agents on-demand that have the
   Docker CLI installed, and use these to build the pipeline (so a single
   build creates two containers).

There was a pull request[1] that eliminates the need for Docker CLI to run
a pipeline with 'agent { dockerfile true }', but it has been closed.

What would be the most sensible option to build a project like this from a
Jenkins instance that is itself running inside a Docker container?

Is there a readymade image of jenkins/jenkins:lts plus the Docker CLI, or
jenkinsci/slave:latest plus the Docker CLI, or do I have to build and
maintain these myself?

   Simon

[1] https://github.com/jenkinsci/docker-workflow-plugin/pull/195

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/20200205111953.GB6800%40psi5.com.