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

Added GERRIT_EVENT_FILE_BASED environment variable #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added GERRIT_EVENT_FILE_BASED environment variable #358

wants to merge 1 commit into from

Conversation

venkrao
Copy link

@venkrao venkrao commented Mar 19, 2018

 GERRIT_EVENT_FILE_BASED is set to True if the
 build is triggered due to a file-based event.
 Otherwise, False.

     GERRIT_EVENT_FILE_BASED is set to True if the
     build is triggered due to a file-based event.
     Otherwise, False.
@venkrao
Copy link
Author

venkrao commented Mar 20, 2018

I can't understand the reason for the test failure. Any help is appreciated. https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fgerrit-trigger-plugin/detail/PR-358/1/pipeline are the logs.

@@ -988,6 +989,10 @@ public boolean isInteresting(GerritTriggeredEvent event) {
changeBasedEvent.getFiles(
new GerritQueryHandler(getServerConfig(event))))) {
logger.trace("According to {} the event is interesting.", p);
if (triggerParamRuntime == null) {
triggerParamRuntime = new GerritTriggerRuntimeParam();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad as the GerritTrigger object is one instance per job so adding a field to it means adding a field to the job not the build.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I can't think of another way of doing it. Please give me some clues to which file is the right one for this purpose.

As far as why I thought this was the only option: This is the only file that knows about list of files involved in a given Gerrit change(changeBasedEvent.getFiles), thus, able to check if the affected-files in a gerrit change match the filtered files of file-based-trigger configuration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would need to carry the information over from somewhere around here to the build. data in builds are stored via actions, int this case the simplest would be to put the information into the GerritCause object that is added to the build when scheduled.
Also, here I don't know if you can be sure the event was interesting because of the file, but maybe :)

@rsandell
Copy link
Member

EVERE: Notify-error:
java.lang.NullPointerException
at com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger.getfileBasedMatch(GerritTrigger.java:1671)

@Jimilian
Copy link
Contributor

What is FileBasedEvent?

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