[JIRA] [git-plugin] (JENKINS-34363) Environment variable not set on git notifyCommit

10 views
Skip to first unread message

jani.makela@pp3.inet.fi (JIRA)

unread,
Apr 21, 2016, 3:52:02 AM4/21/16
to jenkinsc...@googlegroups.com
Jani Mäkelä created an issue
 
Jenkins / Bug JENKINS-34363
Environment variable not set on git notifyCommit
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-plugin
Created: 2016/Apr/21 7:51 AM
Environment: Jenkins ver. 1.642.4
Git-plugin 2.4.4
Priority: Minor Minor
Reporter: Jani Mäkelä

Passing parameters to git/notifyCommit not setting environment variables.

I have setup a parametrised build with the string parameter 'desc', doing

`curl -s jenkinsurl?url=giturl\&desc=description`

does not however set the environemnt variable, it's still using the default.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

jani.makela@pp3.inet.fi (JIRA)

unread,
Apr 21, 2016, 3:59:02 AM4/21/16
to jenkinsc...@googlegroups.com
Jani Mäkelä updated an issue
Change By: Jani Mäkelä
Passing parameters to git/notifyCommit not setting environment variables.

I have setup a parametrised build with the string parameter 'desc', doing

` {{ curl -s jenkinsurl?url=giturl\&desc=description ` }}

does not however set the environemnt variable, it's still using the default.
Add Comment Add Comment
 

mark.earl.waite@gmail.com (JIRA)

unread,
Apr 21, 2016, 6:11:09 AM4/21/16
to jenkinsc...@googlegroups.com
Mark Waite resolved as Won't Fix
 

That is the expected behavior with the notifyCommit syntax you used. The notifyCommit call (without a sha1=xxx parameter) does not schedule a build, it schedules polling of the repository to see if something is waiting to be built.

If you want to pass parameters to a build, please use

http://server/job/myjob/buildWithParameters?PARAMETER=Value
Change By: Mark Waite
Status: Open Resolved
Resolution: Won't Fix

evadeflow@gmail.com (JIRA)

unread,
Jan 10, 2017, 1:56:01 PM1/10/17
to jenkinsc...@googlegroups.com

> If you want to pass parameters to a build, please use: http://server/job/myjob/buildWithParameters?PARAMETER=Value

I'm confused. Using the buildWithParameters endpoint is an unsatisfactory solution because it requires authentication, which simply isn't required in many environments. And this link:

claims that it's possible to pass parameters via notifyCommit, provided you set the Jenkins system property hudson.model.ParametersAction.safeParameters to a comma-separated list of parameters that should be allowed to pass through.

> The notifyCommit call (without a sha1=xxx parameter) does not schedule a build, it schedules polling of the repository...

So... which of the following is correct:

1. It is never possible to pass build parameters via notifyCommit
1. It is possible to pass parameters via notifyCommit, provided those parameters are listed in hudson.model.ParametersAction.safeParameters
1. It is possible to pass parameters via notifyCommit, provided those parameters are listed in hudson.model.ParametersAction.safeParameters and you also pass sha1=<xxx>

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

evadeflow@gmail.com (JIRA)

unread,
Jan 10, 2017, 2:19:02 PM1/10/17
to jenkinsc...@googlegroups.com
Evade Flow edited a comment on Bug JENKINS-34363
> _If you want to pass parameters to a build, please use:_ {{http://server/job/myjob/buildWithParameters?PARAMETER=Value}}


I'm confused. Using the {{buildWithParameters}} endpoint is an unsatisfactory solution because it requires authentication, which simply isn't required in many environments. And this link:

* http://javadoc.jenkins-ci.org/git/hudson/plugins/git/GitStatus.html#SAFE_PARAMETERS

claims that it's possible to pass parameters via {{notifyCommit}}, provided you set the Jenkins system property {{hudson.model.ParametersAction.safeParameters}} to a comma-separated list of parameters that should be allowed to pass through.

> _The notifyCommit call (without a sha1=xxx parameter) does not schedule a build, it schedules polling of the repository..._


So... which of the following is correct:

1. # It is _never_ possible to pass build parameters via {{notifyCommit}}
1. # It is possible to pass parameters via {{notifyCommit}}, provided those parameters are listed in {{hudson.model.ParametersAction.safeParameters}}
1. # It is possible to pass parameters via {{notifyCommit}}, provided those parameters are listed in {{hudson.model.ParametersAction.safeParameters}} _and_ you also pass {{sha1=<xxx>}}

evadeflow@gmail.com (JIRA)

unread,
Jan 10, 2017, 3:26:01 PM1/10/17
to jenkinsc...@googlegroups.com

Here's another link implying that it should be possible—somehow—to pass parameters via notifyCommit:

But I fear, after attempting it a bunch of different ways, that this is incorrect, and the answer to the question I posed previously is:

  1. It is never possible to pass build parameters via notifyCommit

Mark Waite: Since your name was on 5b57aac7, can you confirm whether this is the case?

Specifically, I'm hitting this URL from a commit hook:

and hoping that REBUILD_ALL will be set to false in my parameterized job, instead of its default value of true. Thanks!

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 9:32:38 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Won't Fix
 
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages