|
1 | 1 | # Jenkins |
2 | 2 |
|
3 | | -## **Job Creation with Job DSL** |
| 3 | +## Job Creation with Job DSL |
4 | 4 |
|
5 | | -**Create Jobs** |
| 5 | +### Create Jobs |
6 | 6 |
|
7 | | -The [Create Jobs](https://ci.eclipse.org/releng/job/CreateJobs/) job is used to populate the jenkins subfolders with the jobs defined in [JenkinsJobs](JenkinsJobs) groovy files. |
8 | | -There are 2 Process Job DSLs steps, the first looks for FOLDER.groovy files and creates the folders, the second creates the jobs themselves. |
| 7 | +The [Create Jobs](https://ci.eclipse.org/releng/job/CreateJobs/) job is used to populate the Jenkins subfolders with the jobs defined in [JenkinsJobs](JenkinsJobs). |
| 8 | +It is defined in [`JenkinsJobs/seedJob.jenkinsfile`](JenkinsJobs/seedJob.jenkinsfile). |
9 | 9 |
|
10 | | -Create Jobs *must be run manually*. Unfortunately JobDSL needs to be run by a specific user, so the build cannot be automatically started by a timer or when it detects jenkins changes without installing an additional plugin like [Authorize Project](https://plugins.jenkins.io/authorize-project/)) which supposedly still works but is abandoned and I (Sam) have not had time to investigate further or find alternatives. This means that while any committer can make changes to the Jenkins Jobs in git, someone with Jenkins rights will have to start the build to implement those changes. |
| 10 | +Create Jobs *must be run manually*. |
| 11 | +Unfortunately JobDSL needs to be run by a specific user, so the build cannot be automatically started by a timer or when it detects jenkins changes without installing an additional Plug-in (like [Authorize Project](https://plugins.jenkins.io/authorize-project/)) which supposedly still works but is abandoned. |
| 12 | +This means that while any committer can make changes to the Jenkins Jobs in git, someone with Jenkins permissions will have to start the build to implement those changes. |
11 | 13 |
|
12 | 14 | Obsolete jobs have to be deleted manually. |
13 | 15 | They are not deleted automatically as some may be are still in use for a short time (e.g. Y-builds if a java-release is imminent) or to serve as reference in case the new jobs have problems. |
14 | 16 |
|
15 | | -**The JenkinsJobs Folder** |
| 17 | +### The JenkinsJobs Folder |
16 | 18 |
|
17 | 19 | As a general rule, the [JenkinsJobs](./JenkinsJobs) folder should match the layout of Jenkins itself. |
18 | | -Every subfolder should contain one `.jenkinsfile` per individual pipeline. |
19 | | - |
20 | | -Note: JobDSL does also support the creation of Views, so those can be added at some point but someone will either have to manually keep them up to date with the desired jobs or write a script to keep them up-to-date. |
21 | | - |
22 | | -Many jobs have the release version in the job name because it is required for results parsing (i.e. the [automated tests](https://ci.eclipse.org/releng/job/AutomatedTests/)). |
23 | | -In order to minimize manual labor the currently active streams are listed in the [buildConfigurations.json](JenkinsJobs/buildConfigurations.json) file. |
24 | | -Version dependent jobs then parse this file during creation and make a job for each stream. |
| 20 | +Every subfolder contains a `.jenkinsfile` file for each individual job. |
| 21 | +The folders containing the individual job definitions are replicated in the Jenkins instance. |
| 22 | +Labels and descriptions of the folders implied by that structure can be specified in the [Seed Job](JenkinsJobs/seedJob.jenkinsfile): |
| 23 | +https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/9a0ef15799eb3420d748a54d8719ca08c3c7b5af/JenkinsJobs/seedJob.jenkinsfile#L19-L26 |
| 24 | + |
| 25 | +Multiple build and test jobs have the release version in the job name because it is required for result parsing, e.g. the [automated tests](https://ci.eclipse.org/releng/job/AutomatedTests/). |
| 26 | +In order to minimize constant adjustments of the job definitions the active streams are configured through the [buildConfigurations.json](JenkinsJobs/buildConfigurations.json) file. |
| 27 | +This file is used to create the versioned build and test jobs and is also read by these jobs during their execution for detailed configuration. |
| 28 | + |
| 29 | +### New Jobs |
| 30 | + |
| 31 | +Adding a job to Jenkins should be as easy as adding a new `.jenkinsfile` file to git, but here are some general points to consider. |
| 32 | + |
| 33 | +- Use **only CamelCase in filenames**, no spaces or dashes (it breaks JobDSL). |
| 34 | +- The job Names/IDs (used in the job URL) are the same as the names of the `.jenkinsfile` files, without `.jenkinsfile` extension. |
| 35 | +- The display names are derived from that filenames by inserting spaces before each uppercase letter. |
| 36 | + - The generated display name can be overwritten by a static `_JOB_DISPLAY_NAME` field. |
| 37 | +- Similarly the job's description can be defined using a static `_JOB_DESCRIPTION` field. |
| 38 | + |
| 39 | +* **Script Formatting** You can use `'''`triple apostrophes`'''` to define multiline scripts. It's best to append a back-slash to prevent a blank line at the top of the script step in Jenkins. |
| 40 | +* To see what plugins are installed and what methods are available in the Releng Jenkins you can consult the [api viewer](https://ci.eclipse.org/releng/plugin/job-dsl/api-viewer/index.html). |
25 | 41 |
|
26 | | -**New Jobs** |
| 42 | +### Testing new Jobs or trying out changes before production |
27 | 43 |
|
28 | | -Adding a job to Jenkins should be as easy as adding a new groovy file to git, but here are some general pointers. |
| 44 | +Just like regular code, new changes or changes on jobs should be tested in a 'testing' environment before being used in production. |
| 45 | +As we don't have a dedicated testing environment, the regular [RelEng Jeninks](https://ci.eclipse.org/releng/) has to be used, |
| 46 | +but one can use a 'testing' copy of the final job that doesn't have any effect on the production environment. |
| 47 | +A testing job has to be created manually in the Jenkins UI and will only exist temporarily for the time of testing. |
| 48 | +It's recommended to put your name in the job's name to help others identifying the responsible person, in case you forgot to clean it up later. |
| 49 | +In the testing job you can use another source for the Jenkins file, for example your fork of this repo and another branch. |
29 | 50 |
|
30 | | -* **No dashes in filenames**, it breaks JobDSL. If there was a `-` in the job name I changed it to `_` in the file name. |
31 | | -* **Job Names** |
32 | | - - No spaces, this is just for the good of scripts etc. The job NAME is used in the url, but you can always add a `displayName` field if you want the job to appear with a more natural looking name on the page. See (Releng/deployToMaven)[JenkinsJobs/Releng/FOLDER.groovy] as an example. |
33 | | - - The folder needs to be part of the job name, otherwise Jenkins will just create the job at the dashboard level. |
34 | | -* **job vs pipelineJob** |
35 | | - - Anything that can build on a regular jenkins node or via an available lable uses the [job](https://jenkinsci.github.io/job-dsl-plugin/#path/job) template. |
36 | | - - Anything that defines its own kubernetes pod needs to be a [pipelineJob](https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob) |
37 | | -* **Script Formatting** You can use `'''`triple apostrophes`'''` to define multiline scripts. I've found it's best to start the script on the same line and not the next, otherwise you end up with blank space at the top of the script step in Jenkins which can break the build (like the arm64 smoke tests). |
38 | | -* To see what plugins are installed and what methods are available in the Releng Jenkins you can consult the [api viewer](https://ci.eclipse.org/releng/plugin/job-dsl/api-viewer/index.html). |
| 51 | +**Make sure your testing job does not have an effect on the production environment** |
39 | 52 |
|
| 53 | +'Disable' all steps that have any effect on the production environment or redirect them to a testing environment too |
| 54 | +- Disable `git push`. Use `--dry-run` or comment out |
| 55 | +- Disable modification at the download server via `ssh` or `scp` or redirect changes to a 'try-out' area, which is hidden from the public |
| 56 | + - Some jobs already have a `DRY_RUN` parameter that deploy to `https://download.eclipse.org/eclipse/try-outs/`. |
| 57 | +- Don't send mails to mailing lists via the `emailext` step, instead just send a mail to your private mail directly. |
| 58 | +- Disable triggers for other jobs that may modify the production environment |
40 | 59 |
|
41 | 60 | # Updating Java Versions |
42 | 61 |
|
43 | | -Every 6 months there is a new Java release which requires additional builds and testing. The java release usually corresponds to odd numbered streams so a new java version would be tested in additional builds run during the 4.25 stream and then included in the 4.26 release I-builds. |
| 62 | +Every 6 months there is a new Java release which requires additional builds and testing. |
| 63 | +The Java release usually corresponds to odd numbered streams so a new Java version would be tested in separated builds run during the 4.41 stream and will then be included in the main line of the 4.42 release. |
44 | 64 |
|
45 | | -## **Y and P Builds** |
46 | | -The **Y-build** is a full sdk build with the new java version for testing. |
| 65 | +## Y and P Builds |
| 66 | +The **Y-build** is a full Eclipse-SDK build with the support of the new Java version included for testing. |
47 | 67 |
|
48 | | -The **P-build** is a patch build that contains modified plugins designed to be installed on top of the current I-build to test the new java version. |
| 68 | +The **P-build** is a patch build that contains modified plugins designed to be installed on top of the current I-build to use the new java version support as early as possible. |
49 | 69 | They are now managed by the JDT-project itself in [org.eclipse.jdt.releng](https://github.com/eclipse-jdt/eclipse.jdt/tree/master/org.eclipse.jdt.releng). |
50 | 70 |
|
51 | | -The builds themselves and their unit tests are in the [build.jenkinsfile](./JenkinsJobs/Builds/build.jenkinsfile) in GitHub and the [Y Builds](https://ci.eclipse.org/releng/job/YBuilds/) folder in jenkins. |
| 71 | +The Y-build themselves and their unit tests are, just like the regular I-builds, defined in the [build.jenkinsfile](./JenkinsJobs/Builds/build.jenkinsfile) respectively the [integrationTests.jenkinsfile](./JenkinsJobs/AutomatedTests/integrationTests.jenkinsfile) in git |
| 72 | +and used for the [Y Builds](https://ci.eclipse.org/releng/job/YBuilds/) folder in Jenkins. |
52 | 73 |
|
53 | 74 | ## Setting Up New Builds |
54 | 75 |
|
|
0 commit comments