Skip to content

Commit

Permalink
chore: Update Jenkins to LTS; Update plugin version to latest; Java11…
Browse files Browse the repository at this point in the history
… requirement; Update depedencies
  • Loading branch information
j-luong committed Aug 22, 2023
1 parent 662faa7 commit 114a31c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM adoptopenjdk/openjdk8 as build
FROM adoptopenjdk/openjdk11 as build
# use local mvn repo to speedup build
COPY .m2 /root/.m2
WORKDIR /app
Expand Down Expand Up @@ -34,5 +34,3 @@ COPY --from=build /app/target/snyk-security-scanner.* /usr/share/jenkins/ref/plu

EXPOSE 8080
EXPOSE 50000


3 changes: 2 additions & 1 deletion .github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}")
pushd "$SCRIPT_RELATIVE_DIR"/.. || exit 1
# use local .m2 repo to speed up build
rsync -crlDv ~/.m2 ./.m2
docker build -t jenkins-snyk -f .github/Dockerfile .
# --platform linux/amd64 is required for M1 Macs
docker build --platform linux/amd64 -t jenkins-snyk -f .github/Dockerfile .
rm -rf ./.m2
popd || exit
6 changes: 5 additions & 1 deletion .github/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}")
pushd "$SCRIPT_RELATIVE_DIR"/.. || exit 1
HOST="http://$(echo "$DOCKER_HOST" | cut -f3 -d "/" | cut -f1 -d":"):8080"
echo "Please connect to IP address $HOST"
docker run --rm -p 8080:8080 -p 50000:50000 --name=jenkins-snyk jenkins-snyk
# --platform linux/amd64 is required for M1 Macs
# to persist data:
# create a volume using docker `volume create <VOLUME_NAME>`
# mount the volume via docker run command using `-v <VOLUME_NAME>:/var/jenkins_home`
docker run -rm --platform linux/amd64 -p 8080:8080 -p 50000:50000 --name=jenkins-snyk jenkins-snyk
popd || exit
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
java-version: '11'
distribution: 'adopt'
- uses: actions/cache@v2
with:
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.17.0
hooks:
- id: gitleaks
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */
buildPlugin(configurations: [
[ platform: "linux", jdk: "8" ],
[ platform: "windows", jdk: "8" ],
[ platform: "linux", jdk: "8", jenkins: "2.289.3", javaLabel: 8 ],
[ platform: "windows", jdk: "8", jenkins: "2.289.3", javaLabel: 8 ]
[ platform: "linux", jdk: "11" ],
[ platform: "windows", jdk: "11" ],
[ platform: "linux", jdk: "11", jenkins: "2.401.3", javaLabel: 11 ],
[ platform: "windows", jdk: "11", jenkins: "2.401.3", javaLabel: 11 ]
])
27 changes: 22 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.19</version>
<version>4.71</version>
</parent>

<properties>
<jenkins.version>2.289.3</jenkins.version>
<java.level>8</java.level>
<configuration-as-code.version>1.51</configuration-as-code.version>
<jenkins.version>2.401.3</jenkins.version>
<!-- java11 required since 2.357:
https://www.jenkins.io/blog/2022/06/28/require-java-11/ -->
<java.level>11</java.level>
<configuration-as-code.version>1670.v564dc8b_982d0</configuration-as-code.version>
<surefire.rerunFailingTestsCount>0</surefire.rerunFailingTestsCount>
<!-- skip as there is no signature for java11:
https://mvnrepository.com/search?q=org.codehaus.mojo.signature&p=1 -->
<skipAnimalSniffer>true</skipAnimalSniffer>
</properties>

<groupId>io.snyk.plugins</groupId>
Expand Down Expand Up @@ -41,7 +46,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
Expand Down Expand Up @@ -90,6 +95,10 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>${java.level}</target>
<source>${java.level}</source>
<testTarget>${java.level}</testTarget>
<testSource>${java.level}</testSource>
<compilerArgs>
<arg>-Xlint:all,-options,-path</arg>
</compilerArgs>
Expand All @@ -115,6 +124,14 @@
<minimumJavaVersion>1.8</minimumJavaVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<configuration>
<skip>${skipAnimalSniffer}</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 114a31c

Please sign in to comment.