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

Update defectdojo hook to jdk 17 #1228

Merged
merged 5 commits into from
Jun 23, 2022
Merged

Update defectdojo hook to jdk 17 #1228

merged 5 commits into from
Jun 23, 2022

Conversation

the-simmon
Copy link
Contributor

This PR updates the Defectdojo hook to JDK 17. Closes #1054

First I updated the Gradle Version we use to the newest because the version we use currently does not support JDK 17. Doing this I got an error regarding lombok about some unexported modules.
java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x2c90820d) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x2c90820d
I updated lombok to the newest version and it fixed the error. (I guess the old lombok version used some deprecated apis).

Another error occurred: Entry META-INF/LICENSE is a duplicate but no duplicate handling strategy has been set. I used this solution from Stackoverflow: duplicatesStrategy = DuplicatesStrategy.EXCLUDE in build.gradle.
Maybe there is a different solution but for now it works.

After this the build works. The unit test succeed and I also tested the hook locally and it successfully uploaded findings into a local Defectdojo instance.
Additionally I noticed that there are no integration tests defined (so no hook.test.js file is presented). Running make test which will run make integration-tests has weird behavior then. Jest will run the integration tests of all hooks which fails. I overwrote the ìntegration-tests target to stop this behavior. Now make testonly runs the correct hook tests for the defectdojo hook.

Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
@github-actions
Copy link

github-actions bot commented Jun 20, 2022

MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 1 0 0.2s
✅ DOCKERFILE dockerfilelint 1 0 0.39s
✅ DOCKERFILE hadolint 1 0 0.05s
✅ GIT git_diff yes no 0.14s
✅ GROOVY npm-groovy-lint 1 0 6.23s
✅ SPELL misspell 5 0 0.05s
✅ YAML prettier 2 0 0.79s
✅ YAML v8r 2 0 2.42s
✅ YAML yamllint 2 0 0.3s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
@the-simmon the-simmon marked this pull request as ready for review June 20, 2022 17:28
@the-simmon the-simmon self-assigned this Jun 20, 2022
@the-simmon the-simmon added persistence Implement or update a persistence store maintenance hook Implement or update a hook defectdojo All issues regarding the DefectDojo Integration planned Issues we will do in the next sprint. labels Jun 20, 2022
@the-simmon the-simmon added this to Backlog in secureCodeBox v3 via automation Jun 20, 2022
@the-simmon the-simmon moved this from Backlog to To Review in secureCodeBox v3 Jun 20, 2022
@the-simmon the-simmon changed the title Maintenance/defectdojo hook Update defectdojo hook to jdk 17 Jun 20, 2022
SebieF
SebieF previously requested changes Jun 21, 2022
Copy link
Contributor

@SebieF SebieF left a comment

Choose a reason for hiding this comment

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

MegaLinter is complaining about the ci.yaml file, maybe you could take a look at that?

Besides that: Looks good to me, also good job at testing very extensively!


.PHONY: integration-tests
integration-tests: ## 🩺 Start integration test for this module in the namespace "integration-tests"
@echo "No integration tests for $(hook) defined!"
Copy link
Contributor

Choose a reason for hiding this comment

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

No newline at the end of the file

@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0

FROM gradle:jdk11 as build
FROM gradle:jdk17 as build
COPY . /home/gradle/src
WORKDIR /home/gradle/src
RUN ./gradlew build -x test
Copy link
Member

Choose a reason for hiding this comment

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

Can you also update the distroless image to java 17? 🙏

Copy link
Member

Choose a reason for hiding this comment

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

(Relevant code is in line 10, github didn't let me comment there) :)

Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
secureCodeBox v3 automation moved this from To Review to Reviewer approved Jun 23, 2022
@J12934 J12934 merged commit c878c89 into main Jun 23, 2022
secureCodeBox v3 automation moved this from Reviewer approved to Done Jun 23, 2022
@J12934 J12934 deleted the maintenance/defectdojo_hook branch June 23, 2022 09:13
@the-simmon the-simmon moved this from Done to counter in secureCodeBox v3 Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defectdojo All issues regarding the DefectDojo Integration hook Implement or update a hook maintenance persistence Implement or update a persistence store planned Issues we will do in the next sprint.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔧 Maintainance: Upgrade DefectDojo Hook to Java 17
3 participants