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-68363] - Fix dynamic DSL plugins handling in job DSL #156

Conversation

dhurum
Copy link

@dhurum dhurum commented Jun 29, 2021

This commit fixes working with dynamic DSL plugins in job DSL integration code, namely in promotion actions processing.

Currently an attempt to use a dynamic DSL plugin in promotion actions causes Jenkins to raise an exception because dynamic DSL plugin nodes seem to have a different layout than a regular job DSL plugin.

See JENKINS-68363.

Your checklist for this pull request

  • Pull request title represents the changelog entry which will be used in Release Notes. JIRA issue is a part of the title (see existing PRs as examples)
  • Please describe what you did. Short summary for reviewers. If the change involves WebUI, add screenshots
  • Link to relevant Jenkins JIRA issues or pull requests
  • Test automation, if relevant. We expect autotests for all new features or complex bugfixes
  • Documentation if relevant (new features). We want to use Documentation-as-Code, just put docs to README or to new Doc files
  • Javadoc for new APIs. Any public/protected method is considered as API unless annotated by Restricted (docs)

CC

@oleg-nenashev @raul-arabaolaza

@dhurum
Copy link
Author

dhurum commented Mar 5, 2022

Hey, @jtnord or @batmat, can you please take a look at this PR?

@dhurum dhurum force-pushed the fix-dynamic-dls-plugins-handling-in-dsl-integration branch from 923ace9 to 40429e0 Compare April 14, 2022 16:48
@dhurum dhurum changed the title Fix dynamic DSL plugins handling in job DSL [JENKINS-68363] - Fix dynamic DSL plugins handling in job DSL Apr 28, 2022
This commit fixes working with dynamic DSL plugins in job DSL
integration code, namely in promotion actions processing.
@dhurum dhurum force-pushed the fix-dynamic-dls-plugins-handling-in-dsl-integration branch from 40429e0 to cd9e806 Compare July 13, 2022 08:18
@dhurum dhurum requested a review from a team as a code owner May 6, 2024 01:20
@jtnord jtnord added the bug label May 29, 2024
@jtnord jtnord merged commit f5bcee5 into jenkinsci:master May 29, 2024
14 checks passed
TopLevelItem item = j.jenkins.getItem("dynamic-dsl-test");
File config = new File(item.getRootDir(), "promotions/Development/config.xml");
String content = Files.readString(config.toPath());
assert content.contains("<javaposse.jobdsl.plugin.ExecuteDslScripts");
Copy link
Member

Choose a reason for hiding this comment

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

Damn merged to early!

Generally please avoid using an assert for a non boolean primative.

If things fail, you just get a failure, rather it is better to use a higher level framework such as hamcrest so that when things fail you are told that "the needle does not exist in the haystack" (as the haystack can lead you directly to the cause/fix)

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

Successfully merging this pull request may close these issues.

3 participants