Skip to content

Commit

Permalink
[#182563382] - Delete settings.xml from docker image and configure su…
Browse files Browse the repository at this point in the history
…refire reports directory
  • Loading branch information
dna-minn committed Nov 20, 2023
1 parent 0e428e1 commit 5f04a3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ci/e2e-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ RUN ./mvnw -P -dnastack -B -Presolve-dependencies initialize
RUN ./mvnw -P -dnastack -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
RUN ./mvnw -P -dnastack -B versions:set -DnewVersion=${APP_VERSION}

# Delete settings*.xml files that contain GitHub credentials
RUN rm /root/.m2/settings*.xml

# Now add sources, which will bust the cache.
ADD target/src ./src

Expand Down Expand Up @@ -56,19 +59,21 @@ USER root
RUN mkdir /target && chown testuser /target

# Copy required files from build stage into image
COPY --from=build --chown=testuser /build/target/ /target
COPY --from=build --chown=testuser /root/.m2 /home/testuser/.m2/
COPY --chown=testuser target/pom.xml /pom.xml
COPY --chown=testuser target/.mvn /.mvn
COPY --chown=testuser target/mvnw /
COPY --from=build --chown=testuser /build/target/ /home/testuser/target
COPY --from=build --chown=testuser /root/.m2/ /home/testuser/.m2/
COPY --chown=testuser target/pom.xml /home/testuser/pom.xml
COPY --chown=testuser target/.mvn /home/testuser/.mvn
COPY --chown=testuser target/mvnw /home/testuser

USER testuser

WORKDIR /home/testuser

ENV E2E_SCREENSHOT_DIR /target

# If the container has a memory limit, that limit (in bytes) is present in a file under /sys/fs/cgroup
# In Linux 5.10.76, the value comes from memory.max.
# If the container doesn't have a set memory limit, the file contains "max", hence we fall back to a default value of 2GiB
# In Linux 5.4.129, the value comes from memory/memory.limit_in_bytes
# If the container doesn't have a set memory limit, the file will be blank, hence we fall back to a default value of 2Gib
ENTRYPOINT ["./mvnw", "-B", "-o", "test"]
ENTRYPOINT ["./mvnw", "-B", "-o", "-DreportsDirectory=/target/surefire-reports", "test"]
2 changes: 2 additions & 0 deletions e2e-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<reportsDirectory/>
<junit.version>5.8.2</junit.version>
<restassured.version>4.5.1</restassured.version>
<slf4j.version>2.0.1</slf4j.version>
Expand Down Expand Up @@ -178,6 +179,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<reportsDirectory>${reportsDirectory}</reportsDirectory>
<dependenciesToScan>
<dependency>com.dnastack:actuator-e2e-test</dependency>
</dependenciesToScan>
Expand Down

0 comments on commit 5f04a3a

Please sign in to comment.