Reflecting the cause of a build by user when triggered from API




  • Avatar

    Hi Brett,

    I tried reproducing this issue on 2.1 and it seems to work just fine. Can you please confirm the http status code issued to the curl based API call? 

    AFAIR curl does not retun non-zero exit status for non 20X http-response status, so unless you are explicitly checking the return code, it may actually swallow the problem silently.

    I mean, it may have so happened that, even though the script tried to trigger it, pipeline was probably auto-triggered, and script invocation didn't fail because curl process terminated just fine(inspite of receiving a non 20X response as schedule failed because another instance of first stage was active).

    If you have the console dump of API call script, that may lead us in the right direction. Usually the server posts the reason for rejecting schedule request in response-body.

    However, this potential problem can be ruled out by making first stage othis pipeline manual.


    Comment actions Permalink
  • Avatar
    Brett Cave

    Hi Janmejay,

    stage is automatic (as we want upstream pipelines to trigger it). However, the only svn material for the pipeline has autoUpdate set to false - i.e. Go does not poll SVN and therefore will not by triggered by commits.

    I am using the output from Go to determine if the scheduling was successful:

        SR_SCHED_OK="Request to schedule pipeline $JOB accepted"
        SR_SCHED_ERR="Failed to trigger pipeline: $JOB"
        RES=`$CURL $CURL_OPTS -u $GO_USER:$GO_PASS -d 'materials[svn_material]=$REVISION' -- $GO_BASE/pipelines/$JOB/schedule`
        if [ "x$RES" == "x$SR_SCHED_OK" ]; then
            echo "Success"

    i.e. the output from Go is "Request to schedule pipeline $MYPIPELINE accepted"

    Besides the upstream pipeline (which only triggers less than 1 in 15 of this pipeline), the only trigger to this is the API call. The view in the image is from /go/tab/pipeline/history/PipelineName

    If I go into a pipeline instance -> stage -> job, I see the following in the header section: Build cause: triggered by "ABC"

    ABC is either hte committer or the upstream pipeline.

    Comment actions Permalink

Please sign in to leave a comment.