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

Explain how to adjust the home directory #7759

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

StefanSpieker
Copy link
Contributor

Explain how to adjust the home directory.
Not sure how broadly it is used, but there was a TODO and I thought describing it might not hurt.

@StefanSpieker StefanSpieker requested a review from a team as a code owner December 16, 2024 17:54
@probot-autolabeler probot-autolabeler bot added the documentation Jenkins documentation, including user and developer docs, solution pages, etc. label Dec 16, 2024
TODO: Write this section.

If you want to adjust the `JENKINS_HOME` within a test, you can make use of the `JenkinsRule`-methods `withExistingHome()` or `withNewHome()`.
Let's assume in the directory "src/test/resources/home" everything is prepared for a good test suite, and you want to use that.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Let's assume in the directory "src/test/resources/home" everything is prepared for a good test suite, and you want to use that.
Let's assume in the directory "src/test/resources/home" everything is prepared for a good test suite, which you should use.

public JenkinsRule j = new JenkinsRule().withExistingHome(new File("src/test/resources/home"));
----

If you need a fresh `JENKINS_HOME` you can use `withNewHome()` which creates a fresh home, what the default of the `JenkinsRule()` at the beginning is.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you need a fresh `JENKINS_HOME` you can use `withNewHome()` which creates a fresh home, what the default of the `JenkinsRule()` at the beginning is.
If you need a fresh `JENKINS_HOME` you can use `withNewHome()` which creates a fresh home, which is by default what the `JenkinsRule()` at the beginning is.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Description is accurate and matches with the usages that I found.

@@ -367,7 +367,19 @@ report.copyFrom(getClass().getResourceAsStream("lint-results_r20.xml"));
----

==== Customizing the `JENKINS_HOME` Directory
TODO: Write this section.

If you want to adjust the `JENKINS_HOME` within a test, you can make use of the `JenkinsRule`-methods `withExistingHome()` or `withNewHome()`.
Copy link
Contributor

@MarkEWaite MarkEWaite Dec 16, 2024

Choose a reason for hiding this comment

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

These methods seem to be rarely used. A GitHub search showed only two usages in the jenkinsci organization.

An optional minor phrasing change. I'm not sure of the preferred replacement for these test methods, but I suspect that there are preferred replacements..

Suggested change
If you want to adjust the `JENKINS_HOME` within a test, you can make use of the `JenkinsRule`-methods `withExistingHome()` or `withNewHome()`.
If you want to adjust the `JENKINS_HOME` within a test, use the `JenkinsRule`-methods link:https://javadoc.jenkins.io/component/jenkins-test-harness/org/jvnet/hudson/test/JenkinsRule.html#withExistingHome(java.io.File)[`withExistingHome()`] or link:https://javadoc.jenkins.io/component/jenkins-test-harness/org/jvnet/hudson/test/JenkinsRule.html#withNewHome()[`withNewHome()`].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Jenkins documentation, including user and developer docs, solution pages, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants