Re: kubernetes-plugin: logging output

2017-03-29 Thread 'Sascha Vujevic' via Jenkins Users
Also the problem with this execution is that

cd "/home/jenkins/workspace/slave-test-npm"


makes a

dir('') {
// some block
}

not working.

Am Freitag, 24. März 2017 12:45:00 UTC+1 schrieb Sascha Vujevic:
>
> Hello developers,
>
> we use the kubernetes-plugin to produce slaves in Jenkins.
>
> In the logfile we can see following output:
>
> *12:38:52* [slave-test-npm] Running shell script
> *12:38:52* Executing shell script inside container [npm] of pod 
> [kubernetes-cfebda342f4349e9a12bb07ff3b1db8c-9801f82825b9f]
> *12:38:52* Executing command: sh -c echo $$ > 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/pid'; 
> jsc=durable-0cd0becdd66e2d5e1c287736e0acaf0b; JENKINS_SERVER_COOKIE=$jsc 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/script.sh' > 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-log.txt' 
> 2>&1; echo $? > 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-result.txt'
>  
> *12:38:52* sh: scl_source: No such file or directory
> *12:38:52*  [?1034hsh-4.2$ *cd **"/home/jenkins/workspace/slave-test-npm"*
> *12:38:52* sh-4.2$ sh -c echo $$ > 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc33 
> 9069/pid'; jsc=durable-0cd0becdd66e2d5e1c287736e0acaf0b; 
> JENKINS_SERVER_COOKIE=$ 
> jsc '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/script.sh' > 
> '/ 
> home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-log.txt' 
> 2>&1 
> ; echo $? > 
> '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins 
> -result.txt' 
>
>
> Could this output be avoided ?
>
> Thanks for your support.
>
> Best regards
>   Sascha
>

-- 
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/915cc816-020d-4502-81c8-f203aac962e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


kubernetes-plugin: logging output

2017-03-24 Thread 'Sascha Vujevic' via Jenkins Users
Hello developers,

we use the kubernetes-plugin to produce slaves in Jenkins.

In the logfile we can see following output:

*12:38:52* [slave-test-npm] Running shell script
*12:38:52* Executing shell script inside container [npm] of pod 
[kubernetes-cfebda342f4349e9a12bb07ff3b1db8c-9801f82825b9f]
*12:38:52* Executing command: sh -c echo $$ > 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/pid'; 
jsc=durable-0cd0becdd66e2d5e1c287736e0acaf0b; JENKINS_SERVER_COOKIE=$jsc 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/script.sh' > 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-log.txt' 
2>&1; echo $? > 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-result.txt'
 
*12:38:52* sh: scl_source: No such file or directory
*12:38:52*  [?1034hsh-4.2$ cd "/home/jenkins/workspace/slave-test-npm"
*12:38:52* sh-4.2$ sh -c echo $$ > 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc33 
9069/pid'; jsc=durable-0cd0becdd66e2d5e1c287736e0acaf0b; 
JENKINS_SERVER_COOKIE=$ 
jsc '/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/script.sh' > 
'/ 
home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins-log.txt' 
2>&1 
; echo $? > 
'/home/jenkins/workspace/slave-test-npm@tmp/durable-fc339069/jenkins 
-result.txt' 


Could this output be avoided ?

Thanks for your support.

Best regards
  Sascha

-- 
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/26ca196f-5b16-4d2e-b924-9aee3a098996%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: kubernetes-plugin: containertemplate with shell-script in entrypoint

2017-03-17 Thread 'Sascha Vujevic' via Jenkins Users
Thank you for the fast answer.

How can i achive the long running process ?

I set 'exec "$@"' in my shellscript for my entrypoint. Isn't this wright ?

Maybe you have an advice.

Thank you.

Am Freitag, 17. März 2017 12:46:27 UTC+1 schrieb Carlos Sanchez:

>
>
> On Fri, Mar 17, 2017 at 12:40 PM, 'Sascha Vujevic' via Jenkins Users <
> jenkins...@googlegroups.com > wrote:
>
>> Hello developers,
>>
>> i don't know if i use the kubernetes-plugin correct:
>> My jenkinsfile looks like:
>>
>> podTemplate(label: 'mypod', containers: [
>> containerTemplate(name: 'maven', image: 'myOwnMavenImage:latest'', 
>> ttyEnabled: true, command: 'cat')
>>   ]) {
>>
>> node ('mypod') {
>> stage 'Get a Maven project'
>> git 'https://github.com/jenkinsci/kubernetes-plugin.git'
>> container('maven') {
>> stage 'Build a Maven project'
>> sh 'mvn clean install'
>> }
>> }
>> }
>>
>>
>> My Dockerfile uses a script-file as entrypoint:
>>
>>
>> *run-script:*
>>
>>
>> export JENKINS_HOME=/var/lib/jenkins
>>
>> # Setup nss_wrapper so the random user OpenShift will run this container
>> # has an entry in /etc/passwd.
>> # This is needed for 'git' and other tools to work properly.
>> #
>> export USER_ID=$(id -u)
>> export GROUP_ID=$(id -g)
>> envsubst < ${JENKINS_HOME}/passwd.template > ${JENKINS_HOME}/passwd
>> export LD_PRELOAD=libnss_wrapper.so
>> export NSS_WRAPPER_PASSWD=${JENKINS_HOME}/passwd
>> export NSS_WRAPPER_GROUP=/etc/group
>>
>> exec "$@"
>>
>>
>> *dockerfile:*
>>
>>
>> FROM openjdk8:stable
>>
>> ENV MAVEN_HOME /usr/share/maven
>> ENV M2_HOME /usr/share/maven
>> ENV JENKINS_HOME=/var/lib/jenkins
>>
>> COPY ./contrib/.m2 $JENKINS_HOME/.m2/
>> COPY ./contrib/maven $M2_HOME
>> COPY ./contrib/fix-permissions /usr/local/bin/fix-permissions
>> COPY ./contrib/passwd.template $JENKINS_HOME/passwd.template
>> COPY ./contrib/run /var/lib/jenkins/run
>>
>> USER root
>>
>> RUN yum-config-manager --disable epel >/dev/null || : && \
>> yum-config-manager --enable rhel-7-server-ose-3.3-rpms || : && \
>> INSTALL_PKGS="nss_wrapper gettext git lsof rsync tar unzip which zip" 
>> && \
>> yum install -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
>> rpm -V $INSTALL_PKGS && \
>> yum clean all
>> 
>> RUNlocaledef -f UTF-8 -i en_US en_US.UTF-8
>> RUNln -s $M2_HOME/bin/mvn /usr/bin/mvn
>> RUNchmod a+x /usr/local/bin/fix-permissions
>> RUNchown -R 1001:0 $M2_HOME
>> RUNchmod 775 $M2_HOME/bin/*
>> RUN/usr/local/bin/fix-permissions $M2_HOME/bin
>> 
>> RUN chown -R 1001:0 $JENKINS_HOME && \
>> chmod -R g+rw $JENKINS_HOME
>>
>> USER 1001
>>
>> ENTRYPOINT ["/var/lib/jenkins/run"]
>>
>> If i start the jenkins-job the pod is started with the jnlp- and the 
>> maven-container, but my shellscript in the maven-container is not used. I 
>> think thats because i use a cmd in the containertemplate of the 
>> maven-container.
>>
>>
>> If i delete the cmd an set tty to 'false' the shellskript is used but the 
>> container stops after executing the shell-skript in the maven-container.
>>
>>
>> Is there a posibility to have a long-running process in a container with 
>> executing a shell-script in the entrypoint of a container ?
>>
>
> yes, don't use 'cmd' in the pod template so your entrypoint is executed. 
> Your entrypoint has to be long-running, the container needs to be running 
> all time until pod is killed
>
>>
>> Thank you for your 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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/7f2d3e30-0409-4ddc-a8a5-159987246b16%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/7f2d3e30-0409-4ddc-a8a5-159987246b16%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/ffdff072-4a45-43a6-a45d-e3e6d6968175%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


kubernetes-plugin: containertemplate with shell-script in entrypoint

2017-03-17 Thread &#x27;Sascha Vujevic&#x27; via Jenkins Users
Hello developers,

i don't know if i use the kubernetes-plugin correct:
My jenkinsfile looks like:

podTemplate(label: 'mypod', containers: [
containerTemplate(name: 'maven', image: 'myOwnMavenImage:latest'', 
ttyEnabled: true, command: 'cat')
  ]) {

node ('mypod') {
stage 'Get a Maven project'
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
container('maven') {
stage 'Build a Maven project'
sh 'mvn clean install'
}
}
}


My Dockerfile uses a script-file as entrypoint:


*run-script:*


export JENKINS_HOME=/var/lib/jenkins

# Setup nss_wrapper so the random user OpenShift will run this container
# has an entry in /etc/passwd.
# This is needed for 'git' and other tools to work properly.
#
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
envsubst < ${JENKINS_HOME}/passwd.template > ${JENKINS_HOME}/passwd
export LD_PRELOAD=libnss_wrapper.so
export NSS_WRAPPER_PASSWD=${JENKINS_HOME}/passwd
export NSS_WRAPPER_GROUP=/etc/group

exec "$@"


*dockerfile:*


FROM openjdk8:stable

ENV MAVEN_HOME /usr/share/maven
ENV M2_HOME /usr/share/maven
ENV JENKINS_HOME=/var/lib/jenkins

COPY ./contrib/.m2 $JENKINS_HOME/.m2/
COPY ./contrib/maven $M2_HOME
COPY ./contrib/fix-permissions /usr/local/bin/fix-permissions
COPY ./contrib/passwd.template $JENKINS_HOME/passwd.template
COPY ./contrib/run /var/lib/jenkins/run

USER root

RUN yum-config-manager --disable epel >/dev/null || : && \
yum-config-manager --enable rhel-7-server-ose-3.3-rpms || : && \
INSTALL_PKGS="nss_wrapper gettext git lsof rsync tar unzip which zip" && 
\
yum install -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
yum clean all

RUNlocaledef -f UTF-8 -i en_US en_US.UTF-8
RUNln -s $M2_HOME/bin/mvn /usr/bin/mvn
RUNchmod a+x /usr/local/bin/fix-permissions
RUNchown -R 1001:0 $M2_HOME
RUNchmod 775 $M2_HOME/bin/*
RUN/usr/local/bin/fix-permissions $M2_HOME/bin

RUN chown -R 1001:0 $JENKINS_HOME && \
chmod -R g+rw $JENKINS_HOME

USER 1001

ENTRYPOINT ["/var/lib/jenkins/run"]

If i start the jenkins-job the pod is started with the jnlp- and the 
maven-container, but my shellscript in the maven-container is not used. I 
think thats because i use a cmd in the containertemplate of the 
maven-container.


If i delete the cmd an set tty to 'false' the shellskript is used but the 
container stops after executing the shell-skript in the maven-container.


Is there a posibility to have a long-running process in a container with 
executing a shell-script in the entrypoint of a container ?


Thank you for your 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/7f2d3e30-0409-4ddc-a8a5-159987246b16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.