Re: k8s plugin

2019-12-03 Thread David Karlsen
It would be super useful agent and templates could come from workflow
libraries so that they could be shared

man. 2. des. 2019, 17:16 skrev Carlos Sanchez :

> No, It has to live in the same repo
>
> On Mon, Dec 2, 2019, 16:39 YD  wrote:
>
>> Hi all
>>
>> in kubernetes plugin i want to use yaml that i managed in my git server
>> (public repo)
>>
>> does something like that should work ?
>>
>> pipeline {
>>   agent  {
>> kubernetes
>>   {
>>  yamlFile  '/someyaml.yaml'
>> }
>>   }
>>
>> if not what are my options for using yamlFile method
>>
>> thanks
>> Yair
>>
>> --
>> 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/fa6504d9-6371-4b20-a5f0-a8a8448896b2%40googlegroups.com
>> 
>> .
>>
> --
> 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/CALHFn6PTmC6R4sZ%3DeKrs-6mL9LExPb6-SaO9US9uRApbWVS5Kg%40mail.gmail.com
> 
> .
>

-- 
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/CAGO7Ob1oCL-LLQBzvx%2B9GZkXQgjxfchn2BxTEFGmEws66tBT3g%40mail.gmail.com.


Re: k8s plugin

2019-12-03 Thread Carlos Sanchez
Yes, but

 yamlFile  './k8s/someyaml.yaml'

On Tue, Dec 3, 2019 at 11:41 AM YD  wrote:

> thanks Carlos , it did work fine when i copy the file (someyaml.yaml) to
> the root  of the repo
> can i put the file in some folder (same repo) and use something like below
> pipeline {
>   agent  {
> kubernetes
> {
>  yamlFile  '/k8s/someyaml.yaml'
> }
>   }
>
> On Monday, December 2, 2019 at 6:16:03 PM UTC+2, Carlos Sanchez wrote:
>>
>> No, It has to live in the same repo
>>
>> On Mon, Dec 2, 2019, 16:39 YD  wrote:
>>
>>> Hi all
>>>
>>> in kubernetes plugin i want to use yaml that i managed in my git server
>>> (public repo)
>>>
>>> does something like that should work ?
>>>
>>> pipeline {
>>>   agent  {
>>> kubernetes
>>>   {
>>>  yamlFile  '/someyaml.yaml'
>>> }
>>>   }
>>>
>>> if not what are my options for using yamlFile method
>>>
>>> thanks
>>> Yair
>>>
>>> --
>>> 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 jenkins...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/fa6504d9-6371-4b20-a5f0-a8a8448896b2%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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/0834c862-095b-4828-ac9b-76cf6d87ecde%40googlegroups.com
> 
> .
>

-- 
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/CALHFn6OWX-Pbo_z10uMMFgx%2BPKX%2BY9yjNN_O9%3D%2BENN0iy3HuMg%40mail.gmail.com.


Re: k8s plugin

2019-12-03 Thread YD
thanks Carlos , it did work fine when i copy the file (someyaml.yaml) to 
the root  of the repo 
can i put the file in some folder (same repo) and use something like below
pipeline {
  agent  {
kubernetes
{  
 yamlFile  '/k8s/someyaml.yaml'
}
  }

On Monday, December 2, 2019 at 6:16:03 PM UTC+2, Carlos Sanchez wrote:
>
> No, It has to live in the same repo 
>
> On Mon, Dec 2, 2019, 16:39 YD > wrote:
>
>> Hi all 
>>
>> in kubernetes plugin i want to use yaml that i managed in my git server 
>> (public repo) 
>>
>> does something like that should work ?
>>
>> pipeline {
>>   agent  {
>> kubernetes
>>   {
>>  yamlFile  '/someyaml.yaml'
>> }
>>   }
>>
>> if not what are my options for using yamlFile method 
>>
>> thanks 
>> Yair
>>
>> -- 
>> 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 jenkins...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/fa6504d9-6371-4b20-a5f0-a8a8448896b2%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/0834c862-095b-4828-ac9b-76cf6d87ecde%40googlegroups.com.


Re: k8s plugin

2019-12-02 Thread Carlos Sanchez
No, It has to live in the same repo

On Mon, Dec 2, 2019, 16:39 YD  wrote:

> Hi all
>
> in kubernetes plugin i want to use yaml that i managed in my git server
> (public repo)
>
> does something like that should work ?
>
> pipeline {
>   agent  {
> kubernetes
>   {
>  yamlFile  '/someyaml.yaml'
> }
>   }
>
> if not what are my options for using yamlFile method
>
> thanks
> Yair
>
> --
> 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/fa6504d9-6371-4b20-a5f0-a8a8448896b2%40googlegroups.com
> 
> .
>

-- 
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/CALHFn6PTmC6R4sZ%3DeKrs-6mL9LExPb6-SaO9US9uRApbWVS5Kg%40mail.gmail.com.


k8s plugin

2019-12-02 Thread YD
Hi all 

in kubernetes plugin i want to use yaml that i managed in my git server 
(public repo) 

does something like that should work ?

pipeline {
  agent  {
kubernetes
  {
 yamlFile  '/someyaml.yaml'
}
  }

if not what are my options for using yamlFile method 

thanks 
Yair

-- 
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/fa6504d9-6371-4b20-a5f0-a8a8448896b2%40googlegroups.com.


Re: On-prem k8s cluster and k8s plugin

2019-07-18 Thread Ben Rich
Have a look at 
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod

You can assign a securityContext for the pod as such:

securityContext:
  fsGroup: 1000




On Thursday, May 23, 2019 at 7:27:07 PM UTC-4, Quang Truong wrote:
>
> Hi,
>
> I start working with k8s and my working environment is the on-prem so I 
> try to build the on-prem k8s via kubeadm and calico cni:
>
>
> http://www.centinosystems.com/blog/sql/getting-started-with-kubernetes-on-prem/
> https://docs.projectcalico.org/v3.7/getting-started/kubernetes/
>
> I try to configure the service account for k8s plugin and run a simple 
> test but not sure which part I have done wrong the 1st run (when first 
> download the image to the cluster) the jnlp pod will use jenkins user
>
> + id
> uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
> + ls -lh /home/jenkins
> total 8
> drwxr-sr-x2 jenkins  jenkins 4.0K Apr 29 11:54 agent
> drwxr-xr-x3 jenkins  jenkins 4.0K May 23 22:45 workspace
>
>
> But from the second, when the image is on the machine then the pod will 
> run with root user
>
> + id uid=0(root) gid=0(root) 
> groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
>  
>
> + ls -lh /home/jenkins 
>
> total 8 
>
> drwxr-sr-x 2 jenkins jenkins 4.0K Apr 29 11:54 agent 
>
> drwxr-xr-x 3 root root 4.0K May 23 22:45 workspace
>
>
> Here is the pod describe
>
> Name:   builder-0322cb0d-37be-438d-949c-fce0149039e5-5c743-
> 2830b
> Namespace:  default
> Priority:   0
> PriorityClassName:  
> Node:   /
> Start Time: Thu, 23 May 2019 16:18:00 -0700
> Labels: jenkins=slave
> jenkins/builder-0322cb0d-37be-438d-949c-fce0149039e5=
> true
> Annotations:buildUrl: 
> cni.projectcalico.org/podIP: 192.168.243.226/32
> Status: Running
> IP: 192.168.243.226
> Containers:
>   jnlp:
> Container ID:   docker:
> //325602117ce4b0df6ef1d73e44ed7426251a0ea801990c065bce993e9af25cb4
> Image:  jenkins/jnlp-slave:alpine
> Image ID:   docker-pullable:
> //jenkins/jnlp-slave@sha256:3c4227433a1bbd070b250d491bdee1696e6c163cff8a470df9c848da94306693
> Port:   
> Host Port:  
> State:  Running
>   Started:  Thu, 23 May 2019 16:18:02 -0700
> Ready:  True
> Restart Count:  0
> Environment:
>   JENKINS_SECRET:  <*my_jenkins_secret*>
>   JENKINS_AGENT_NAME:  builder-0322cb0d-37be-438d-949c-fce0149039e5-
> 5c743-2830b
>   JENKINS_NAME:builder-0322cb0d-37be-438d-949c-fce0149039e5-
> 5c743-2830b
>   JENKINS_URL: 
>   HOME:/home/jenkins
> Mounts:
>   /home/jenkins from workspace-volume (rw)
>   /var/run/secrets/kubernetes.io/serviceaccount from default-token-tmzcc 
> (ro)
> Conditions:
>   Type  Status
>   Initialized   True 
>   Ready True 
>   ContainersReady   True 
>   PodScheduled  True 
> Volumes:
>   workspace-volume:
> Type:   EmptyDir (a temporary directory that shares a pod's 
> lifetime)
> Medium: 
> SizeLimit:  
>   default-token-tmzcc:
> Type:Secret (a volume populated by a Secret)
> SecretName:  default-token-tmzcc
> Optional:false
> QoS Class:   BestEffort
> Node-Selectors:  
> Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
>  node.kubernetes.io/unreachable:NoExecute for 300s
> Events:
>   TypeReason Age   From   Message
>   --      ---
>   Normal  Scheduled  30s   default-scheduler  Successfully assigned 
> default/builder-0322cb0d-37be-438d-949c-fce0149039e5-5c743-2830b to <>
>   Normal  Pulled 28s   kubelet, ubuntuContainer image 
> "jenkins/jnlp-slave:alpine" already present on machine
>   Normal  Created28s   kubelet, ubuntuCreated container jnlp
>   Normal  Started28s   kubelet, ubuntuStarted container jnlp
>
>
>
>
> I'm not sure where the problem is, from my k8s cluster or configuration 
> for jenkins connection, what should be the troubleshooting steps
>
> Any comments will be helped, much appreciate on reading my issue.
>
> Thanks,
> Quang
>
>
>

-- 
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/4aa3fc5c-04fa-4eff-92c0-3092fa737a8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Intermittent authorization issue with the Jenkins k8s plugin & EKS

2019-07-18 Thread Andres Galindo
Think I found the issue, I had a much older version of the kube plugin 
installed and since then, client caching was introduced, I am applying the 
fix found here: https://github.com/jenkinsci/kubernetes-plugin/pull/429

On Thursday, July 18, 2019 at 9:41:24 AM UTC-4, Andres Galindo wrote:
>
> Hi all, 
>
>
> Currently we're using EKS (v1.13) with Jenkins (v2.176.1) and the 
> Kubernetes plugin (v1.17.2) and it seems like every 15 minutes (coincides 
> with how long the generated token is supposed last) there is an issue with 
> authorizing against the cluster. 
>
>
> Here is the error message: 
> https://gist.githubusercontent.com/mrferos/b193bbf1a2753d63dfbf17334f19168d/raw/cfa73e64594d172f72c1838b2364d554cdc9a97e/error.txt
>
>
> Here is the kubeconfig we have saved as a credential: 
> https://gist.githubusercontent.com/mrferos/fc7ee471a59caca0bca94242e7983911/raw/71a0a287923eca2e2050dcff5c25d39eb307ad6c/config.yaml
>
>
> I was hoping someone had some experience with the above issue or some 
> insight as to where I should look into next?
>
>
> Cheers,
>
> Andres.
>
>
> P.S. will do the 2.176.2 security update soon, just want to get this issue 
> figured out first.
>

-- 
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/448664ad-cf07-41d0-9e44-f95b2c26b5d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Intermittent authorization issue with the Jenkins k8s plugin & EKS

2019-07-18 Thread Andres Galindo


Hi all, 


Currently we're using EKS (v1.13) with Jenkins (v2.176.1) and the 
Kubernetes plugin (v1.17.2) and it seems like every 15 minutes (coincides 
with how long the generated token is supposed last) there is an issue with 
authorizing against the cluster. 


Here is the error message: 
https://gist.githubusercontent.com/mrferos/b193bbf1a2753d63dfbf17334f19168d/raw/cfa73e64594d172f72c1838b2364d554cdc9a97e/error.txt


Here is the kubeconfig we have saved as a credential: 
https://gist.githubusercontent.com/mrferos/fc7ee471a59caca0bca94242e7983911/raw/71a0a287923eca2e2050dcff5c25d39eb307ad6c/config.yaml


I was hoping someone had some experience with the above issue or some 
insight as to where I should look into next?


Cheers,

Andres.


P.S. will do the 2.176.2 security update soon, just want to get this issue 
figured out first.

-- 
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/c958a362-6577-4653-924e-d3146349220b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


On-prem k8s cluster and k8s plugin

2019-05-23 Thread Quang Truong
Hi,

I start working with k8s and my working environment is the on-prem so I try 
to build the on-prem k8s via kubeadm and calico cni:

http://www.centinosystems.com/blog/sql/getting-started-with-kubernetes-on-prem/
https://docs.projectcalico.org/v3.7/getting-started/kubernetes/

I try to configure the service account for k8s plugin and run a simple test 
but not sure which part I have done wrong the 1st run (when first download 
the image to the cluster) the jnlp pod will use jenkins user

+ id
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
+ ls -lh /home/jenkins
total 8
drwxr-sr-x2 jenkins  jenkins 4.0K Apr 29 11:54 agent
drwxr-xr-x3 jenkins  jenkins 4.0K May 23 22:45 workspace


But from the second, when the image is on the machine then the pod will run 
with root user

+ id uid=0(root) gid=0(root) 
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
 

+ ls -lh /home/jenkins 

total 8 

drwxr-sr-x 2 jenkins jenkins 4.0K Apr 29 11:54 agent 

drwxr-xr-x 3 root root 4.0K May 23 22:45 workspace


Here is the pod describe

Name:   builder-0322cb0d-37be-438d-949c-fce0149039e5-5c743-2830b
Namespace:  default
Priority:   0
PriorityClassName:  
Node:   /
Start Time: Thu, 23 May 2019 16:18:00 -0700
Labels: jenkins=slave
jenkins/builder-0322cb0d-37be-438d-949c-fce0149039e5=
true
Annotations:buildUrl: 
cni.projectcalico.org/podIP: 192.168.243.226/32
Status: Running
IP: 192.168.243.226
Containers:
  jnlp:
Container ID:   docker:
//325602117ce4b0df6ef1d73e44ed7426251a0ea801990c065bce993e9af25cb4
Image:  jenkins/jnlp-slave:alpine
Image ID:   docker-pullable:
//jenkins/jnlp-slave@sha256:3c4227433a1bbd070b250d491bdee1696e6c163cff8a470df9c848da94306693
Port:   
Host Port:  
State:  Running
  Started:  Thu, 23 May 2019 16:18:02 -0700
Ready:  True
Restart Count:  0
Environment:
  JENKINS_SECRET:  <*my_jenkins_secret*>
  JENKINS_AGENT_NAME:  builder-0322cb0d-37be-438d-949c-fce0149039e5-
5c743-2830b
  JENKINS_NAME:builder-0322cb0d-37be-438d-949c-fce0149039e5-
5c743-2830b
  JENKINS_URL: 
  HOME:/home/jenkins
Mounts:
  /home/jenkins from workspace-volume (rw)
  /var/run/secrets/kubernetes.io/serviceaccount from default-token-tmzcc 
(ro)
Conditions:
  Type  Status
  Initialized   True 
  Ready True 
  ContainersReady   True 
  PodScheduled  True 
Volumes:
  workspace-volume:
Type:   EmptyDir (a temporary directory that shares a pod's 
lifetime)
Medium: 
SizeLimit:  
  default-token-tmzcc:
Type:Secret (a volume populated by a Secret)
SecretName:  default-token-tmzcc
Optional:false
QoS Class:   BestEffort
Node-Selectors:  
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  TypeReason Age   From   Message
  --      ---
  Normal  Scheduled  30s   default-scheduler  Successfully assigned 
default/builder-0322cb0d-37be-438d-949c-fce0149039e5-5c743-2830b to <>
  Normal  Pulled 28s   kubelet, ubuntuContainer image 
"jenkins/jnlp-slave:alpine" already present on machine
  Normal  Created28s   kubelet, ubuntuCreated container jnlp
  Normal  Started28s   kubelet, ubuntuStarted container jnlp




I'm not sure where the problem is, from my k8s cluster or configuration for 
jenkins connection, what should be the troubleshooting steps

Any comments will be helped, much appreciate on reading my issue.

Thanks,
Quang


-- 
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/93755219-2dc3-481a-b6a6-d0812dfc2945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-09-18 Thread Jan Monterrubio
I don’t have any more ideas since I haven’t played with containers much :(

Feels like the NPM command is not being ran on the container. Does it work
if you remove the NPM stuff?

On Mon, Sep 17, 2018 at 03:57 Blau Gil  wrote:

> Hi Jan,
>
> Thank you for assisting.
> Yes the container runs on its own, only when I try to run the container
> image with Jenkins it fails.
>
> Any idea what I can do to resolve this?
>
> Thanks,
> --Gil.
>
> On Thu, 23 Aug 2018 at 04:04, Jan Monterrubio 
> wrote:
>
>> Does the container work on its own?
>>
>> Looks like you have this part in the container:
>>
>> "RUN apk add --no-cache --virtual .gyp \
>> python \
>> make \
>> g++ \
>> git \
>> && npm install --quit && npm cache clean --force \
>> && apk del .gyp"
>>
>> Which runs npm install
>>
>> On Wed, Aug 22, 2018 at 6:08 AM gil  wrote:
>>
>>> Anyone?
>>>
>>> On Sunday, 12 August 2018 11:28:54 UTC+3, gil wrote:

 Trying to tun a podTemaplate with the following containerTemplate, we
 get the following error:

 npm ERR! path /home/jenkins/package.json
 npm ERR! code ENOENT
 npm ERR! errno -2
 npm ERR! syscall open
 npm ERR! enoent ENOENT: no such file or directory, open
 '/home/jenkins/package.json'
 npm ERR! enoent This is related to npm not being able to find a file.
 npm ERR! enoent

 npm ERR! A complete log of this run can be found in:
 npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log



 Configurations:

 Jenkinsfile PodTemplate:


 deftestpod="testpod-${UUID.randomUUID().toString()}"
 podTemplate(label: testpod, containers: [
 containerTemplate(
 name: 'myContainer',
 image: 'gcr.io/xxx/xxxs/zzz:latest',
 alwaysPullImage: true
 )],
 volumes: [
 hostPathVolume(hostPath: '/var/run/docker.sock', mountPath:
 '/var/run/docker.sock')
 ])
 {
 try{
 node(testpod) {
 stage ("checkout") {
 container('myContainer')
 { checkout scm }

 }
 ...

 zzz dockerfile:

 FROM node:8.9.4-alpine
 RUN mkdir -p /usr/src/app

 WORKDIR /usr/src/app

 COPY package.json /usr/src/app/
 ARG NODE_ENV
 ENV NODE_ENV $NODE_ENV

1. Add packages needed to build native dependencies
RUN apk add --no-cache --virtual .gyp \
python \
make \
g++ \
git \
&& npm install --quit && npm cache clean --force \
&& apk del .gyp

 RUN apk add --no-cache vim curl
 COPY . .

 EXPOSE 
 CMD [ "npm", "start"]


 *

 /home/jenkins is mounted as a volume

 1. Why this mounted volume effects the container?

 2. Does the plugin do anything besides "docker run "? I am
 asking this because I don't understand why it is running "nmp install"...

 3. Can you please suggest how can this be fixed?


 FYI -

 If I add a working directory to the containerTemplate I get the same
 error with the working directory path:

 working directory configuration:
 workingDir: '/usr/src/app',


 Err msg:

 kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
 npm ERR! path /usr/src/app/package.json
 npm ERR! code ENOENT
 npm ERR! errno -2
 npm ERR! syscall open
 npm ERR! enoent ENOENT: no such file or directory, open
 '/usr/src/app/package.json'
 npm ERR! enoent This is related to npm not being able to find a file.
 npm ERR! enoent



 --
>>> 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/eaaf1ea1-698a-4712-9776-95a3ecea46d0%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>>
> You received this message because you are subscribed to a topic in the
>> Google Groups "Jenkins Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/jenkinsci-users/mauO_28wUOI/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/CADgiF9KsvXCcFr2vfuE%3DUVR5EcNBrivVmQnUc-rK%3DJ8upviRRg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You 

Re: Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-09-17 Thread Blau Gil
Hi Jan,

Thank you for assisting.
Yes the container runs on its own, only when I try to run the container
image with Jenkins it fails.

Any idea what I can do to resolve this?

Thanks,
--Gil.

On Thu, 23 Aug 2018 at 04:04, Jan Monterrubio 
wrote:

> Does the container work on its own?
>
> Looks like you have this part in the container:
>
> "RUN apk add --no-cache --virtual .gyp \
> python \
> make \
> g++ \
> git \
> && npm install --quit && npm cache clean --force \
> && apk del .gyp"
>
> Which runs npm install
>
> On Wed, Aug 22, 2018 at 6:08 AM gil  wrote:
>
>> Anyone?
>>
>> On Sunday, 12 August 2018 11:28:54 UTC+3, gil wrote:
>>>
>>> Trying to tun a podTemaplate with the following containerTemplate, we
>>> get the following error:
>>>
>>> npm ERR! path /home/jenkins/package.json
>>> npm ERR! code ENOENT
>>> npm ERR! errno -2
>>> npm ERR! syscall open
>>> npm ERR! enoent ENOENT: no such file or directory, open
>>> '/home/jenkins/package.json'
>>> npm ERR! enoent This is related to npm not being able to find a file.
>>> npm ERR! enoent
>>>
>>> npm ERR! A complete log of this run can be found in:
>>> npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log
>>>
>>>
>>>
>>> Configurations:
>>>
>>> Jenkinsfile PodTemplate:
>>>
>>>
>>> deftestpod="testpod-${UUID.randomUUID().toString()}"
>>> podTemplate(label: testpod, containers: [
>>> containerTemplate(
>>> name: 'myContainer',
>>> image: 'gcr.io/xxx/xxxs/zzz:latest',
>>> alwaysPullImage: true
>>> )],
>>> volumes: [
>>> hostPathVolume(hostPath: '/var/run/docker.sock', mountPath:
>>> '/var/run/docker.sock')
>>> ])
>>> {
>>> try{
>>> node(testpod) {
>>> stage ("checkout") {
>>> container('myContainer')
>>> { checkout scm }
>>>
>>> }
>>> ...
>>>
>>> zzz dockerfile:
>>>
>>> FROM node:8.9.4-alpine
>>> RUN mkdir -p /usr/src/app
>>>
>>> WORKDIR /usr/src/app
>>>
>>> COPY package.json /usr/src/app/
>>> ARG NODE_ENV
>>> ENV NODE_ENV $NODE_ENV
>>>
>>>1. Add packages needed to build native dependencies
>>>RUN apk add --no-cache --virtual .gyp \
>>>python \
>>>make \
>>>g++ \
>>>git \
>>>&& npm install --quit && npm cache clean --force \
>>>&& apk del .gyp
>>>
>>> RUN apk add --no-cache vim curl
>>> COPY . .
>>>
>>> EXPOSE 
>>> CMD [ "npm", "start"]
>>>
>>>
>>> *
>>>
>>> /home/jenkins is mounted as a volume
>>>
>>> 1. Why this mounted volume effects the container?
>>>
>>> 2. Does the plugin do anything besides "docker run "? I am
>>> asking this because I don't understand why it is running "nmp install"...
>>>
>>> 3. Can you please suggest how can this be fixed?
>>>
>>>
>>> FYI -
>>>
>>> If I add a working directory to the containerTemplate I get the same
>>> error with the working directory path:
>>>
>>> working directory configuration:
>>> workingDir: '/usr/src/app',
>>>
>>>
>>> Err msg:
>>>
>>> kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
>>> npm ERR! path /usr/src/app/package.json
>>> npm ERR! code ENOENT
>>> npm ERR! errno -2
>>> npm ERR! syscall open
>>> npm ERR! enoent ENOENT: no such file or directory, open
>>> '/usr/src/app/package.json'
>>> npm ERR! enoent This is related to npm not being able to find a file.
>>> npm ERR! enoent
>>>
>>>
>>>
>>> --
>> 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/eaaf1ea1-698a-4712-9776-95a3ecea46d0%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/mauO_28wUOI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CADgiF9KsvXCcFr2vfuE%3DUVR5EcNBrivVmQnUc-rK%3DJ8upviRRg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAAwzALub0_bitNaXdSWF6BaO7t6tGycRTwfvDYbFGy27g3Praw%40mail.gmail.com.
For more options, visit 

Re: Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-08-27 Thread gil blau
Hi Jan,

Thank you for assisting.
Yes the container runs on its own, only when I try to run the container
image with Jenkins it fails.

Any idea what I can do to resolve this?

Thanks,
--Gil.

On 23 August 2018 at 04:03, Jan Monterrubio 
wrote:

> Does the container work on its own?
>
> Looks like you have this part in the container:
>
> "RUN apk add --no-cache --virtual .gyp \
> python \
> make \
> g++ \
> git \
> && npm install --quit && npm cache clean --force \
> && apk del .gyp"
>
> Which runs npm install
>
> On Wed, Aug 22, 2018 at 6:08 AM gil  wrote:
>
>> Anyone?
>>
>> On Sunday, 12 August 2018 11:28:54 UTC+3, gil wrote:
>>>
>>> Trying to tun a podTemaplate with the following containerTemplate, we
>>> get the following error:
>>>
>>> npm ERR! path /home/jenkins/package.json
>>> npm ERR! code ENOENT
>>> npm ERR! errno -2
>>> npm ERR! syscall open
>>> npm ERR! enoent ENOENT: no such file or directory, open
>>> '/home/jenkins/package.json'
>>> npm ERR! enoent This is related to npm not being able to find a file.
>>> npm ERR! enoent
>>>
>>> npm ERR! A complete log of this run can be found in:
>>> npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log
>>>
>>>
>>>
>>> Configurations:
>>>
>>> Jenkinsfile PodTemplate:
>>>
>>>
>>> deftestpod="testpod-${UUID.randomUUID().toString()}"
>>> podTemplate(label: testpod, containers: [
>>> containerTemplate(
>>> name: 'myContainer',
>>> image: 'gcr.io/xxx/xxxs/zzz:latest',
>>> alwaysPullImage: true
>>> )],
>>> volumes: [
>>> hostPathVolume(hostPath: '/var/run/docker.sock', mountPath:
>>> '/var/run/docker.sock')
>>> ])
>>> {
>>> try{
>>> node(testpod) {
>>> stage ("checkout") {
>>> container('myContainer')
>>> { checkout scm }
>>>
>>> }
>>> ...
>>>
>>> zzz dockerfile:
>>>
>>> FROM node:8.9.4-alpine
>>> RUN mkdir -p /usr/src/app
>>>
>>> WORKDIR /usr/src/app
>>>
>>> COPY package.json /usr/src/app/
>>> ARG NODE_ENV
>>> ENV NODE_ENV $NODE_ENV
>>>
>>>1. Add packages needed to build native dependencies
>>>RUN apk add --no-cache --virtual .gyp \
>>>python \
>>>make \
>>>g++ \
>>>git \
>>>&& npm install --quit && npm cache clean --force \
>>>&& apk del .gyp
>>>
>>> RUN apk add --no-cache vim curl
>>> COPY . .
>>>
>>> EXPOSE 
>>> CMD [ "npm", "start"]
>>>
>>>
>>> *
>>>
>>> /home/jenkins is mounted as a volume
>>>
>>> 1. Why this mounted volume effects the container?
>>>
>>> 2. Does the plugin do anything besides "docker run "? I am
>>> asking this because I don't understand why it is running "nmp install"...
>>>
>>> 3. Can you please suggest how can this be fixed?
>>>
>>>
>>> FYI -
>>>
>>> If I add a working directory to the containerTemplate I get the same
>>> error with the working directory path:
>>>
>>> working directory configuration:
>>> workingDir: '/usr/src/app',
>>>
>>>
>>> Err msg:
>>>
>>> kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
>>> npm ERR! path /usr/src/app/package.json
>>> npm ERR! code ENOENT
>>> npm ERR! errno -2
>>> npm ERR! syscall open
>>> npm ERR! enoent ENOENT: no such file or directory, open
>>> '/usr/src/app/package.json'
>>> npm ERR! enoent This is related to npm not being able to find a file.
>>> npm ERR! enoent
>>>
>>>
>>>
>>> --
>> 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/eaaf1ea1-698a-4712-9776-
>> 95a3ecea46d0%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-users/mauO_28wUOI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CADgiF9KsvXCcFr2vfuE%3DUVR5EcNBrivVmQnUc-rK%
> 3DJ8upviRRg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAAwzALv_E3wkGy8%3DRyXrdgWEw50vt5dsdHSActS7TDoNspuaYA%40mail.gmail.com.
For more options, 

Re: Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-08-22 Thread Jan Monterrubio
Does the container work on its own?

Looks like you have this part in the container:

"RUN apk add --no-cache --virtual .gyp \
python \
make \
g++ \
git \
&& npm install --quit && npm cache clean --force \
&& apk del .gyp"

Which runs npm install

On Wed, Aug 22, 2018 at 6:08 AM gil  wrote:

> Anyone?
>
> On Sunday, 12 August 2018 11:28:54 UTC+3, gil wrote:
>>
>> Trying to tun a podTemaplate with the following containerTemplate, we get
>> the following error:
>>
>> npm ERR! path /home/jenkins/package.json
>> npm ERR! code ENOENT
>> npm ERR! errno -2
>> npm ERR! syscall open
>> npm ERR! enoent ENOENT: no such file or directory, open
>> '/home/jenkins/package.json'
>> npm ERR! enoent This is related to npm not being able to find a file.
>> npm ERR! enoent
>>
>> npm ERR! A complete log of this run can be found in:
>> npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log
>>
>>
>>
>> Configurations:
>>
>> Jenkinsfile PodTemplate:
>>
>>
>> deftestpod="testpod-${UUID.randomUUID().toString()}"
>> podTemplate(label: testpod, containers: [
>> containerTemplate(
>> name: 'myContainer',
>> image: 'gcr.io/xxx/xxxs/zzz:latest',
>> alwaysPullImage: true
>> )],
>> volumes: [
>> hostPathVolume(hostPath: '/var/run/docker.sock', mountPath:
>> '/var/run/docker.sock')
>> ])
>> {
>> try{
>> node(testpod) {
>> stage ("checkout") {
>> container('myContainer')
>> { checkout scm }
>>
>> }
>> ...
>>
>> zzz dockerfile:
>>
>> FROM node:8.9.4-alpine
>> RUN mkdir -p /usr/src/app
>>
>> WORKDIR /usr/src/app
>>
>> COPY package.json /usr/src/app/
>> ARG NODE_ENV
>> ENV NODE_ENV $NODE_ENV
>>
>>1. Add packages needed to build native dependencies
>>RUN apk add --no-cache --virtual .gyp \
>>python \
>>make \
>>g++ \
>>git \
>>&& npm install --quit && npm cache clean --force \
>>&& apk del .gyp
>>
>> RUN apk add --no-cache vim curl
>> COPY . .
>>
>> EXPOSE 
>> CMD [ "npm", "start"]
>>
>>
>> *
>>
>> /home/jenkins is mounted as a volume
>>
>> 1. Why this mounted volume effects the container?
>>
>> 2. Does the plugin do anything besides "docker run "? I am
>> asking this because I don't understand why it is running "nmp install"...
>>
>> 3. Can you please suggest how can this be fixed?
>>
>>
>> FYI -
>>
>> If I add a working directory to the containerTemplate I get the same
>> error with the working directory path:
>>
>> working directory configuration:
>> workingDir: '/usr/src/app',
>>
>>
>> Err msg:
>>
>> kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
>> npm ERR! path /usr/src/app/package.json
>> npm ERR! code ENOENT
>> npm ERR! errno -2
>> npm ERR! syscall open
>> npm ERR! enoent ENOENT: no such file or directory, open
>> '/usr/src/app/package.json'
>> npm ERR! enoent This is related to npm not being able to find a file.
>> npm ERR! enoent
>>
>>
>>
>> --
> 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/eaaf1ea1-698a-4712-9776-95a3ecea46d0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADgiF9KsvXCcFr2vfuE%3DUVR5EcNBrivVmQnUc-rK%3DJ8upviRRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-08-22 Thread gil
Anyone?

On Sunday, 12 August 2018 11:28:54 UTC+3, gil wrote:
>
> Trying to tun a podTemaplate with the following containerTemplate, we get 
> the following error:
>
> npm ERR! path /home/jenkins/package.json
> npm ERR! code ENOENT
> npm ERR! errno -2
> npm ERR! syscall open
> npm ERR! enoent ENOENT: no such file or directory, open 
> '/home/jenkins/package.json'
> npm ERR! enoent This is related to npm not being able to find a file.
> npm ERR! enoent
>
> npm ERR! A complete log of this run can be found in:
> npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log
>
>  
>
> Configurations:
>
> Jenkinsfile PodTemplate:
>
>  
> deftestpod="testpod-${UUID.randomUUID().toString()}"
> podTemplate(label: testpod, containers: [
> containerTemplate(
> name: 'myContainer',
> image: 'gcr.io/xxx/xxxs/zzz:latest',
> alwaysPullImage: true
> )],
> volumes: [
> hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: 
> '/var/run/docker.sock')
> ])
> {
> try{
> node(testpod) {
> stage ("checkout") {
> container('myContainer')
> { checkout scm }
>
> }
> ...
>  
> zzz dockerfile:
>
> FROM node:8.9.4-alpine
> RUN mkdir -p /usr/src/app
>
> WORKDIR /usr/src/app
>
> COPY package.json /usr/src/app/
> ARG NODE_ENV
> ENV NODE_ENV $NODE_ENV
>
>1. Add packages needed to build native dependencies
>RUN apk add --no-cache --virtual .gyp \
>python \
>make \
>g++ \
>git \
>&& npm install --quit && npm cache clean --force \
>&& apk del .gyp
>
> RUN apk add --no-cache vim curl
> COPY . .
>
> EXPOSE 
> CMD [ "npm", "start"]
>
>
> *
>
> /home/jenkins is mounted as a volume
>
> 1. Why this mounted volume effects the container?
>
> 2. Does the plugin do anything besides "docker run "? I am 
> asking this because I don't understand why it is running "nmp install"...
>
> 3. Can you please suggest how can this be fixed?
>
>
> FYI - 
>
> If I add a working directory to the containerTemplate I get the same error 
> with the working directory path:
>
> working directory configuration:
> workingDir: '/usr/src/app',
>  
>
> Err msg:
>
> kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
> npm ERR! path /usr/src/app/package.json
> npm ERR! code ENOENT
> npm ERR! errno -2
> npm ERR! syscall open
> npm ERR! enoent ENOENT: no such file or directory, open 
> '/usr/src/app/package.json'
> npm ERR! enoent This is related to npm not being able to find a file.
> npm ERR! enoent
>
>
>
>

-- 
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/eaaf1ea1-698a-4712-9776-95a3ecea46d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins K8s plugin - PodTemplate fails to create a Nodejs container

2018-08-12 Thread gil blau
Trying to tun a podTemaplate with the following containerTemplate, we get
the following error:

npm ERR! path /home/jenkins/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/home/jenkins/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jenkins/.npm/_logs/2018-07-18T10_27_32_822Z-debug.log



Configurations:

Jenkinsfile PodTemplate:


deftestpod="testpod-${UUID.randomUUID().toString()}"
podTemplate(label: testpod, containers: [
containerTemplate(
name: 'myContainer',
image: 'gcr.io/xxx/xxxs/zzz:latest',
alwaysPullImage: true
)],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath:
'/var/run/docker.sock')
])
{
try{
node(testpod) {
stage ("checkout") {
container('myContainer')
{ checkout scm }

}
...

zzz dockerfile:

FROM node:8.9.4-alpine
RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY package.json /usr/src/app/
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV

   1. Add packages needed to build native dependencies
   RUN apk add --no-cache --virtual .gyp \
   python \
   make \
   g++ \
   git \
   && npm install --quit && npm cache clean --force \
   && apk del .gyp

RUN apk add --no-cache vim curl
COPY . .

EXPOSE 
CMD [ "npm", "start"]


*

/home/jenkins is mounted as a volume

1. Why this mounted volume effects the container?

2. Does the plugin do anything besides "docker run "? I am
asking this because I don't understand why it is running "nmp install"...

3. Can you please suggest how can this be fixed?


FYI -

If I add a working directory to the containerTemplate I get the same error
with the working directory path:

working directory configuration:
workingDir: '/usr/src/app',


Err msg:

kubectl logs -f -c workers jenkins-slave-4tfz2-3nw6d -n jenkins
npm ERR! path /usr/src/app/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open
'/usr/src/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

-- 
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/CAAwzALu%3DxZBENYMbbfgxN_9%3Dfp3gU8P-hk9wpasXrMHj3EWHVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.