Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing variables #84

Closed
sudoash opened this issue May 13, 2016 · 23 comments · Fixed by #89
Closed

Missing variables #84

sudoash opened this issue May 13, 2016 · 23 comments · Fixed by #89

Comments

@sudoash
Copy link

sudoash commented May 13, 2016

Jenkins version: 2.3

It seems that variables aren't being made available to Jenkins anymore resulting in the following:

git -c core.askpass=true fetch --tags --progress git@git.xxx.io:xxx/xxx.git +refs/heads/:refs/remotes/origin/
git rev-parse refs/remotes/origin/${sourceBranch}^{commit} # timeout=10
git rev-parse refs/remotes/origin/origin/${sourceBranch}^{commit} # timeout=10
git rev-parse origin/${sourceBranch}^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Unable to expand commit SHA value
org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'sourceCommitHash' in '${sourceCommitHash}'
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:207)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:246)
at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:232)
at org.jenkinsci.plugins.stashNotifier.StashNotifier.lookupCommitSha1s(StashNotifier.java:287)
at org.jenkinsci.plugins.stashNotifier.StashNotifier.processJenkinsEvent(StashNotifier.java:247)
at org.jenkinsci.plugins.stashNotifier.StashNotifier.perform(StashNotifier.java:205)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
found no commit info
Finished: FAILURE

Has anyone else been receiving these issues since upgrading Jenkins?

@mandrizzle
Copy link
Contributor

Did you update your refspec to +refs/pull-requests/*:refs/remotes/origin/pr/* in the jenkins job?

@nickbroon
Copy link
Contributor

nickbroon commented May 15, 2016

This is same as this issue: https://issues.jenkins-ci.org/browse/JENKINS-34762. It is a result of a security update to Jenkins. See also janinko/ghprb#408

@nickbroon
Copy link
Contributor

Also being tracked at https://issues.jenkins-ci.org/browse/JENKINS-34847

@almorelle
Copy link

👍

@almorelle
Copy link

It is written in the JIRA issue but here's the link to the security report that introduced the breaking changes: SECURITY-170

It says that Jenkins prevents now parameters that were not defined in the job to be defined in the environment. While waiting for this plugin to adjust, you can work around this by giving Jenkins some parameters. Either you restore the previous behavior or define which parameters can go through:

  • -Dhudson.model.ParametersAction.keepUndefinedParameters=true
  • -Dhudson.model.ParametersAction.safeParameters=FOO,BAR_baz,quX

@nickbroon
Copy link
Contributor

GitHub Pull request builder plugin fixed this: jenkinsci/ghprb-plugin#344
Hopefully something similar can be done for the Stash Pull Request Builder, as I think their designs are similar.

@eirikwang
Copy link
Contributor

eirikwang commented Jul 7, 2016

Fixed this in a branch:
https://github.com/eirikwang/stash-pullrequest-builder-plugin/tree/newChange
More or less the same implementation as github´s implementation
Not written any tests or anything, but it now works as intended again.

@nemccarthy
Copy link
Owner

Could you raise a PR

@fuzzmz
Copy link

fuzzmz commented Jul 12, 2016

@eirikwang, any updates on this? @nemccarthy, alternatively you can initiate the pull request yourself to bring in the changes if you're ok with the patch.

@nemccarthy
Copy link
Owner

Thanks guys! Sorry been on holidays in South America for the past few months. Will get to all these over the next week and get a new build out

@RishabhTayal
Copy link

Any update?

@mrooney
Copy link

mrooney commented Sep 21, 2016

I submitted a PR with @eirikwang's changes!

@nemccarthy
Copy link
Owner

Thanks guys. Looking at this now

@RishabhTayal
Copy link

So this should be available on Jenkins now?

@mrooney
Copy link

mrooney commented Sep 22, 2016

It will require a version bump and new release to the Jenkins plugin repository. @nemccarthy, I am happy to bump to 1.7.0 and release if you like (updating the wiki), or if you prefer to do it, just let me know :)

@MazenAtaya
Copy link

I'm still facing this issue. My plugin version is 1.7.0 and I'm on Jenkins 2.7.
Anyone noticed the same thing?

@MazenAtaya
Copy link

@almorelle A silly question, how do we provide that environment variable to Jenkins?

@Flet
Copy link

Flet commented Oct 19, 2016

Updating the plugin to 1.7.0 worked, however we had to do a full restart of the jenkins service from the command line (not just a restart from the UI) in order for it to take effect.

@mamouneyya
Copy link

mamouneyya commented Feb 17, 2017

I'm still facing this issue on a fresh installation of Jenkins v2.32.2 & Plugin v1.7.0 :(

P.S. Actually, the variables started to work properly until I checked both Build only if PR is mergeable & Merge PR if build is successful in advanced settings. However, un-checking them has no effect now (already tried to restart Jenkins). It's kinda unstable!

P.P.S. Mmmm, after playing with the advanced settings it looks like that Only build when asked (with test phrase) option is the one that fires this issue! This doesn't make any sense I know... 😕

@Steve973
Copy link

I'm still getting this with Jenkins 2.77 and plugin 1.7.0. I have the following options selected:

  • ignore ssl certificates
  • rebuild if destination branch changes
  • build only if stash reports no conflicts
  • build only if pr is mergeable

Is this fixed, and am I doing something wrong?

@karloskalcium
Copy link

I am also seeing this on Jenkins 2.73.1 and plugin 1.7.0. For now I'm seeing a lot of warnings in the logs, but the parameters themselves are available to the job. Anyone else have any hints on how to get rid of the warnings (I'd rather not set the global flag, as I'd like it to warn me if there are params that shouldn't be there, but this was supposed to be fixed in the latest plugin...)

@alishahbaz111
Copy link

Having the same issue. Is there a way to manually set these variables?

@jdelnano
Copy link

jdelnano commented Feb 4, 2019

Also still having these problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.