CONTRIBUTING.md 7.2 KB
Newer Older
K
Kanstantsin Shautsou 已提交
1
# Contributing to Jenkins
2

L
Liam Newman 已提交
3
This page provides information about contributing code to the Jenkins core codebase.
4

J
Josh Soref 已提交
5
:exclamation: There's a lot more to the Jenkins project than just code. For information on contributing to the Jenkins project overall, check out [Participate].
6 7 8 9 10

## Getting started

1. Fork the repository on GitHub
2. Clone the forked repository to your machine
L
Liam Newman 已提交
11
3. Install the development tools. In order to develop Jenkins, you need the following tools:
12 13 14 15
  * Java Development Kit (JDK) 8 or 11.
    In Jenkins project we usually use [OpenJDK](http://openjdk.java.net/) or [AdoptOpenJDK](https://adoptopenjdk.net/), but you can use other JDKs as well.
    * For JDK 11 there might be some compatibility issues in developer tools,
      please see [this page](https://wiki.jenkins.io/display/JENKINS/Java+11+Developer+Guidelines#Java11DeveloperGuidelines-Knowndevelopertoolsissues) for more info.
O
Oleg Nenashev 已提交
16
      If you hit a new issue, please report it with a `java11-devtools-compatibility` label in our issue tracker.
E
edh-oss 已提交
17
  * Maven 3.5.4 or above. You can [download maven].
J
Josh Soref 已提交
18 19
  * Any IDE which supports importing Maven projects.
4. Setup your development environment as described in [Preparing for Plugin Development]
20

L
Liam Newman 已提交
21 22 23 24
If you want to contribute to Jenkins or just learn about the project,
you can start by fixing some easier issues.
In the Jenkins issue tracker we mark such issues as `newbie-friendly`.
You can find them
J
Josh Soref 已提交
25
using this query for [newbie friendly issues].
26 27 28

## Building and Debugging

L
Liam Newman 已提交
29
The build flow for Jenkins core is built around Maven.
J
Josh Soref 已提交
30
There is a description of the [building and debugging process].
31 32 33

If you want simply to have the `jenkins.war` file as fast as possible without tests, run:

34
    mvn clean package -pl war -am -DskipTests -Dspotbugs.skip
35

L
Liam Newman 已提交
36
The WAR file will be created in `war/target/jenkins.war`.
J
Josh Soref 已提交
37
After that you can start Jenkins using Java CLI ([guide]).
38
If you want to debug this WAR file without using Maven plugins,
J
Josh Soref 已提交
39
You can just start the executable with [Remote Debug Flags]
40 41
and then attach IDE Debugger to it.

T
Tommy Sparber 已提交
42 43 44 45 46 47 48 49 50 51 52
To compile and launch a development instance, run:

    mvn hudson-dev:run

<!--
This should be `mvn hudson-dev:run` as long as JENKINS-23364 is not resolved.
For jenkis-dev:run it is currently necessary to add `org.jenkins-ci.tools` as a plugin group
to the maven settings.xml.
See also https://github.com/jenkinsci/jenkins/pull/4331#discussion_r341041470
-->

53 54
## Testing changes

L
Liam Newman 已提交
55
Jenkins core includes unit and functional tests as a part of the repository.
56 57

Functional tests (`test` module) take a while even on server-grade machines.
L
Liam Newman 已提交
58
Most of the tests will be launched by the continuous integration instance,
59 60
so there is no strict need to run full test suites before proposing a pull request.

61 62 63 64 65 66
There are 3 profiles for tests:

* `light-test` - only unit tests, no functional tests
* `smoke-test` - run unit tests + a number of functional tests
* `all-tests` - Runs all tests, with re-run (default)

L
Liam Newman 已提交
67
In addition to the included tests, you can also find extra integration and UI
J
Josh Soref 已提交
68
tests in the [Acceptance Test Harness (ATH)] repository.
L
Liam Newman 已提交
69
If you propose complex UI changes, you should create new ATH tests for them.
70 71 72

## Proposing Changes

M
Marc Jansen 已提交
73
The Jenkins project source code repositories are hosted at GitHub.
L
Liam Newman 已提交
74 75 76
All proposed changes are submitted and code reviewed using the _GitHub Pull Request_ process.

To submit a pull request:
77

L
Liam Newman 已提交
78
1. Commit changes and push them to your fork on GitHub.
79 80 81 82 83
It is a good practice is to create branches instead of pushing to master.
2. In GitHub Web UI click the _New Pull Request_ button
3. Select `jenkinsci` as _base fork_ and `master` as `base`, then click _Create Pull Request_
  * We integrate all changes into the master branch towards the Weekly releases
  * After that the changes may be backported to the current LTS baseline by the LTS Team.
J
Josh Soref 已提交
84 85
    Read more about the [backporting process]
4. Fill in the Pull Request description according to the [proposed template].
86 87 88 89 90
5. Click _Create Pull Request_
6. Wait for CI results/reviews, process the feedback.
  * If you do not get feedback after 3 days, feel free to ping `@jenkinsci/code-reviewers` to CC.
  * Usually we merge pull requests after 2 votes from reviewers or after 1 vote and 1-week delay without extra reviews.

L
Liam Newman 已提交
91 92
Once your Pull Request is ready to be merged,
the repository maintainers will integrate it, prepare changelogs and
93
ensure it gets released in one of incoming Weekly releases.
S
segalaj 已提交
94
There is no additional action required from pull request authors at this point.
95

96 97
## Copyright

J
Josh Soref 已提交
98
Jenkins core is licensed under [MIT license], with a few exceptions in bundled classes.
99 100
We consider all contributions as MIT unless it's explicitly stated otherwise.
MIT-incompatible code contributions will be rejected.
L
Liam Newman 已提交
101
Contributions under MIT-compatible licenses may be also rejected if they are not ultimately necessary.
102

J
Josh Soref 已提交
103
We **Do NOT** require pull request submitters to sign the [contributor agreement]
L
Liam Newman 已提交
104
as long as the code is licensed under MIT and merged by one of the contributors with the signed agreement.
105

S
segalaj 已提交
106
We still encourage people to sign the contributor agreement if they intend to submit more than a few pull requests.
L
Liam Newman 已提交
107
Signing is also a mandatory prerequisite for getting merge/push permissions to core repositories
J
Josh Soref 已提交
108
and for joining teams like [Jenkins Security Team].
109

110 111
## Continuous Integration

L
Liam Newman 已提交
112
The Jenkins project has a Continuous Integration server... powered by Jenkins, of course.
J
Josh Soref 已提交
113
It is located at [ci.jenkins.io].
114

J
Josh Soref 已提交
115 116
The Jenkins project uses [Jenkins Pipeline] to run builds.
The code for the core build flow is stored in the [Jenkinsfile] in the repository root.
L
Liam Newman 已提交
117 118
If you want to update that build flow (e.g. "add more checks"),
just submit a pull request.
K
Kanstantsin Shautsou 已提交
119

120 121
# Links

S
segalaj 已提交
122 123
* [Jenkins Contribution Landing Page](https://jenkins.io/participate/)
* [Jenkins IRC Channel](https://jenkins.io/chat/)
124 125 126
* [Beginners Guide To Contributing](https://wiki.jenkins.io/display/JENKINS/Beginners+Guide+to+Contributing)
* [List of newbie-friendly issues in the core](https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20component%20%3D%20core%20AND%20labels%20in%20(newbie-friendly))

J
Josh Soref 已提交
127 128 129 130 131 132 133 134 135 136 137
[download maven]: https://maven.apache.org/download.cgi
[Preparing for Plugin Development]: https://jenkins.io/doc/developer/tutorial/prepare/
[newbie friendly issues]: https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20component%20%3D%20core%20AND%20labels%20in%20(newbie-friendly)
[Participate]: https://jenkins.io/participate/
[building and debugging process]: https://jenkins.io/doc/developer/building/
[guide]: https://wiki.jenkins.io/display/JENKINS/Starting+and+Accessing+Jenkins
[Remote Debug Flags]: https://stackoverflow.com/questions/975271/remote-debugging-a-java-application
[Acceptance Test Harness (ATH)]: https://github.com/jenkinsci/acceptance-test-harness
[backporting process]: https://jenkins.io/download/lts/
[proposed template]: .github/PULL_REQUEST_TEMPLATE.md
[MIT license]: ./LICENSE.txt
138
[contributor agreement]: https://jenkins.io/project/governance/#cla
J
Josh Soref 已提交
139 140 141
[Jenkins Security Team]: https://jenkins.io/security/#team
[ci.jenkins.io]: https://ci.jenkins.io/
[Jenkins Pipeline]: https://jenkins.io/doc/book/pipeline/
E
edh-oss 已提交
142
[Jenkinsfile]: ./Jenkinsfile