web-dev-qa-db-ja.com

Jenkinsインスタンスがありません

GKEでJenkinsを使用してCI/CDを実装するためにGCPでクイックラボを作成しようとしています。Multibranch Pipelineを作成しました。変更したスクリプトをgitにプッシュすると、Jenkinsがビルドを開始し、次のエラーで失敗します。

    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
3
Andre12

この問題は修正されました。 Google Authenticated Sourceプラグインをバージョン0.4に更新してください。

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

1
viglesiasce

クイックラボを実行すると、同じ問題が発生しました。

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

私の状況では、何らかの理由で「Kubernetesサービスアカウント」の認証情報が表示されないように思われ、追加しようとすると、「secret-text」という名前のグローバル認証情報が提供されます...かどうかは不明です根本的な原因、あなたは同じ状況に遭遇しますか?

pS qwiklabではなく、GKEクラスターで実行しています。

1
user12232194