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 publishing of incremental builds #627

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals-with-minimal-flattening
28 changes: 20 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
properties([buildDiscarder(logRotator(numToKeepStr: '20'))])
properties([
buildDiscarder(logRotator(numToKeepStr: '10')),
disableConcurrentBuilds(abortPrevious: true)
])

node('maven-11') {
checkout scm
stage('Checkout') {
infra.checkoutSCM()
}

stage('Build') {
timeout(time: 1, unit: 'HOURS') {
// TODO Azure mirror
ansiColor('xterm') {
withEnv(['MAVEN_OPTS=-Djansi.force=true']) {
sh 'mvn -B -Dstyle.color=always -ntp clean verify'
}
}
def mavenOptions = [
'-Dset.changelist',
'clean',
'install',
]
infra.runMaven(mavenOptions, 11)
infra.prepareToPublishIncrementals()
}
}
}

infra.maybePublishIncrementals()
107 changes: 102 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@

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

<name>Jenkins Plugin Parent POM</name>
<description>The Jenkins Plugins Parent POM Project</description>
<inceptionYear>2016</inceptionYear>

<scm>
<connection>scm:git:https://github.com/jenkinsci/plugin-pom.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/plugin-pom.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/jenkinsci/plugin-pom</url>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>

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

<properties>
<revision>4.50</revision>
<changelist>-SNAPSHOT</changelist>
Comment on lines +57 to +58
Copy link
Member

Choose a reason for hiding this comment

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

Fine but why not enable CD then? The only reason to hold off was the fear of regressions from incrementalification, not CD per se.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not a fan of the version numbers used in JEP-229 releases.

Copy link
Member

Choose a reason for hiding this comment

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

🤷 well if this change is released and seems to cause no problems, I will propose CD at some point since the POMs are the last major thing that we have to release manually (Jenkins core being handled specially), and as developer-only artifacts their version aesthetics should be of the least concern.

Copy link
Member Author

Choose a reason for hiding this comment

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

I should have mentioned that I am not a fan of JEP-229 more generally. The labeling scheme and automatically generated change logs have long been a source of frustration for me. If I have the choice between using JEP-229 and avoiding it, I will choose to avoid it.

Copy link
Member

Choose a reason for hiding this comment

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

automatically generated change logs

I am confused by that comment in this context, as we already do the same in this repository:

update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into the default branch
- uses: release-drafter/release-drafter@v5

Anyway this is getting off topic; assuming that the testing done for this PR was sufficient, it seems like a clear benefit even while keeping the MRP flow. (On occasion I had tested against timestamped snapshots for proposed POM updates but it gets ugly.)

<gitHubRepo>jenkinsci/plugin-pom</gitHubRepo>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -1471,6 +1474,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,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if upstream https://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html#flattenMode could use a new value, or is our usage just sufficiently weird to not be of interest to anyone else?

Copy link
Member Author

Choose a reason for hiding this comment

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

I doubt anyone else would want to use this particular configuration.

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>1.4</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>display-info</id>
<configuration>
<rules>
<rule implementation="io.jenkins.tools.incrementals.enforcer.RequireExtensionVersion">
<version>[1.0-beta-4,)</version>
Comment on lines +1554 to +1555
Copy link
Member

Choose a reason for hiding this comment

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

Could probably be dropped since I guess we do not expect this profile to ever be used inherited, only locally.

Copy link
Member Author

Choose a reason for hiding this comment

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

But that would increase the differential between this profile and the copypasta from which it originated, for no good reason I think. Better to keep all copies of this code as similar as possible I think.

</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