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

Revamp build/CI #1097

Merged
merged 3 commits into from
Apr 5, 2023
Merged

Revamp build/CI #1097

merged 3 commits into from
Apr 5, 2023

Conversation

basil
Copy link
Member

@basil basil commented Apr 5, 2023

Fixes #736. Preparatory work for #963. See self-review for details.

High-level changes:

  • Retry CI stage on agent failure, consistent with other jobs.
  • Publish incrementals, just like other jobs.
  • Set maven.repo.local inside WORKSPACE_TMP in CI, just like Set maven.repo.local inside WORKSPACE_TMP in CI bom#1842.
  • Define jenkins.version in pom.xml, where user-submitted PRs may set it to an incremental build. This version will be updated by Dependabot.
  • Define an LTS Maven profile with the LTS version. This will need to be updated by the release lead after shipping an LTS.
  • When latest, lts, or a version number are provided, have run.sh delegate to Maven rather than trying to do the download itself. Continue to support usages of a URL or a filesystem path to the WAR.
  • Update documentation.
  • Observe MAVEN_SETTINGS, if set. This is preparatory work for Use Jenkins project mirrors / caches #963.

@basil basil force-pushed the revamp-build-ci branch 4 times, most recently from eeceb34 to 6d87e07 Compare April 5, 2023 02:42
@basil basil force-pushed the revamp-build-ci branch from 6d87e07 to 9cf6bee Compare April 5, 2023 02:59
node('maven-11') {
checkout scm
sh "mvn verify --no-transfer-progress -DskipTests -P jenkins-release"
retry(count: 2, conditions: [kubernetesAgent(handleNonKubernetes: true), nonresumable()]) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Consistent with core and BOM: even though in practice these are Kubernetes agents, we respect the contract provided by the infrastructure team by not relying on this implementation detail.

node('maven-11') {
checkout scm
def mavenOptions = [
'-Dset.changelist',
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed for producing incrementals.

Comment on lines +44 to +45
'clean',
'install',
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed for infra.prepareToPublishIncrementals() (as opposed to verify).

'clean',
'install',
]
infra.runMaven(mavenOptions, 11)
Copy link
Member Author

Choose a reason for hiding this comment

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

Internally respects MAVEN_SETTINGS, preparing for the potential use of the artifact caching proxy.

@@ -71,7 +81,7 @@ for (int i = 0; i < splits.size(); i++) {
set-java.sh $javaVersion
eval \$(vnc.sh)
java -version
run.sh firefox ${jenkinsUnderTest} -Dmaven.test.failure.ignore=true -DforkCount=1 -B
run.sh firefox ${jenkinsUnderTest} -Dmaven.repo.local=${WORKSPACE_TMP}/m2repo -Dmaven.test.failure.ignore=true -DforkCount=1 -B
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +366 to +383
<!--
This is just for dependency updates.

TODO: Delete this dependency and figure out how to automatically update
this dependency some other way.
-->
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>${jenkins.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Copy link
Member Author

Choose a reason for hiding this comment

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

Copying the trick I did in plugin-compat-tester to define an unused test-scoped dependency to get Dependabot to automatically update jenkins.version (actually used further below by the copy mojo, which Dependabot can't update). I have confirmed this trick works. I am not interested in learning how to use any other dependency updating tools. I trust that those who are enthusiastic about other tools can find a better way to do this after this PR lands (or stick with this solution, which is "good enough", if they are not interested).

<profile>
<id>lts</id>
<properties>
<jenkins.version>2.387.1</jenkins.version>
Copy link
Member Author

Choose a reason for hiding this comment

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

This will need to be updated by the release lead after shipping an LTS release, just like in BOM.

Copy link
Member

Choose a reason for hiding this comment

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

Filed #1098 for later improvement

Comment on lines +29 to +32
MVN='mvn -V -e -ntp'
if [[ -n ${MAVEN_SETTINGS-} ]]; then
MVN="${MVN} -s ${MAVEN_SETTINGS}"
fi
Copy link
Member Author

Choose a reason for hiding this comment

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

Observe MAVEN_SETTINGS if defined in preparation for #963.

Comment on lines +810 to +846
<profile>
<id>download-war</id>
<activation>
<file>
<missing>${env.JENKINS_WAR}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>jenkins-war</id>
<goals>
<goal>copy</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-war</artifactId>
<version>${jenkins.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Copy link
Member Author

Choose a reason for hiding this comment

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

If you are reading this PR from top to bottom, this hunk will only make sense after you have read the changes to run.sh.

Comment on lines +63 to +66
*.war)
download "$war" "jenkins.war" || exit 1
war=jenkins.war
;;
Copy link
Member Author

Choose a reason for hiding this comment

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

Due to the [[ ! -f $war ]]; then a few lines above, this is the case statement for URLs, not local file paths.

@basil
Copy link
Member Author

basil commented Apr 5, 2023

Used my admin powers to replay the build with the Jenkinsfile changes here: https://ci.jenkins.io/job/Core/job/acceptance-test-harness/job/PR-1097/12/

@basil basil marked this pull request as ready for review April 5, 2023 04:28
@timja timja enabled auto-merge (squash) April 5, 2023 07:52
@timja timja merged commit 3bb860d into jenkinsci:master Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a fixed version of core in tests and automate updates to it
2 participants