sclorg / nodejs-ex

node.js example
Apache License 2.0
367 stars 9.12k forks source link

Jenkins build failed #273

Open sadiqhabib opened 1 year ago

sadiqhabib commented 1 year ago

Container platform

OCP 4

Version

No response

OS version of the container image

Fedora

Bugzilla, Jira

No response

Description

OpenShift Build nodeapp-1/nodejs-sample-pipeline-1
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
‘nodejs-0r836’ is offline
Agent nodejs-0r836 is provisioned from template nodejs
---
apiVersion: "v1"
kind: "Pod"
metadata:
  labels:
    jenkins: "slave"
    jenkins/label-digest: "9690950bf78d69049eb916154c609783fd2ed40d"
    jenkins/label: "nodejs"
  name: "nodejs-0r836"
spec:
  containers:
  - args:
    - "********"
    - "nodejs-0r836"
    env:
    - name: "JENKINS_SECRET"
      value: "********"
    - name: "JENKINS_TUNNEL"
      value: "172.30.189.36:50000"
    - name: "JENKINS_AGENT_NAME"
      value: "nodejs-0r836"
    - name: "JENKINS_NAME"
      value: "nodejs-0r836"
    - name: "JENKINS_AGENT_WORKDIR"
      value: "/tmp"
    - name: "JENKINS_URL"
      value: "http://172.30.217.93:80/"
    image: "image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest"
    imagePullPolicy: "Always"
    name: "jnlp"
    resources:
      limits: {}
      requests: {}
    tty: false
    volumeMounts:
    - mountPath: "/tmp"
      name: "workspace-volume"
      readOnly: false
    workingDir: "/tmp"
  nodeSelector:
    kubernetes.io/os: "linux"
  restartPolicy: "Never"
  serviceAccountName: "jenkins"
  volumes:
  - emptyDir:
      medium: ""
    name: "workspace-volume"

Running on nodejs-0r836 in /tmp/workspace/nodeapp-1/nodeapp-1-nodejs-sample-pipeline
[Pipeline] {
[Pipeline] timeout
Timeout set to expire in 20 min
[Pipeline] {
[Pipeline] stage
[Pipeline] { (preamble)
[Pipeline] script
[Pipeline] {
[Pipeline] echo

[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] echo
Using project: nodeapp-1
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (cleanup)
[Pipeline] script
[Pipeline] {
[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (create)
[Pipeline] script
[Pipeline] {
[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (build)
Stage "build" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy)
Stage "deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (tag)
Stage "tag" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'w' with an int value of 119
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
warning: Cannot check if git requires authentication.
^
    at groovy.json.internal.JsonParserCharArray.decodeValueInternal(JsonParserCharArray.java:206)
    at groovy.json.internal.JsonParserCharArray.decodeValue(JsonParserCharArray.java:157)
    at groovy.json.internal.JsonParserCharArray.decodeFromChars(JsonParserCharArray.java:46)
    at groovy.json.internal.JsonParserCharArray.parse(JsonParserCharArray.java:384)
    at groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:112)
    at groovy.json.JsonSlurper.parseText(JsonSlurper.java:205)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    at com.openshift.jenkins.plugins.OpenShiftDSL.serializableMap(OpenShiftDSL.groovy:541)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
    at com.openshift.jenkins.plugins.OpenShiftDSL.newAppAction(OpenShiftDSL.groovy:930)
    at com.openshift.jenkins.plugins.OpenShiftDSL.newApp(OpenShiftDSL.groovy:949)
    at WorkflowScript.run(WorkflowScript:43)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy:407)
    at com.openshift.jenkins.plugins.OpenShiftDSL$Context.run(OpenShiftDSL.groovy:134)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy:406)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(OpenShiftDSL.groovy)
    at WorkflowScript.run(WorkflowScript:42)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:378)
    at com.openshift.jenkins.plugins.OpenShiftDSL$Context.run(OpenShiftDSL.groovy:134)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:377)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:395)
    at com.openshift.jenkins.plugins.OpenShiftDSL.node(OpenShiftDSL.groovy:1823)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy:382)
    at com.openshift.jenkins.plugins.OpenShiftDSL.withCluster(OpenShiftDSL.groovy)
    at WorkflowScript.run(WorkflowScript:41)
    at ___cps.transform___(Native Method)
    at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:90)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:116)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:85)
    at jdk.internal.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:75)
    at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
    at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:65)
    at jdk.internal.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
    at com.cloudbees.groovy.cps.Next.step(Next.java:83)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:158)
    at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:152)
    at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
    at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
    at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:152)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
    at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
    at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:420)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:95)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:330)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:294)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
    at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE

Reproducer

kind: "BuildConfig"
apiVersion: "build.openshift.io/v1"
metadata:
  name: "nodejs-sample-pipeline"
spec:
  strategy:
    type: JenkinsPipeline
    jenkinsPipelineStrategy:
      jenkinsfile: |-
        def templatePath = 'https://raw.githubusercontent.com/openshift/nodejs-ex/master/openshift/templates/nodejs-mongodb.json'
        def templateName = 'nodejs-mongodb-example'
        pipeline {
          agent {
            node {
              label 'nodejs'
            }
          }
          options {
            timeout(time: 20, unit: 'MINUTES')
          }
          stages {
            stage('preamble') {
                steps {
                    script {
                        openshift.withCluster() {
                            openshift.withProject() {
                                echo "Using project: ${openshift.project()}"
                            }
                        }
                    }
                }
            }
            stage('cleanup') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.selector("all", [ template : templateName ]).delete() 
                          if (openshift.selector("secrets", templateName).exists()) { 
                            openshift.selector("secrets", templateName).delete()
                          }
                        }
                    }
                }
              }
            }
            stage('create') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.newApp(templatePath) 
                        }
                    }
                }
              }
            }
            stage('build') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          def builds = openshift.selector("bc", templateName).related('builds')
                          timeout(5) { 
                            builds.untilEach(1) {
                              return (it.object().status.phase == "Complete")
                            }
                          }
                        }
                    }
                }
              }
            }
            stage('deploy') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          def rm = openshift.selector("dc", templateName).rollout()
                          timeout(5) { 
                            openshift.selector("dc", templateName).related('pods').untilEach(1) {
                              return (it.object().status.phase == "Running")
                            }
                          }
                        }
                    }
                }
              }
            }
            stage('tag') {
              steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                          openshift.tag("${templateName}:latest", "${templateName}-staging:latest") 
                        }
                    }
                }
              }
            }
          }
        }