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

Enable incremental builds #334

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.4</version>
</extension>
</extensions>
2 changes: 2 additions & 0 deletions .mvn/maven.config
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals-with-minimal-flattening
42 changes: 20 additions & 22 deletions Jenkinsfile
@@ -1,26 +1,24 @@
#!/usr/bin/env groovy
properties([
buildDiscarder(logRotator(numToKeepStr: '10')),
disableConcurrentBuilds(abortPrevious: true)
])

/* Only keep the 10 most recent builds. */
properties([[$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']]])
node('maven-11') {
stage('Checkout') {
infra.checkoutSCM()
}


node('java') {
timestamps {
stage('Checkout') {
checkout scm
}

stage('Build') {
withEnv([
"JAVA_HOME=${tool 'jdk11'}",
"PATH+MVN=${tool 'mvn'}/bin",
'PATH+JDK=$JAVA_HOME/bin',
]) {
timeout(30) {
sh 'mvn clean install versions:display-plugin-updates'
}
}
}
stage('Build') {
timeout(time: 30, unit: 'MINUTES') {
def mavenOptions = [
'-Dset.changelist',
'clean',
'install',
]
infra.runMaven(mavenOptions, 11)
infra.prepareToPublishIncrementals()
}
}
}

infra.maybePublishIncrementals()
107 changes: 102 additions & 5 deletions pom.xml
Expand Up @@ -5,7 +5,7 @@

<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.91-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<packaging>pom</packaging>

<name>Jenkins Parent POM</name>
Expand Down Expand Up @@ -44,10 +44,10 @@
</mailingLists>

<scm>
<connection>scm:git:https://github.com/jenkinsci/pom.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/pom.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/jenkinsci/pom</url>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>

<issueManagement>
Expand All @@ -73,6 +73,9 @@
</distributionManagement>

<properties>
<revision>1.91</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/pom</gitHubRepo>
<!-- By default only check remote repositories once per week -->
<maven.repository.update.freqency>interval:10080</maven.repository.update.freqency>

Expand Down Expand Up @@ -935,6 +938,100 @@
</plugins>
</build>
</profile>
<!--
A profile that is identical to "might-produce-incrementals" but with "flatten-maven-plugin"
configured to interpolate variables in the "scm", "url", and "version" elements and keep all
other elements untouched. This is only intended to be used with repositories like "pom" and
"plugin-pom". If the POM from these repositories were flattened with the "oss" flatten mode,
then the resulting incremental build would be missing critical sections and would not be
suitable for consumers. If the "scm", "url", and "version" elements were not interpolated,
then the resulting incremental build would contain e.g. an SCM tag of "${scmTag}" and could
not be published to the incrementals repository.
-->
<profile>
<id>might-produce-incrementals-with-minimal-flattening</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<id>flatten</id>
<goals>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<keepCommentsInPom>true</keepCommentsInPom>
<pomElements>
<build>keep</build>
<ciManagement>keep</ciManagement>
<contributors>keep</contributors>
<dependencies>keep</dependencies>
<dependencyManagement>keep</dependencyManagement>
<description>keep</description>
<developers>keep</developers>
<distributionManagement>keep</distributionManagement>
<inceptionYear>keep</inceptionYear>
<issueManagement>keep</issueManagement>
<mailingLists>keep</mailingLists>
<modules>keep</modules>
<name>keep</name>
<organization>keep</organization>
<parent>keep</parent>
<pluginManagement>keep</pluginManagement>
<pluginRepositories>keep</pluginRepositories>
<prerequisites>keep</prerequisites>
<profiles>keep</profiles>
<properties>keep</properties>
<reporting>keep</reporting>
<repositories>keep</repositories>
<scm>interpolate</scm>
<url>interpolate</url>
<version>interpolate</version>
</pomElements>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>${project.artifactId}-${project.version}.pom</flattenedPomFilename>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>incrementals-enforcer-rules</artifactId>
<version>${incrementals-plugin.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>display-info</id>
<configuration>
<rules>
<rule implementation="io.jenkins.tools.incrementals.enforcer.RequireExtensionVersion">
<version>[${incrementals-enforce-minimum.version},)</version>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<completionGoals>incrementals:reincrementalify</completionGoals>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>produce-incrementals</id>
<activation>
Expand Down