Skip to content

Commit

Permalink
[SB/EH] Fix stress CI runs (Azure#35804)
Browse files Browse the repository at this point in the history
* fix ci runs
* minimize dockerfile and use fat jar
  • Loading branch information
lmolkova authored Jul 13, 2023
1 parent 81bac18 commit ade669e
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/**",
"sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/**",
"sdk/eventhubs/azure-messaging-eventhubs/**",
"sdk/eventhubs/azure-messaging-eventhubs-stress/Dockerfile",
"sdk/eventgrid/azure-messaging-eventgrid/**",
"sdk/cosmos/azure-cosmos/**",
"sdk/identity/azure-identity/**",
Expand Down Expand Up @@ -176,6 +177,7 @@
"sdk/purview/azure-analytics-purview-catalog/**",
"sdk/servicebus/build/**",
"sdk/servicebus/azure-messaging-servicebus-stress/workbooks/**",
"sdk/servicebus/azure-messaging-servicebus-stress/Dockerfile",
"sdk/search/azure-search-documents/**",
"sdk/storage/azure-storage-internal-avro/**",
"sdk/storage/azure-storage-queue/**",
Expand Down
42 changes: 29 additions & 13 deletions sdk/eventhubs/azure-messaging-eventhubs-stress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
FROM mcr.microsoft.com/openjdk/jdk:11-mariner as builder
WORKDIR application
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
FROM maven:3.8.6-openjdk-11 as builder

RUN mkdir /stress-eh
WORKDIR /stress-eh

ADD ./sdk/tools /stress-eh/sdk/tools
ADD ./sdk/parents /stress-eh/sdk/parents
ADD ./sdk/core /stress-eh/sdk/core
ADD ./sdk/eventhubs /stress-eh/sdk/eventhubs
ADD ./eng /stress-eh/eng

RUN --mount=type=cache,target=/root/.m2 \
mvn -f /stress-eh/eng/code-quality-reports/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/tools/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/core/azure-core/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/core/azure-core-test/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/core/azure-core-amqp/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/core/azure-core-http-netty/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/eventhubs/azure-messaging-eventhubs/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests

FROM mcr.microsoft.com/openjdk/jdk:11-mariner
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ARG AGENT_URL=https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.1/applicationinsights-agent-3.4.1.jar

WORKDIR /app
COPY --from=builder /stress-eh/sdk/eventhubs/azure-messaging-eventhubs-stress/target .

ARG AGENT_URL=https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.13/applicationinsights-agent-3.4.13.jar
ADD ${AGENT_URL} ./BOOT-INF/classes/
ENTRYPOINT ["java","org.springframework.boot.loader.JarLauncher", \
"-javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.1.jar", \

ENTRYPOINT ["java", "-javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar", \
"-jar", "/app/azure-messaging-eventhubs-stress/target/azure-messaging-eventhubs-stress-1.0.0-beta.1.jar", \
"--TEST_CLASS=EventSender"]

11 changes: 2 additions & 9 deletions sdk/eventhubs/azure-messaging-eventhubs-stress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ To know how to develop a stress test project, you should first go through the [A

### Deploy Stress Test

Build out the jar package:
Cd into `azure-sdk-for-java` root folder and run command to deploy the package to cluster

```shell
cd <current project path>
mvn clean install
```

Run command to deploy the package to cluster:

```shell
..\..\..\eng\common\scripts\stress-testing\deploy-stress-tests.ps1 -Login -PushImage
..\..\..\eng\common\scripts\stress-testing\deploy-stress-tests.ps1 -SearchDirectory .\sdk\eventhubs\
```

### Validate Status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
matrix:
scenarios:
- longrunning
image:
- Dockerfile
scenarios:
send-process:
chaos: "false"
imageBuildDir: ..\..\..\
14 changes: 4 additions & 10 deletions sdk/eventhubs/azure-messaging-eventhubs-stress/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ spec:
source $ENV_FILE &&
export CONTAINER_NAME=sender &&
export APPLICATIONINSIGHTS_ROLE_NAME=sender &&
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.1.jar \
"org.springframework.boot.loader.JarLauncher" \
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar \
-jar /app/azure-messaging-eventhubs-stress-1.0.0-beta.1.jar \
--TEST_CLASS=EventSender
{{- include "stress-test-addons.container-env" . | nindent 6 }}
resources:
requests:
memory: "1G"
cpu: "1"
limits:
memory: "2G"
cpu: "2"
- name: receiver
image: {{ .Stress.imageTag }}
imagePullPolicy: Always
Expand All @@ -38,15 +35,12 @@ spec:
source $ENV_FILE &&
export CONTAINER_NAME=receiver &&
export APPLICATIONINSIGHTS_ROLE_NAME=receiver &&
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.1.jar \
"org.springframework.boot.loader.JarLauncher" \
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar \
-jar /app/azure-messaging-eventhubs-stress-1.0.0-beta.1.jar \
--TEST_CLASS=EventProcessor
{{- include "stress-test-addons.container-env" . | nindent 6 }}
resources:
requests:
memory: "1G"
cpu: "1"
limits:
memory: "2G"
cpu: "2"
{{- end -}}
3 changes: 1 addition & 2 deletions sdk/servicebus/azure-messaging-servicebus-stress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ version: 0.1.2
appVersion: v0.2
annotations:
stressTest: 'true' # enable auto-discovery of this test via `find-all-stress-packages.ps1`
example: 'true' # enable auto-discovery filtering `find-all-stress-packages.ps1 -filters @{example='true'}`
namespace: 'java-sb' # kubernetes namespace that stress test package will be installed

dependencies:
- name: stress-test-addons
version: ~0.2.0
version: 0.2.0
repository: https://stresstestcharts.blob.core.windows.net/helm/
39 changes: 26 additions & 13 deletions sdk/servicebus/azure-messaging-servicebus-stress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
FROM mcr.microsoft.com/openjdk/jdk:11-mariner as builder
WORKDIR application
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
FROM maven:3.8.6-openjdk-11 as builder

RUN mkdir /stress-sb
WORKDIR /stress-sb

ADD ./sdk/tools /stress-eh/sdk/tools
ADD ./sdk/parents /stress-eh/sdk/parents
ADD ./sdk/core /stress-sb/sdk/core
ADD ./sdk/servicebus /stress-sb/sdk/servicebus
ADD ./eng /stress-eh/eng

RUN --mount=type=cache,target=/root/.m2 \
mvn -f /stress-eh/eng/code-quality-reports/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-eh/sdk/tools/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/core/azure-core/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/core/azure-core-test/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/core/azure-core-amqp/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/core/azure-core-http-netty/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/servicebus/azure-messaging-servicebus/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests && \
mvn -f /stress-sb/sdk/servicebus/azure-messaging-servicebus-stress/pom.xml clean install -Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests

FROM mcr.microsoft.com/openjdk/jdk:11-mariner
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./

WORKDIR /app
COPY --from=builder /stress-sb/sdk/servicebus/azure-messaging-servicebus-stress/target .

ARG AGENT_URL=https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.13/applicationinsights-agent-3.4.13.jar
ADD ${AGENT_URL} ./BOOT-INF/classes/
ENTRYPOINT ["java","org.springframework.boot.loader.JarLauncher", \
"-javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar", \
ENTRYPOINT ["java", "-javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar", \
"-jar", "/app/azure-messaging-servicebus-stress/target/azure-messaging-servicebus-stress-1.0.0-beta.1.jar", \
"--TEST_CLASS=MessageSender"]

11 changes: 2 additions & 9 deletions sdk/servicebus/azure-messaging-servicebus-stress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ To know how to develop a stress test project, you should first go through the [A

### Deploy Stress Test

Build out the jar package:
Cd into `azure-sdk-for-java` root folder and run command to deploy the package to cluster:

```shell
cd <current project path>
mvn clean install
```

Run command to deploy the package to cluster:

```shell
..\..\..\eng\common\scripts\stress-testing\deploy-stress-tests.ps1
.\eng\common\scripts\stress-testing\deploy-stress-tests.ps1 -SearchDirectory .\sdk\servicebus\
```

### Validate Status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
matrix:
image:
- Dockerfile
scenarios:
longrunning:
send-process:
chaos: "true"
imageBuildDir: ..\..\..\
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
metadata:
labels:
testInstance: "{{.Stress.Scenario}}-{{ .Release.Name }}-{{ .Release.Revision }}"
testName: servicebus-stress-test
testName: java-sb-stress
chaos: "{{ default false .Stress.chaos }}"
spec:
containers:
Expand All @@ -21,16 +21,13 @@ spec:
export APPLICATIONINSIGHTS_ROLE_INSTANCE=sender-{{ .Stress.BaseName }} &&
export APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL=DEBUG &&
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar \
"org.springframework.boot.loader.JarLauncher" \
-jar /app/azure-messaging-servicebus-stress-1.0.0-beta.1.jar \
--TEST_CLASS=MessageSenderAsync
{{- include "stress-test-addons.container-env" . | nindent 6 }}
resources:
requests:
memory: "1G"
cpu: "1"
limits:
memory: "2G"
cpu: "2"
- name: receiver
image: {{ .Stress.imageTag }}
imagePullPolicy: Always
Expand All @@ -46,16 +43,13 @@ spec:
export APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL=DEBUG &&
java -javaagent:BOOT-INF/classes/applicationinsights-agent-3.4.13.jar \
-Dreactor.schedulers.defaultBoundedElasticSize=100 \
"org.springframework.boot.loader.JarLauncher" \
-jar /app/azure-messaging-servicebus-stress-1.0.0-beta.1.jar \
--TEST_CLASS=MessageProcessor
{{- include "stress-test-addons.container-env" . | nindent 6 }}
resources:
requests:
memory: "1G"
cpu: "1"
limits:
memory: "2G"
cpu: "2"
{{- end -}}

{{- include "stress-test-addons.chaos-wrapper.tpl" (list . "stress.network-chaos") -}}
Expand Down

0 comments on commit ade669e

Please sign in to comment.