Skip to content

Commit cb08f8d

Browse files
committed
Initial commit
0 parents  commit cb08f8d

File tree

218 files changed

+67055
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+67055
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_1.dtd">
5+
<suppressions>
6+
<!-- Suppress checks for generated code -->
7+
<suppress checks=".*" files="[\\/]target[\\/]generated-sources[\\/]" />
8+
<suppress checks=".*" files="[\\/]target[\\/]generated-test-sources[\\/]" />
9+
10+
<!-- Suppress line length for OpenAPI generated models -->
11+
<suppress checks="LineLength" files=".*[\\/]api[\\/].*\.java" />
12+
</suppressions>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//OWASP//DTD Dependency-Check Suppression 1.3//EN"
4+
"https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.dtd">
5+
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
6+
<!-- Add suppressions for false positives here -->
7+
<!-- Example:
8+
<suppress>
9+
<notes>False positive - not applicable to our usage</notes>
10+
<cve>CVE-2021-12345</cve>
11+
</suppress>
12+
-->
13+
</suppressions>

.github/pmd-ruleset.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Custom PMD Rules"
3+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
6+
7+
<description>PMD rules for the project</description>
8+
9+
<!-- Basic rules -->
10+
<rule ref="category/java/bestpractices.xml">
11+
<exclude name="JUnitAssertionsShouldIncludeMessage"/>
12+
<exclude name="JUnitTestContainsTooManyAsserts"/>
13+
</rule>
14+
15+
<rule ref="category/java/codestyle.xml">
16+
<exclude name="AtLeastOneConstructor"/>
17+
<exclude name="OnlyOneReturn"/>
18+
<exclude name="LongVariable"/>
19+
<exclude name="ShortVariable"/>
20+
<exclude name="CommentDefaultAccessModifier"/>
21+
<exclude name="CallSuperInConstructor"/>
22+
</rule>
23+
24+
<rule ref="category/java/design.xml">
25+
<exclude name="LawOfDemeter"/>
26+
<exclude name="LoosePackageCoupling"/>
27+
<exclude name="DataClass"/>
28+
</rule>
29+
30+
<rule ref="category/java/errorprone.xml"/>
31+
32+
<rule ref="category/java/multithreading.xml"/>
33+
34+
<rule ref="category/java/performance.xml"/>
35+
36+
<rule ref="category/java/security.xml"/>
37+
38+
<!-- Exclude generated sources -->
39+
<exclude-pattern>.*/target/generated-sources/.*</exclude-pattern>
40+
<exclude-pattern>.*/target/generated-test-sources/.*</exclude-pattern>
41+
</ruleset>

