Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
reda-alaoui committed Sep 17, 2024
1 parent be06708 commit d12b988
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 517 deletions.
1 change: 1 addition & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
_extends: .github
tag-template: demo-$NEXT_MINOR_VERSION
15 changes: 0 additions & 15 deletions .github/workflows/cd.yaml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Jenkins Security Scan
# More information about the Jenkins security scan can be found at the developer docs: https://www.jenkins.io/redirect/jenkins-security-scan/

name: Jenkins Security Scan
on:
push:
branches:
- master
- "master"
- "main"
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
Expand All @@ -18,4 +20,4 @@ jobs:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.
java-version: 11 # What version of Java to set up for the build.
17 changes: 17 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Automates creation of Release Drafts using Release Drafter
# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc

on:
push:
branches:
- master
- main

jobs:
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 7 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
buildPlugin()
buildPlugin(
useContainerAgent: false, // Set to `false` if you need to use Docker for containerized tests
failFast: false,
configurations: [
[platform: 'linux', jdk: 21],
]
)
22 changes: 7 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.32</version>
<version>4.87</version>
<relativePath/>
</parent>

Expand All @@ -18,17 +18,14 @@
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.277.4</jenkins.version>
<java.level>8</java.level>
<jenkins-test-harness.version>1674.v3b8b1441e939</jenkins-test-harness.version>
<jenkins.version>2.361.4</jenkins.version>
<!-- Other properties you may want to use:
~ hpi-plugin.version: The HPI Maven Plugin version used by the plugin..
~ stapler-plugin.version: The Stapler Maven plugin version required by the plugin.
-->
<httpclient.version>4.5.13</httpclient.version>
<httpclient.version>4.5.14</httpclient.version>
<gson.version>2.8.8</gson.version>
<gerrit-trigger.version>2.35.0</gerrit-trigger.version>
<guava.version>23.0</guava.version>
<gerrit-rest-java-client.version>0.9.4.0</gerrit-rest-java-client.version>
<junit.jupiter.version>5.10.2</junit.jupiter.version>
<testcontainers.version>1.16.2</testcontainers.version>
Expand All @@ -37,7 +34,7 @@

<git-code-format-maven-plugin.version>2.7</git-code-format-maven-plugin.version>
<assertj-core.version>3.21.0</assertj-core.version>
<logback-classic.version>1.2.3</logback-classic.version>
<logback-classic.version>1.5.8</logback-classic.version>
<sonar-ws-shaded.version>7.7.0</sonar-ws-shaded.version>
</properties>

Expand All @@ -48,8 +45,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.249.x</artifactId>
<version>984.vb5eaac999a7e</version>
<artifactId>bom-2.361.x</artifactId>
<version>2102.v854b_fec19c92</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -66,7 +63,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
<version>2.0.15</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -122,7 +119,6 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>me.redaalaoui.gerrit_rest_java_client</groupId>
Expand All @@ -138,14 +134,12 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- Needed to keep jenkins-test-assertion working (see https://github.com/jenkinsci/jenkins-test-harness/pull/375) -->
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -183,7 +177,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -194,7 +187,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>durable-task</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void perform(
} catch (RestApiException e) {
LOGGER.log(Level.SEVERE, e, () -> "Unable to post review: " + e.getMessage());
throw new AbortException("Unable to post review: " + e.getMessage());
} catch (NullPointerException | IllegalArgumentException | IllegalStateException e) {
} catch (IllegalArgumentException | IllegalStateException e) {
LOGGER.log(Level.SEVERE, e, e::getMessage);
throw new IOException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,24 @@ static void beforeAll(Cluster cluster, @TempDir Path workTree) throws Exception
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<project>\n"
+ " <modelVersion>4.0.0</modelVersion>\n"
+ "\n"
+ " <groupId>org.example</groupId>\n"
+ " <artifactId>example</artifactId>\n"
+ " <version>1.0-SNAPSHOT</version>\n"
+ " <build>\n"
+ " <plugins>\n"
+ " <plugin>\n"
+ " <groupId>org.apache.maven.plugins</groupId>\n"
+ " <artifactId>maven-compiler-plugin</artifactId>\n"
+ " <version>3.12.1</version>\n"
+ " </plugin>\n"
+ " </plugins>\n"
+ " </build>\n"
+ "</project>");

git.push();

FreeStyleProject masterJob = cluster.jenkinsRule().createFreeStyleProject();
masterJob.setJDK(Jenkins.get().getJDK(cluster.jenkinsJdk8InstallationName()));
masterJob.setJDK(Jenkins.get().getJDK(cluster.jenkinsJdk17InstallationName()));
masterJob.setScm(createGitSCM());
masterJob
.getBuildWrappersList()
Expand Down Expand Up @@ -163,7 +171,7 @@ private Job createPipelineJob(GerritChange change) throws IOException {
"withSonarQubeEnv('%s') {\n", cluster.jenkinsSonarqubeInstallationName())
+ String.format(
"withMaven(jdk: '%s', maven: '%s') {\n",
cluster.jenkinsJdk8InstallationName(), cluster.jenkinsMavenInstallationName())
cluster.jenkinsJdk17InstallationName(), cluster.jenkinsMavenInstallationName())
+ String.format("sh \"mvn %s\"\n", MAVEN_TARGET)
+ "}\n" // withMaven
+ "}\n" // withSonarQubeEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ static void beforeAll(Cluster cluster, @TempDir Path workTree) throws Exception
+ " <version>1.0-SNAPSHOT</version>\n"
+ " <packaging>pom</packaging>"
+ "\n"
+ " <build>\n"
+ " <plugins>\n"
+ " <plugin>\n"
+ " <groupId>org.apache.maven.plugins</groupId>\n"
+ " <artifactId>maven-compiler-plugin</artifactId>\n"
+ " <version>3.12.1</version>\n"
+ " </plugin>\n"
+ " </plugins>\n"
+ " </build>\n"
+ "<modules>\n"
+ "<module>child1</module>"
+ "</modules>"
Expand All @@ -87,7 +96,7 @@ static void beforeAll(Cluster cluster, @TempDir Path workTree) throws Exception
git.push();

FreeStyleProject masterJob = cluster.jenkinsRule().createFreeStyleProject();
masterJob.setJDK(Jenkins.get().getJDK(cluster.jenkinsJdk8InstallationName()));
masterJob.setJDK(Jenkins.get().getJDK(cluster.jenkinsJdk17InstallationName()));
masterJob.setScm(createGitSCM());
masterJob
.getBuildWrappersList()
Expand Down Expand Up @@ -240,7 +249,7 @@ private Job createPipelineJob(
"withSonarQubeEnv('%s') {\n", cluster.jenkinsSonarqubeInstallationName())
+ String.format(
"withMaven(jdk: '%s', maven: '%s') {\n",
cluster.jenkinsJdk8InstallationName(), cluster.jenkinsMavenInstallationName())
cluster.jenkinsJdk17InstallationName(), cluster.jenkinsMavenInstallationName())
+ String.format("sh \"mvn %s\"\n", MAVEN_TARGET)
+ "}\n" // withMaven
+ "}\n" // withSonarQubeEnv
Expand Down
Loading

0 comments on commit d12b988

Please sign in to comment.