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

Add hook for sse-gateway and workflow-cps for node and node_modules issue #247

Merged
merged 6 commits into from
Jul 15, 2020

Conversation

kshultzCB
Copy link
Contributor

Description

Some Jenkins plugins end up with node and node_modules directories in their local source directories after compilation. With standard builds this is fine, and it's fine with many ways of running the PCT. However, when the PCT's -localCheckoutDir is used, such plugins can fail with difficult to understand errors from gulp.

This PR is a hook, much like the existing ones, which works past this problem specifically for sse-gateway and workflow-cps. Following below is some example output of running the PCT against master of workflow-cps.

The issue can also be recreated with sse-gateway, with the results being slightly different. With sse-gateway, the "fixed" PCT run shows a different failure, which would be fixed if I file a PR with this simple change to that plugin. I actually read about that here. Without my change, sse-gateway fails with an identical Error: Cannot find module '../lib/completion' error to the one from workflow-cps.

Example output, before and after this PR

Without this PR:

➜  plugin-compat-tester git:(sse-gateway-hook) ✗ java -jar plugins-compat-tester-cli/target/plugins-compat-tester-cli.jar -reportFile $(pwd)/out/report.xml -workDirectory $(pwd)/tmp/work -includePlugins workflow-cps -war /Users/kshultz/GitHub/unified-release/products/core-mm/target/core-mm-2.235.1.3-SNAPSHOT.war -localCheckoutDir /Users/kshultz/GitHub/workflow-cps-plugin -skipTestCache true

...snip...

[INFO] --- frontend-maven-plugin:1.9.1:yarn (yarn mvnbuild) @ workflow-cps ---
[INFO] Running 'yarn run mvnbuild' in /Users/kshultz/GitHub/plugin-compat-tester/tmp/work/workflow-cps
[INFO] yarn run v0.23.0
[INFO] $ gulp bundle 
[INFO] module.js:338
[INFO]     throw err;
[INFO]     ^
[INFO] 
[INFO] Error: Cannot find module '../lib/completion'
[INFO]     at Function.Module._resolveFilename (module.js:336:15)
[INFO]     at Function.Module._load (module.js:286:25)
[INFO]     at Module.require (module.js:365:17)
[INFO]     at require (module.js:384:17)
[INFO]     at Object.<anonymous> (/Users/kshultz/GitHub/plugin-compat-tester/tmp/work/workflow-cps/node_modules/.bin/gulp:13:18)
[INFO]     at Module._compile (module.js:434:26)
[INFO]     at Object.Module._extensions..js (module.js:452:10)
[INFO]     at Module.load (module.js:355:32)
[INFO]     at Function.Module._load (module.js:310:12)
[INFO]     at Function.Module.runMain (module.js:475:10)
[INFO] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.082 s
[INFO] Finished at: 2020-07-14T17:08:42-04:00
[INFO] ------------------------------------------------------------------------

With this PR:

➜  plugin-compat-tester git:(sse-gateway-hook) ✗ java -jar plugins-compat-tester-cli/target/plugins-compat-tester-cli.jar -reportFile $(pwd)/out/report.xml -workDirectory $(pwd)/tmp/work -includePlugins workflow-cps -war /Users/kshultz/GitHub/unified-release/products/core-mm/target/core-mm-2.235.1.3-SNAPSHOT.war -localCheckoutDir /Users/kshultz/GitHub/workflow-cps-plugin -skipTestCache true

...snip...

[INFO] --- frontend-maven-plugin:1.9.1:yarn (yarn install) @ workflow-cps ---
[INFO] Running 'yarn --mutex network' in /Users/kshultz/GitHub/plugin-compat-tester/tmp/work/workflow-cps
[INFO] yarn install v0.23.0
[INFO] [1/4] Resolving packages...
[INFO] success Already up-to-date.
[INFO] Done in 0.38s.
[INFO] 
[INFO] --- maven-localizer-plugin:1.26:generate (default) @ workflow-cps ---
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:yarn (yarn mvnbuild) @ workflow-cps ---
[INFO] Running 'yarn run mvnbuild' in /Users/kshultz/GitHub/plugin-compat-tester/tmp/work/workflow-cps
[INFO] yarn run v0.23.0
[INFO] $ gulp bundle 
[INFO] [17:40:56] Maven project
[INFO] [17:40:56]  - src: src/main/js,src/main/less
[INFO] [17:40:56]  - test: src/test/js
[INFO] [17:40:56] Setting defaults
[INFO] [17:40:56] Bundle will be generated in directory 'target/generated-resources/adjuncts/org/jenkinsci/plugins/workflow/cps' as 'workflow-editor.js'.
[INFO] [17:40:56] Using gulpfile ~/GitHub/plugin-compat-tester/tmp/work/workflow-cps/gulpfile.js
[INFO] [17:40:56] Starting 'bundle'...
[INFO] [17:40:56] Finished 'bundle' after 44 ms
[INFO] Done in 0.75s.

...snip...

[INFO] Results:
[INFO] 
[WARNING] Tests run: 415, Failures: 0, Errors: 0, Skipped: 9
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:43 min
[INFO] Finished at: 2020-07-14T17:53:52-04:00
[INFO] ------------------------------------------------------------------------

@olamy olamy merged commit c502ba1 into jenkinsci:master Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants