Jenkins JNLP slave is stuck on progress bar when need to run Maven job

4/15/2019

I have a problem with my Jenkins which runs on K8s. My Pipeline is built with 2 pods - Jnlp alpine (default for k8s) and Maven (3.6.0 based on java-8:jdk-8u191-slim image). From time to time, after staring a new build it's getting stuck with no progress with the Build.

Entering the Pod:

Jnlp - seems to be functioning as expected

Maven - no job is running (running ps -ef).

Appreciate your help.

Tried to pause / resume - not solve it. The only way is abort and reinitiate the build.

Jenkins version - 2.164.1

enter image description here

My pipeline is :

properties([[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], 
    parameters([string(defaultValue: 'master', description: '', name: 'branch', trim: false),
    string(description: 'enter your namespace name', name: 'namespace', trim: false),])])

    def label = "jenkins-slave-${UUID.randomUUID().toString()}"

    podTemplate(label: label, namespace: "${params.namespace}", yaml: """
    apiVersion: v1
    kind: Pod
    spec:
      nodeSelector:
        group: maven-ig
      containers:
      - name: maven
        image: accontid.dkr.ecr.us-west-2.amazonaws.com/base_images:maven-base
        command: ['cat']
        resources:
          limits:
            memory: "16Gi"
            cpu: "16"
          requests:
            memory: "10Gi"
            cpu: "10"
        tty: true
        env:
        - name: ENVIRONMENT
          value: dev
        - name: config.env
          value: k8s
        - mountPath: "/local"
          name: nvme 
      volumes:
        - name: docker
          hostPath:
           path: /var/run/docker.sock
        - name: nvme
          hostPath:
           path: /local

    """
      ) {

      node(label) {
        wrap([$class: 'TimestamperBuildWrapper']) {
        checkout([$class: 'GitSCM', branches: [[name: "*/${params.branch}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'credetials', url: 'https://github.com/example/example.git']]])
        wrap([$class: 'BuildUser']) {
            user = env.BUILD_USER_ID
        }
        currentBuild.description = 'Branch: ' + "${branch}" + '  | Namespace: ' + "${user}"
        stage('Stable tests') {
          container('maven') {
             try {
                sh "find . -type f -name '*k8s.*ml' | xargs sed -i -e 's|//mysql|//mysql.${user}.svc.cluster.local|g'"
                sh "mvn -f pom.xml -Dconfig.env=k8s -Dwith_stripe_stub=true -Dpolicylifecycle.integ.test.url=http://testlifecycleservice-${user}.testme.io -Dmaven.test.failure.ignore=false -Dskip.surefire.tests=true -Dmaven.test.skip=false -Dskip.package.for.deployment=true -T 1C clean verify -fn -P stg-stable-it"
            }
            finally {
                archive "**/target/failsafe-reports/*.xml"
                junit '**/target/failsafe-reports/*.xml'
                }
            }
            }
       // stage ('Delete namespace') {
    //    build job: 'delete-namspace', parameters: [
     //       [$class: 'StringParameterValue', name: 'namespace', value: "${user}"]], wait: false
      //      }
        }
      }
    }
-- Roee Rakovsky
jenkins
jnlp
kubernetes
maven
progress-bar

0 Answers