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

[JENKINS-26100] Switch buildEnvVars and others to Run #492

Merged
merged 12 commits into from Jun 21, 2017

Conversation

abayer
Copy link
Member

@abayer abayer commented May 1, 2017

JENKINS-26100

Downstream of jenkinsci/jenkins#2730

cc @reviewbybees esp @MarkEWaite @jglick

@ghost
Copy link

ghost commented May 1, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

OK except for requested buildEnvVars rename.

pom.xml Outdated
@@ -24,7 +24,8 @@
<inceptionYear>2007</inceptionYear>

<properties>
<jenkins.version>1.625.3</jenkins.version>
<jenkins-core.version>2.58-20170501.171905-3</jenkins-core.version> <!-- TODO: Switch to release once https://github.com/jenkinsci/jenkins/pull/2730 is merged and released -->
<jenkins-war.version>2.58-20170501.171927-3</jenkins-war.version> <!-- TODO: Switch to release once https://github.com/jenkinsci/jenkins/pull/2730 is merged and released -->
<java.level>7</java.level>
Copy link
Member

Choose a reason for hiding this comment

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

8

@@ -470,7 +470,7 @@ protected String getCacheEntry() {
}

protected static File getCacheDir(String cacheEntry) {
Jenkins jenkins = Jenkins.getInstance();
Jenkins jenkins = Jenkins.getInstanceOrNull();
Copy link
Member

Choose a reason for hiding this comment

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

Most of these should actually be getInstance() with no null check, but good enough for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

I went for the most stupidly non-logic-altering Findbugs fix I could. =) Wasn't 100% sure there weren't some cases where they might be expecting the existing behavior with a possibly null jenkins instance, so hey, better safe than sorry.

@jglick
Copy link
Member

jglick commented May 3, 2017

Hudson Parameterized Trigger plugin v2.4 failed to load.
 - subversion v1.7 is missing. To fix, install v1.7 or later.

Not your fault, just a sign that this plugin’s Jenkinsfile is missing the usual idiom to verify that its tests run against Jenkins 2.12+, e.g.:

buildPlugin(jenkinsVersions: [null, '2.32.3'])

@MarkEWaite
Copy link
Contributor

MarkEWaite commented May 3, 2017

Last time I enabled the plugin compat tests, it failed because the combination of tests and compilation took more than an hour to complete. The ci.jenkins.io jobs (correctly) limit themselves to not more than an hour elapsed time for the total job.

Plugin compat testing is enabled again, and we'll see if it performs better now.

@jglick
Copy link
Member

jglick commented May 3, 2017

But jenkinsVersions will be run in parallel, and the timeout is wall clock time, so why would it matter?

@MarkEWaite
Copy link
Contributor

MarkEWaite commented May 4, 2017

With plugin compat enabled, it now does not timeout (maybe a false recollection on my part). It reports findbugs warnings on the 2.46.1 build which it does not report on other builds. Unfortunately, my first attempts to duplicate that result locally have failed. My findbugs is silent, even when I set jenkins.version=2.46.1.

My second attempt shows how to duplicate the problem. I mistakenly used -DskipTests, forgetting that it excludes findbugs runs for speed. If I run with at least one test, or with -Dtest=xyzzy -DfailIfNoTests=false, then I can see the findbugs output when compiling with 2.46.1.

I suspect I won't have time to explore fixes until after the end of the working day today.

Short term, I've stopped failing on findbugs warning messages. See daf202d

@jglick
Copy link
Member

jglick commented May 4, 2017

The most common introduced FB error is due to @stephenc’s messing around with Jenkins.getInstance. Either switch to getActiveInstance, if appropriate, or leave the getInstance call with a null check and add

@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")

Yes this is obnoxious which is why I asked him to leave existing methods alone, and rely on deprecations if necessary, but he insisted…

@jglick
Copy link
Member

jglick commented May 4, 2017

FTR my NetBeans action binding for checking FindBugs:

mvn -DskipTests=false clean compile findbugs:check

@MarkEWaite
Copy link
Contributor

I'm not sure that action binding will work with the git plugin's current pom. As far as I can tell, once -DskipTests=false is passed as an argument, then findbugs:check is a no-op. I think that is reasonable (if you're skipping tests, you probably don't want to run findbugs), but it surprised me in this case.

My solution was -Dtest=CGitTest findbugs:check findbugs:gui. Runs a fast test, and reports findbugs results.

@jglick
Copy link
Member

jglick commented May 4, 2017

This works in other plugins. FindBugs is skipped only if -DskipTests or -DskipTests=true is used. Omitting, or passing -DskipTests=false, runs FindBugs.

@MarkEWaite
Copy link
Contributor

Thanks for the education! Inattentional blindness problem on my part. I saw the -DskipTests= in your action binding and didn't look at the false value. Nice technique.

pom.xml Outdated
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<jenkins-core.version>2.58-20170502.192524-8</jenkins-core.version> <!-- TODO: Switch to release once https://github.com/jenkinsci/jenkins/pull/2730 is merged and released -->
<jenkins-war.version>2.58-20170502.192544-8</jenkins-war.version> <!-- TODO: Switch to release once https://github.com/jenkinsci/jenkins/pull/2730 is merged and released -->
Copy link
Member

Choose a reason for hiding this comment

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

2.61

Copy link
Member

Choose a reason for hiding this comment

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

2.60 I meant.

@abayer abayer changed the title NOT READY FOR MERGE [JENKINS-26100] Switch buildEnvVars and others to Run [JENKINS-26100] Switch buildEnvVars and others to Run May 18, 2017
Hudson hudson = Hudson.getInstance();
if (hudson == null) {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just revert changes in this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

'k

buildEnvironment(build, env);
}

public void buildEnvironment(Run<?, ?> build, java.util.Map<String, String> env) {
Copy link
Member

Choose a reason for hiding this comment

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

Put in the usual TODOs.

Copy link
Member Author

Choose a reason for hiding this comment

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

'k

@Letty-Liang
Copy link

Letty-Liang commented May 24, 2017

looking forward to be published soon

====
With this pr, it seems that we still can't get git properties in env while using pipeline jobs.

@abayer
Copy link
Member Author

abayer commented Jun 6, 2017

@reviewbybees done

@MarkEWaite Can I persuade you to merge this? =)

@MarkEWaite
Copy link
Contributor

It will be several days (at least) before I have a chance to review it. Can the merge wait until next week? What if it needs to wait another week beyond that?

@abayer
Copy link
Member Author

abayer commented Jun 6, 2017

@MarkEWaite No rush at all - just wanted to make sure this wasn't lost.

pom.xml Outdated
<optional>true</optional>
<<<<<<< HEAD
</dependency>
=======
Copy link
Member

Choose a reason for hiding this comment

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

Bad merge conflict resolution!

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

:shipit:

@abayer
Copy link
Member Author

abayer commented Jun 20, 2017

@MarkEWaite Any news? =)

@MarkEWaite
Copy link
Contributor

@abayer, sorry, but no progress on this pull request yet. Is it urgent, or blocking other work that I should place it ahead of other things in my queue (like the submodule checkout regression or the credential exclusion issue)?

@MarkEWaite MarkEWaite merged commit 907253d into jenkinsci:master Jun 21, 2017
@MarkEWaite MarkEWaite added the bugfix Fixes a bug - used by Release Drafter label Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes a bug - used by Release Drafter
Projects
None yet
4 participants