[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OpenShift Gitlab webhook Jenkins issues.





On Wed, Aug 23, 2017 at 8:52 AM, Thorvald Hallvardsson <thorvald hallvardsson gmail com> wrote:
Hi Ben,

Name:           nodejs-pipeline-master
Namespace:      jenkins
Created:        5 days ago
Labels:         app=nodejs-integration
Annotations:    pipeline.alpha.openshift.io/uses=[{"name": "nodejsci", "namespace": "", "kind": "DeploymentConfig"}]
Latest Version: 3

Strategy:               JenkinsPipeline
URL:                    http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git
Ref:                    manual
Jenkinsfile path:       Jenkinsfile

Build Run Policy:       Serial
Triggered by:           <none>
Webhook GitHub:
Webhook Generic:
        AllowEnv:       false

Build                           Status  Duration        Creation Time
nodejs-pipeline-master-3        failed  1s              2017-08-18 09:27:00 +0100 BST
nodejs-pipeline-master-2        failed  1s              2017-08-18 09:18:46 +0100 BST
nodejs-pipeline-master-1        failed  1m2s            2017-08-18 09:16:19 +0100 BST

No events.

JSON:
{
    "kind": "BuildConfig",
    "apiVersion": "v1",
    "metadata": {
        "name": "nodejs-pipeline-master",
        "creationTimestamp": null,
        "labels": {
            "app": "nodejs-integration"
        },
        "annotations": {
            "pipeline.alpha.openshift.io/uses": "[{\"name\": \"nodejsci\", \"namespace\": \"\", \"kind\": \"DeploymentConfig\"}]"
        }
    },
    "spec": {
        "triggers": [
            {
                "type": "GitHub",
                "github": {
                    "secret": "EgXVqyOOobmMzjVzQHSh"
                }
            },
            {
                "type": "Generic",
                "generic": {
                    "secret": "bz6uJc9u-0-58EoYKgL3"
                }
            }
        ],
        "runPolicy": "Serial",
        "source": {
            "type": "Git",
            "git": {
                "uri": "http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git",
                "ref": "manual"
            }
        },
        "strategy": {
            "type": "JenkinsPipeline",
            "jenkinsPipelineStrategy": {
                "jenkinsfilePath": "Jenkinsfile"
            }
        },
        "output": {},
        "resources": {},
        "postCommit": {},
        "nodeSelector": {}
    },
    "status": {
        "lastVersion": 0
    }
}

Failed build:
Name:           nodejs-pipeline-master-3
Namespace:      jenkins
Created:        5 days ago
Labels:         app=nodejs-integration
                buildconfig=nodejs-pipeline-master
                openshift.io/build.number=3
                openshift.io/jenkins-status-json={"_links":{"self":{"href":"https://jenkins-jenkins.os.hr4.local/job/jenkins-nodejs-pipeline-master/3/wfapi/describe"}},"id":"3","name":"#3","status":"NOT_EXECUTED","startTimeMillis":1503044820755,"endTimeMillis":0,"durationMillis":0,"queueDurationMillis":0,"pauseDurationMillis":0,"stages":[]}

Status:         Failed
Started:        Fri, 18 Aug 2017 09:27:00 BST
Duration:       1s
Build Config:   nodejs-pipeline-master
Build Pod:      nodejs-pipeline-master-3-build

Strategy:               JenkinsPipeline
URL:                    http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git
Ref:                    manual
Commit:                  ()
Jenkinsfile path:       Jenkinsfile

Build trigger cause:    GitHub WebHook
Commit:                  ()
Secret:                 EgXVqyOOob***

No events.


JSON:
{
    "kind": "Build",
    "apiVersion": "v1",
    "metadata": {
        "name": "nodejs-pipeline-master-3",
        "creationTimestamp": null,
        "labels": {
            "app": "nodejs-integration",
            "buildconfig": "nodejs-pipeline-master",
            "openshift.io/build-config.name": "nodejs-pipeline-master",
            "openshift.io/build.start-policy": "Serial"
        },
        "annotations": {
            "openshift.io/build-config.name": "nodejs-pipeline-master",
            "openshift.io/build.number": "3",
            "openshift.io/jenkins-status-json": "{\"_links\":{\"self\":{\"href\":\"https://jenkins-jenkins.os.hr4.local/job/jenkins-nodejs-pipeline-master/3/wfapi/describe\"}},\"id\":\"3\",\"name\":\"#3\",\"status\":\"NOT_EXECUTED\",\"startTimeMillis\":1503044820755,\"endTimeMillis\":0,\"durationMillis\":0,\"queueDurationMillis\":0,\"pauseDurationMillis\":0,\"stages\":[]}"
        }
    },
    "spec": {
        "serviceAccount": "builder",
        "source": {
            "type": "Git",
            "git": {
                "uri": "http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git",
                "ref": "manual"
            }
        },
        "revision": {
            "type": "Git",
            "git": {
                "author": {},
                "committer": {}
            }
        },
        "strategy": {
            "type": "JenkinsPipeline",
            "jenkinsPipelineStrategy": {
                "jenkinsfilePath": "Jenkinsfile"
            }
        },
        "output": {},
        "resources": {},
        "postCommit": {},
        "nodeSelector": {},
        "triggeredBy": [
            {
                "message": "GitHub WebHook",
                "githubWebHook": {
                    "revision": {
                        "type": "Git",
                        "git": {
                            "author": {},
                            "committer": {}
                        }
                    },

OK, the above snippet is the crux of things here, and lines up with the stack trace you are seeing on the jenkins side.  Essentially, the commit is
not getting retrieved from the gitlab webhook push event.

At this point, you should probably open an issue at https://github.com/openshift/origin and we can continue debug / resolution there.  Among
other things, if you could somehow get the contents of the gitlab push event json, that would be the most expedient means of determining what is
up.

Per the gitlab spec/version we are working off of, we would expect a push event to look something like https://github.com/openshift/origin/blob/master/pkg/build/webhook/gitlab/testdata/pushevent-not-master-branch.json

thanks
 
                    "secret": "EgXVqyOOob***"
                }
            }
        ]
    },
    "status": {
        "phase": "New",
        "config": {
            "name": "nodejs-pipeline-master"
        },
        "output": {}
    }
}

Thank you!


On 22 August 2017 at 15:27, Ben Parees <bparees redhat com> wrote:


On Tue, Aug 22, 2017 at 10:25 AM, Gabe Montero <gmontero redhat com> wrote:


On Mon, Aug 21, 2017 at 8:08 AM, Thorvald Hallvardsson <thorvald hallvardsson gmail com> wrote:
Hi Ben,

yes you got right understanding of my problem. 

There is no build associated yet, as it doesn't even get to the stage when it would fireup any build for the pipeline. It's literally a scond after sending the build task to Jenkins.... 

To tweak Ben's request slightly, can you provide the *buildconfig* json.  The precise structure of the gitlab webhook will most likely be helpful for us, especially
in comparison to the gitlab specs  and what the git plugin is spitting out.

Well, both the buildconfig and build.  What I want to see in the build object is what the revision information shows.  The gitlab webhook should have provided revision information to openshift which should have put that information into the BuildRequest which would have lead to that information being part of the Build object.

Assuming it's there, the next question is how the pipeline job in jenkins is intended to consume that revision information when cloning the repo to extract the Jenkinsfile.

Since we have two sources of git revision information in the build object, it's possible that one of them is being ignored by the sync plugin.

Thorvald, can you provide the buildconfig and build json from your openshift environment?

 

OpenShift version is 3.5. Jenkins sync plugin is 0.1.25. 

Regards,
TH


On 18 August 2017 at 21:56, Ben Parees <bparees redhat com> wrote:


On Fri, Aug 18, 2017 at 4:39 AM, Thorvald Hallvardsson <thorvald hallvardsson gmail com> wrote:
Hi,

I configured Gitlab webhook for my test pipeline to fire up a build. The problem is as soon as I commit something jenkins complains with an error below:

To make sure i understand your scenario, you've defined a pipeline buildconfig in openshift and enabled a gitlab webhook trigger to trigger the build?  (vs defining a gitlab trigger in jenkins itself).

 

OpenShift Build jenkins/nodejs-pipeline-master-3 from http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git
Checking out git http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git to read Jenkinsfile
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git # timeout=10
 > git --version # timeout=10
 > git fetch --tags --progress http://gitlab.os.hr4.local/jenkins/nodejs-ex-1.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse null^{commit} # timeout=10
hudson.plugins.git.GitException: Command "git rev-parse null^{commit}" returned status code 128:
stdout: null^{commit}

stderr: fatal: ambiguous argument 'null^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1799)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1772)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1768)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1415)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1427)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:686)
at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
at hudson.plugins.git.RevisionParameterAction.toRevision(RevisionParameterAction.java:98)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:991)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1108)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:130)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:59)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:232)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Finished: FAILURE

It works when I take generic webhook URL however it engages a build regardless of which branch I'm commiting the change to - which is no ideal.

Any ideas why commit number in the code above is null ?

can you share the build json associated w/ the build that was kicked off by the webhook trigger?

also what version of the openshift sync plugin are you running and what version is your openshift cluster?


 

Thanks
TH

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
Ben Parees | OpenShift



_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users





--
Ben Parees | OpenShift




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]