Hi all, I'm stuck trying to work on a master/agent setup, running on kubernetes.
I've watched the demonstration video ( https://www.youtube.com/watch?v=h4hKSXjCqyI) by Marky Jacksonm which helped me a ton. My issue is that when I try to run my test-job (the attached Jenkinsfile), it only seems to execute on the built in container: jenkins/jnlp-slave:4.0.1-1. I don't see that execution is handed over to my custom agent (the attached Dockerfile). I've attached the Jenkinsfile for the test-job, a redacted/amputated Dockerfile of my custom jenkins-agent, an example of the output of the test-job (job-output.txt), output taken from running the jenkins/jnlp-slave:4.0.1-1 image directly (jnlp-slave-4.0.1-1.info.txt), and my Kubernetes cloud configuration (Kubernetes-cloud-configuration.txt). Due to corporate non-disclosure, I've had to remove some parts, but I've replaced the relevant parts with "[...]" meaningful placeholders. Regards, Jon -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/ac3ba8f6-9a1d-46ef-ac46-67de125821ab%40googlegroups.com.
[Pipeline] Start of Pipeline [Pipeline] node Still waiting to schedule task ‘Jenkins’ doesn’t have label ‘inbound-agent’ Agent inbound-agent-73tq7 is provisioned from template inbound-agent --- apiVersion: "v1" kind: "Pod" metadata: labels: jenkins: "slave" jenkins/label: "inbound-agent" name: "inbound-agent-73tq7" spec: containers: - args: - "cat" command: - "/bin/sh" - "-c" image: "[CUSTOM JENKINS AGENT]" imagePullPolicy: "Always" name: "k8s-container-template-01" resources: limits: {} requests: {} securityContext: privileged: false tty: true volumeMounts: - mountPath: "/home/jenkins" name: "workspace-volume" readOnly: false workingDir: "/home/jenkins" - env: - name: "JENKINS_SECRET" value: "********" - name: "JENKINS_AGENT_NAME" value: "inbound-agent-73tq7" - name: "JENKINS_NAME" value: "inbound-agent-73tq7" - name: "JENKINS_AGENT_WORKDIR" value: "/home/jenkins/agent" - name: "JENKINS_URL" value: "http://10.244.2.6:8080/" image: "jenkins/jnlp-slave:4.0.1-1" name: "jnlp" resources: requests: cpu: "100m" memory: "256Mi" volumeMounts: - mountPath: "/home/jenkins/agent" name: "workspace-volume" readOnly: false hostNetwork: false nodeSelector: beta.kubernetes.io/os: "linux" restartPolicy: "Never" securityContext: {} serviceAccount: "jenkins" volumes: - emptyDir: medium: "" name: "workspace-volume" Running on inbound-agent-73tq7 in /home/jenkins/agent/workspace/ci-test_tool-versions_kubernetes [Pipeline] { [Pipeline] ansiColor [Pipeline] { [Pipeline] stage [Pipeline] { (info) [Pipeline] sh + pwd /home/jenkins/agent/workspace/ci-test_tool-versions_kubernetes [Pipeline] sh + ls -la total 8 drwxr-xr-x 2 jenkins jenkins 4096 May 26 04:48 . drwxr-xr-x 4 jenkins jenkins 4096 May 26 04:48 .. [Pipeline] sh + whoami jenkins [Pipeline] sh + echo inbound-agent-73tq7 inbound-agent-73tq7 [Pipeline] sh + export export AGENT_WORKDIR='/home/jenkins/agent' export BRANCH_NAME='kubernetes' export BUILD_DISPLAY_NAME='#6' export BUILD_ID='6' export BUILD_NUMBER='6' export BUILD_TAG='jenkins-jenkins-ci-test-tool-versions-kubernetes-6' export BUILD_URL='https://[JENKINS HOSTNAME]/job/jenkins-ci-test/job/tool-versions/job/kubernetes/6/' export EXECUTOR_NUMBER='0' export HOME='/home/jenkins' export HOSTNAME='inbound-agent-73tq7' export HUDSON_COOKIE='1f0b762f-da96-4278-9e2e-ba322983e400' export HUDSON_HOME='/var/jenkins_home' export HUDSON_SERVER_COOKIE='02ab1f383a78a006' export HUDSON_URL='https://[JENKINS HOSTNAME]/' export JAVA_BASE_URL='https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_' export JAVA_HOME='/usr/local/openjdk-8' export JAVA_URL_VERSION='8u242b08' export JAVA_VERSION='8u242' export JENKINS_AGENT_NAME='inbound-agent-73tq7' export JENKINS_AGENT_WORKDIR='/home/jenkins/agent' export JENKINS_HOME='/var/jenkins_home' export JENKINS_NAME='inbound-agent-73tq7' export JENKINS_NODE_COOKIE='29ff8057-4917-47ba-9f2c-8a665744e37f' export JENKINS_PORT='tcp://10.98.197.70:80' export JENKINS_PORT_80_TCP='tcp://10.98.197.70:80' export JENKINS_PORT_80_TCP_ADDR='10.98.197.70' export JENKINS_PORT_80_TCP_PORT='80' export JENKINS_PORT_80_TCP_PROTO='tcp' export JENKINS_SECRET='********' export JENKINS_SERVER_COOKIE='durable-a061d9e7b627258162a5da8a96448dfc' export JENKINS_SERVICE_HOST='10.98.197.70' export JENKINS_SERVICE_PORT='80' export JENKINS_URL='https://[JENKINS HOSTNAME]/' export JOB_BASE_NAME='kubernetes' export JOB_DISPLAY_URL='https://[JENKINS HOSTNAME]/job/jenkins-ci-test/job/tool-versions/job/kubernetes/display/redirect' export JOB_NAME='jenkins-ci-test/tool-versions/kubernetes' export JOB_URL='https://[JENKINS HOSTNAME]/job/jenkins-ci-test/job/tool-versions/job/kubernetes/' export KUBERNETES_PORT='tcp://10.96.0.1:443' export KUBERNETES_PORT_443_TCP='tcp://10.96.0.1:443' export KUBERNETES_PORT_443_TCP_ADDR='10.96.0.1' export KUBERNETES_PORT_443_TCP_PORT='443' export KUBERNETES_PORT_443_TCP_PROTO='tcp' export KUBERNETES_SERVICE_HOST='10.96.0.1' export KUBERNETES_SERVICE_PORT='443' export KUBERNETES_SERVICE_PORT_HTTPS='443' export LANG='C.UTF-8' export NODE_LABELS='inbound-agent inbound-agent-73tq7' export NODE_NAME='inbound-agent-73tq7' export PATH='/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' export PWD='/home/jenkins/agent/workspace/ci-test_tool-versions_kubernetes' export RUN_CHANGES_DISPLAY_URL='https://[JENKINS HOSTNAME]/job/jenkins-ci-test/job/tool-versions/job/kubernetes/6/display/redirect?page=changes' export RUN_DISPLAY_URL='https://[JENKINS HOSTNAME]/job/jenkins-ci-test/job/tool-versions/job/kubernetes/6/display/redirect' export STAGE_NAME='info' export TERM='xterm' export WORKSPACE='/home/jenkins/agent/workspace/ci-test_tool-versions_kubernetes'
# Kubernetes cloud configuration Name: kubernetes Kubernetes URL: https://[CORPORATE LOAD BALANCER]:6443 Kubernetes Namespace: jenkins Jenkins URL: http://[JENKINS MASTER POD IP ADDRESS]:8080 Pod Retention: Never # Pod Template configuration Name: inbound-agent Namespace: jenkins Labels: inbound-agent # Container Template Name: k8s-container-template-01 Docker Image: [COMPANY DOCKER REPOSITORY]/jenkins-agent Always Pull Image: true Working directory: /home/jenkins Command to run: /bin/sh -c Arguments to pass to the command: cat Allocate pseudo-TTY: true Show raw yaml in console: true Service Account: jenkins
Dockerfile
Description: Binary data
Jenkinsfile
Description: Binary data
docker run -it --rm --entrypoint /bin/bash [COMPANY DOCKER REPOSITORY]/jenkins/jnlp-slave:4.0.1-1 Digest: sha256:30732bbe8afbe63652b2903d308ba405b16290d81a08688b75a51a6e0f1b4087 Status: Downloaded newer image for artifactory.topdanmark.local:5001/jenkins/jnlp-slave:4.0.1-1 jenkins@6c1645b567db:~$ export declare -x AGENT_WORKDIR="/home/jenkins/agent" declare -x HOME="/home/jenkins" declare -x HOSTNAME="6c1645b567db" declare -x JAVA_BASE_URL="https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_" declare -x JAVA_HOME="/usr/local/openjdk-8" declare -x JAVA_URL_VERSION="8u242b08" declare -x JAVA_VERSION="8u242" declare -x LANG="C.UTF-8" declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:" declare -x OLDPWD declare -x PATH="/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" declare -x PWD="/home/jenkins" declare -x SHLVL="1" declare -x TERM="xterm" jenkins@6c1645b567db:~$ whoami jenkins