Jenkins instance is missing

10/8/2019

I'm trying to create a quicklab on GCP to implement CI/CD with Jenkins on GKE, I created a Multibranch Pipeline. When I push the modified script to git, Jenkins kicks off a build and fails with the following error:

    Branch indexing
     > git rev-parse --is-inside-work-tree # timeout=10
    Setting origin to https://source.developers.google.com/p/qwiklabs-gcp-gcpd-502b5f86f641/r/default
     > git config remote.origin.url https://source.developers.google.com/p/qwiklabs-gcp-gcpd-502b5f86f641/r/default # timeout=10
    Fetching origin...
    Fetching upstream changes from origin
     > git --version # timeout=10
     > git config --get remote.origin.url # timeout=10
    using GIT_ASKPASS to set credentials qwiklabs-gcp-gcpd-502b5f86f641
     > git fetch --tags --progress -- origin +refs/heads/*:refs/remotes/origin/*
    Seen branch in repository origin/master
    Seen branch in repository origin/new-feature
    Seen 2 remote branches
    Obtained Jenkinsfile from 4bbac0573482034d73cee17fa3de8999b9d47ced
    Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] Start of Pipeline
    [Pipeline] podTemplate
    [Pipeline] {
    [Pipeline] node
    Still waiting to schedule task
    Waiting for next available executor
    Agent sample-app-f7hdx-n3wfx is provisioned from template Kubernetes Pod Template
    ---
    apiVersion: "v1"
    kind: "Pod"
    metadata:
      annotations:
        buildUrl: "http://cd-jenkins:8080/job/sample-app/job/new-feature/1/"
      labels:
        jenkins: "slave"
        jenkins/sample-app: "true"
      name: "sample-app-f7hdx-n3wfx"
    spec:
      containers:
      - command:
        - "cat"
        image: "gcr.io/cloud-builders/kubectl"
        name: "kubectl"
        tty: true
        volumeMounts:
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
      - command:
        - "cat"
        image: "gcr.io/cloud-builders/gcloud"
        name: "gcloud"
        tty: true
        volumeMounts:
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
      - command:
        - "cat"
        image: "golang:1.10"
        name: "golang"
        tty: true
        volumeMounts:
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
      - env:
        - name: "JENKINS_SECRET"
          value: "********"
        - name: "JENKINS_TUNNEL"
          value: "cd-jenkins-agent:50000"
        - name: "JENKINS_AGENT_NAME"
          value: "sample-app-f7hdx-n3wfx"
        - name: "JENKINS_NAME"
          value: "sample-app-f7hdx-n3wfx"
        - name: "JENKINS_AGENT_WORKDIR"
          value: "/home/jenkins/agent"
        - name: "JENKINS_URL"
          value: "http://cd-jenkins:8080/"
        image: "jenkins/jnlp-slave:alpine"
        name: "jnlp"
        volumeMounts:
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
      nodeSelector: {}
      restartPolicy: "Never"
      serviceAccountName: "cd-jenkins"
      volumes:
      - emptyDir: {}
        name: "workspace-volume"

    Running on sample-app-f7hdx-n3wfx in /home/jenkins/agent/workspace/sample-app_new-feature
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (Declarative: Checkout SCM)
    [Pipeline] checkout
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] }
    [Pipeline] // podTemplate
    [Pipeline] End of Pipeline
    java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are
doing wrong.
      at jenkins.model.Jenkins.get(Jenkins.java:772)
      at hudson.model.Hudson.getInstance(Hudson.java:77)
      at com.google.jenkins.plugins.source.GoogleRobotUsernamePassword.areOnMaster(GoogleRobotUsernamePassword.java:146)
      at com.google.jenkins.plugins.source.GoogleRobotUsernamePassword.readObject(GoogleRobotUsernamePassword.java:180)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1975)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1567)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2211)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
      at hudson.remoting.UserRequest.deserialize(UserRequest.java:290)
      at hudson.remoting.UserRequest.perform(UserRequest.java:189)
    Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.8.2.12/10.8.2.12:53086
          at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
          at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
          at hudson.remoting.Channel.call(Channel.java:957)
          at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:283)
          at com.sun.proxy.$Proxy88.addCredentials(Unknown Source)
          at org.jenkinsci.plugins.gitclient.RemoteGitImpl.addCredentials(RemoteGitImpl.java:200)
          at hudson.plugins.git.GitSCM.createClient(GitSCM.java:845)
          at hudson.plugins.git.GitSCM.createClient(GitSCM.java:813)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
          at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
          at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          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)
    Caused: java.lang.Error: Failed to deserialize the Callable object.
      at hudson.remoting.UserRequest.perform(UserRequest.java:195)
      at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      at hudson.remoting.Request$2.run(Request.java:369)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      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 hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:97)
    Caused: java.io.IOException: Remote call on JNLP4-connect connection from 10.8.2.12/10.8.2.12:53086 failed
      at hudson.remoting.Channel.call(Channel.java:963)
      at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:283)
    Caused: hudson.remoting.RemotingSystemException
      at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:299)
      at com.sun.proxy.$Proxy88.addCredentials(Unknown Source)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl.addCredentials(RemoteGitImpl.java:200)
      at hudson.plugins.git.GitSCM.createClient(GitSCM.java:845)
      at hudson.plugins.git.GitSCM.createClient(GitSCM.java:813)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      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)
    Finished: FAILURE
-- Andre12
git
google-cloud-platform
jenkins
kubernetes
kubernetes-helm

2 Answers

10/17/2019

I got the same issue as well ... when running the quick lab.

https://cloud.google.com/solutions/continuous-delivery-jenkins-kubernetes-engine

For my situation, I suspect for some reason, the credential for "Kubernetes Service account" seems not shown up, and when I try to add one, it give global credentials with name "secret-text" ... not sure if it is the root cause, do you encounter the same situation ?

p.s. I am running on my GKE cluster, not qwiklab.

-- user12232194
Source: StackOverflow

10/23/2019

This issue has now been fixed. Please update the Google Authenticated Source Plugin to version 0.4.

https://github.com/jenkinsci/google-source-plugin/pull/9

-- viglesiasce
Source: StackOverflow