.github/spotbugs-exclude.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<FindBugsFilter>
3+
<!-- Exclude generated code from analysis -->
4+
<Match>
5+
<Source name="~.*[\\/]target[\\/]generated-sources[\\/].*" />
6+
</Match>
7+
<Match>
8+
<Source name="~.*[\\/]target[\\/]generated-test-sources[\\/].*" />
9+
</Match>
10+
11+
<!-- Exclude test resources -->
12+
<Match>
13+
<Source name="~.*[\\/]test[\\/]resources[\\/].*" />
14+
</Match>
15+
16+
<!-- Example: Suppress specific bug patterns -->
17+
<!-- Uncomment and modify as needed
18+
<Match>
19+
<Bug pattern="NP_NULL_ON_SOME_PATH" />
20+
</Match>
21+
-->
22+
23+
<!-- Example: Suppress for specific classes -->
24+
<!--
25+
<Match>
26+
<Class name="com.example.SpecificClass" />
27+
<Bug pattern="DM_STRING_CTOR" />
28+
</Match>
29+
-->
30+
</FindBugsFilter>
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<!--
2+
STATIC ANALYSIS POM.XML ADDITIONS
3+
4+
Add these configurations to your root pom.xml to enable all static analysis tools.
5+
Replace the existing spotbugs plugin configuration if present.
6+
-->
7+
8+
<!-- ============================================== -->
9+
<!-- 1. ADD TO <properties> SECTION -->
10+
<!-- ============================================== -->
11+
<checkstyle.version>10.12.5</checkstyle.version>
12+
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
13+
<maven-pmd-plugin.version>3.21.2</maven-pmd-plugin.version>
14+
<pmd.version>6.55.0</pmd.version>
15+
<dependency-check-maven.version>9.0.7</dependency-check-maven.version>
16+
17+
18+
<!-- ============================================== -->
19+
<!-- 2. ADD TO <build><pluginManagement><plugins> -->
20+
<!-- ============================================== -->
21+
<plugin>
22+
<groupId>org.apache.maven.plugins</groupId>
23+
<artifactId>maven-checkstyle-plugin</artifactId>
24+
<version>${maven-checkstyle-plugin.version}</version>
25+
<dependencies>
26+
<dependency>
27+
<groupId>com.puppycrawl.tools</groupId>
28+
<artifactId>checkstyle</artifactId>
29+
<version>${checkstyle.version}</version>
30+
</dependency>
31+
</dependencies>
32+
</plugin>
33+
<plugin>
34+
<groupId>org.apache.maven.plugins</groupId>
35+
<artifactId>maven-pmd-plugin</artifactId>
36+
<version>${maven-pmd-plugin.version}</version>
37+
<dependencies>
38+
<dependency>
39+
<groupId>net.sourceforge.pmd</groupId>
40+
<artifactId>pmd-core</artifactId>
41+
<version>${pmd.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>net.sourceforge.pmd</groupId>
45+
<artifactId>pmd-java</artifactId>
46+
<version>${pmd.version}</version>
47+
</dependency>
48+
</dependencies>
49+
</plugin>
50+
<plugin>
51+
<groupId>org.owasp</groupId>
52+
<artifactId>dependency-check-maven</artifactId>
53+
<version>${dependency-check-maven.version}</version>
54+
</plugin>
55+
56+
57+
<!-- ============================================== -->
58+
<!-- 3. ADD TO <build><plugins> SECTION -->
59+
<!-- (or UPDATE existing spotbugs configuration) -->
60+
<!-- ============================================== -->
61+
62+
<!-- SpotBugs - Bug Detection -->
63+
<plugin>
64+
<groupId>com.github.spotbugs</groupId>
65+
<artifactId>spotbugs-maven-plugin</artifactId>
66+
<configuration>
67+
<effort>Max</effort>
68+
<threshold>Low</threshold>
69+
<xmlOutput>true</xmlOutput>
70+
<excludeFilterFile>.github/spotbugs-exclude.xml</excludeFilterFile>
71+
<failOnError>false</failOnError>
72+
</configuration>
73+
</plugin>
74+
75+
<!-- Checkstyle - Code Style -->
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-checkstyle-plugin</artifactId>
79+
<configuration>
80+
<configLocation>google_checks.xml</configLocation>
81+
<suppressionsLocation>.github/checkstyle-suppressions.xml</suppressionsLocation>
82+
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
83+
<consoleOutput>true</consoleOutput>
84+
<failsOnError>false</failsOnError>
85+
<violationSeverity>warning</violationSeverity>
86+
</configuration>
87+
</plugin>
88+
89+
<!-- PMD - Code Quality -->
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-pmd-plugin</artifactId>
93+
<configuration>
94+
<rulesets>
95+
<ruleset>.github/pmd-ruleset.xml</ruleset>
96+
</rulesets>
97+
<printFailingErrors>true</printFailingErrors>
98+
<failOnViolation>false</failOnViolation>
99+
<linkXRef>false</linkXRef>
100+
<sourceEncoding>UTF-8</sourceEncoding>
101+
<minimumTokens>100</minimumTokens>
102+
<targetJdk>21</targetJdk>
103+
</configuration>
104+
</plugin>
105+
106+
107+
<!-- ============================================== -->
108+
<!-- OPTIONAL: Add to <reporting><plugins> for site generation -->
109+
<!-- ============================================== -->
110+
<reporting>
111+
<plugins>
112+
<plugin>
113+
<groupId>com.github.spotbugs</groupId>
114+
<artifactId>spotbugs-maven-plugin</artifactId>
115+
</plugin>
116+
<plugin>
117+
<groupId>org.apache.maven.plugins</groupId>
118+
<artifactId>maven-checkstyle-plugin</artifactId>
119+
<reportSets>
120+
<reportSet>
121+
<reports>
122+
<report>checkstyle</report>
123+
</reports>
124+
</reportSet>
125+
</reportSets>
126+
</plugin>
127+
<plugin>
128+
<groupId>org.apache.maven.plugins</groupId>
129+
<artifactId>maven-pmd-plugin</artifactId>
130+
</plugin>
131+
<plugin>
132+
<groupId>org.jacoco</groupId>
133+
<artifactId>jacoco-maven-plugin</artifactId>
134+
<reportSets>
135+
<reportSet>
136+
<reports>
137+
<report>report</report>
138+
</reports>
139+
</reportSet>
140+
</reportSets>
141+
</plugin>
142+
</plugins>
143+
</reporting>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
function usage {
5+
printf "\n"
6+
printf "Usage: build-docker-image.sh --imagename <imagename> --dockerdir <dockerdir>\n\n"
7+
printf " --help Print usage\n"
8+
printf "\n"
9+
printf " --imagename Name of the image beeing build\n"
10+
printf " --dockerdir Path to the docker context dir\n"
11+
printf " --dockerfile Name of Dockerfile, relative to --dockerdir\n"
12+
}
13+
14+
DOCKER_FILE="Dockerfile"
15+
BUILDARGS_ARR=()
16+
17+
if [[ "$#" -gt 0 ]]; then
18+
19+
while [[ "$#" -gt 0 ]]; do
20+
case $1 in
21+
22+
--help) usage; exit 0;;
23+
24+
--imagename) IMAGE_NAME="$2"; shift;;
25+
--imagename=*) IMAGE_NAME="${1#*=}";;
26+
27+
--dockerdir) DOCKER_DIR="$2"; shift;;
28+
--dockerdir=*) DOCKER_DIR="${1#*=}";;
29+
30+
--dockerfile) DOCKER_FILE="$2"; shift;;
31+
--dockerfile=*) DOCKER_FILE="${1#*=}";;
32+
33+
--build-arg)
34+
BUILDARGS_ARR+=("${2}")
35+
shift;;
36+
37+
*) echo "Unknown parameter passed: $1"; usage; exit 1;;
38+
esac; shift; done
39+
40+
BUILDARGS=""
41+
if [ ${#BUILDARGS_ARR[@]} -ne 0 ]; then
42+
for ba in "${BUILDARGS_ARR[@]}"
43+
do
44+
BUILDARGS="$BUILDARGS --build-arg $ba"
45+
done
46+
fi
47+
48+
COMMIT_AUTHOR=$(git --no-pager show -s --format='%an (%ae)' $GITHUB_SHA)
49+
COMMIT_MESSAGE=$(git log -1 --pretty=%B $GITHUB_SHA)
50+
COMMIT_TIME=$(git show -s --format=%ci $GITHUB_SHA)
51+
BUILD_TIME=$(date -u "+%Y-%m-%d %H:%M:%S %z")
52+
53+
cd $DOCKER_DIR
54+
docker build --file $DOCKER_FILE $BUILDARGS \
55+
--label "ods.build.job.url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
56+
--label "ods.build.source.repo.ref=$GITHUB_REF" \
57+
--label "ods.build.source.repo.commit.author=$COMMIT_AUTHOR" \
58+
--label "ods.build.source.repo.commit.msg=$COMMIT_MESSAGE" \
59+
--label "ods.build.source.repo.commit.sha=$GITHUB_SHA" \
60+
--label "ods.build.source.repo.commit.timestamp=$COMMIT_TIME" \
61+
--label "ods.build.source.repo.url=https://github.com/$GITHUB_REPOSITORY.git" \
62+
--label "ods.build.timestamp=$BUILD_TIME" \
63+
-t $IMAGE_NAME:local .
64+
65+
docker inspect $IMAGE_NAME:local --format='{{.Config.Labels}}'
66+
67+
else
68+
usage
69+
fi

0 commit comments

Comments
 (0)