test: support to the custom base image by configuration (#122)
This commit is contained in:
parent
f328380fbd
commit
18e5386b72
|
|
@ -19,10 +19,14 @@
|
|||
name: "Build Plugin Agent"
|
||||
description: "Build Plugin Agent before running a plugin test"
|
||||
inputs:
|
||||
java_version:
|
||||
description: "The Java version under which this test case will run"
|
||||
base_image_java:
|
||||
description: "The Java Docker image under which this test case will run"
|
||||
required: false
|
||||
default: "jdk8"
|
||||
default: "adoptopenjdk/openjdk8:alpine"
|
||||
base_image_tomcat:
|
||||
description: "The Tomcat Docker image under which this test case will run"
|
||||
required: false
|
||||
default: "tomcat:8.5-jdk8-openjdk"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
|
@ -58,14 +62,24 @@ runs:
|
|||
run: |
|
||||
echo "::group::Build Docker Image"
|
||||
# Retry one more time due to frequent "maven connection reset"
|
||||
./mvnw --batch-mode -f test/plugin/pom.xml clean package -Dmaven.test.skip -P${{ inputs.java_version }} || \
|
||||
./mvnw --batch-mode -f test/plugin/pom.xml clean package -Dmaven.test.skip -P${{ inputs.java_version }}
|
||||
./mvnw --batch-mode -f test/plugin/pom.xml \
|
||||
-Dmaven.test.skip \
|
||||
-Dbase_image_java=${{ inputs.base_image_java }} \
|
||||
-Dbase_image_tomcat=${{ inputs.base_image_tomcat }} \
|
||||
-Dcontainer_image_version=1.0.0 \
|
||||
clean package || \
|
||||
./mvnw --batch-mode -f test/plugin/pom.xml \
|
||||
-Dmaven.test.skip \
|
||||
-Dbase_image_java=${{ inputs.base_image_java }} \
|
||||
-Dbase_image_tomcat=${{ inputs.base_image_tomcat }} \
|
||||
-Dcontainer_image_version=1.0.0 \
|
||||
clean package
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Save Docker Image"
|
||||
mkdir -p test-containers
|
||||
docker save -o test-containers/skywalking-agent-test-jvm-${{ inputs.java_version }}-1.0.0.tgz skywalking/agent-test-jvm:${{ inputs.java_version }}-1.0.0
|
||||
docker save -o test-containers/skywalking-agent-test-tomcat-${{ inputs.java_version }}-1.0.0.tgz skywalking/agent-test-tomcat:${{ inputs.java_version }}-1.0.0
|
||||
docker save -o test-containers/skywalking-agent-test-jvm-1.0.0.tgz skywalking/agent-test-jvm:1.0.0
|
||||
docker save -o test-containers/skywalking-agent-test-tomcat-1.0.0.tgz skywalking/agent-test-tomcat:1.0.0
|
||||
echo "::endgroup::"
|
||||
- uses: actions/upload-artifact@v2
|
||||
name: Upload Test Containers
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@ inputs:
|
|||
test_case:
|
||||
description: "The plugin test name"
|
||||
required: true
|
||||
java_version:
|
||||
description: "The Java version under which this test case will run"
|
||||
required: false
|
||||
default: "jdk8"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
|
@ -39,11 +35,11 @@ runs:
|
|||
- name: Load Test Containers
|
||||
shell: bash
|
||||
run: |
|
||||
if ls test-containers/skywalking-agent-test-jvm-${{ inputs.java_version }}-1.0.0.tgz; then
|
||||
docker load -i test-containers/skywalking-agent-test-jvm-${{ inputs.java_version }}-1.0.0.tgz
|
||||
if ls test-containers/skywalking-agent-test-jvm-1.0.0.tgz; then
|
||||
docker load -i test-containers/skywalking-agent-test-jvm-1.0.0.tgz
|
||||
fi
|
||||
if ls test-containers/skywalking-agent-test-tomcat-${{ inputs.java_version }}-1.0.0.tgz; then
|
||||
docker load -i test-containers/skywalking-agent-test-tomcat-${{ inputs.java_version }}-1.0.0.tgz
|
||||
if ls test-containers/skywalking-agent-test-tomcat-1.0.0.tgz; then
|
||||
docker load -i test-containers/skywalking-agent-test-tomcat-1.0.0.tgz
|
||||
fi
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v2
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ jobs:
|
|||
- name: Build
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
java_version: jdk14
|
||||
base_image_java: adoptopenjdk/openjdk14:alpine
|
||||
base_image_tomcat: tomcat:8.5-jdk14-openjdk
|
||||
|
||||
test:
|
||||
needs: [ build ]
|
||||
|
|
@ -70,4 +71,4 @@ jobs:
|
|||
uses: ./.github/actions/run
|
||||
with:
|
||||
test_case: ${{ matrix.case }}
|
||||
java_version: jdk14
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ jobs:
|
|||
- name: Build
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
java_version: jdk17
|
||||
base_image_java: eclipse-temurin:17-alpine
|
||||
base_image_tomcat: tomcat:8.5-jdk17-openjdk
|
||||
|
||||
test:
|
||||
needs: [ build ]
|
||||
|
|
@ -70,4 +71,3 @@ jobs:
|
|||
uses: ./.github/actions/run
|
||||
with:
|
||||
test_case: ${{ matrix.case }}
|
||||
java_version: jdk17
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Release Notes.
|
|||
* Add vertx-core-4.x plugin.
|
||||
* Renamed graphql-12.x-plugin to graphql-12.x-15.x-plugin and graphql-12.x-scenario to graphql-12.x-15.x-scenario.
|
||||
* Add graphql-16plus plugin.
|
||||
* [Test] Support to configure plugin test base images.
|
||||
|
||||
#### Documentation
|
||||
* Add link about java agent injector.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ The test framework provides `JVM-container` and `Tomcat-container` base images i
|
|||
|
||||
### JVM-container Image Introduction
|
||||
|
||||
[JVM-container](../../../../../test/plugin/containers/jvm-container) uses `adoptopenjdk/openjdk8:alpine-jre` as the base image. `JVM-container` supports JDK14 and JDK17 as well, which inherits `adoptopenjdk/openjdk8:alpine-jre` and `eclipse-temurin:17-alpine`.
|
||||
[JVM-container](../../../../../test/plugin/containers/jvm-container) uses `adoptopenjdk/openjdk8:alpine-jre` as the base image. `JVM-container` supports JDK14 and JDK17 as well in CI, which inherits `adoptopenjdk/openjdk8:alpine-jre` and `eclipse-temurin:17-alpine`.
|
||||
It is supported to custom the base Java docker image by specify `base_image_java`.
|
||||
The test case project must be packaged as `project-name.zip`, including `startup.sh` and uber jar, by using `mvn clean package`.
|
||||
|
||||
Take the following test projects as examples:
|
||||
|
|
@ -31,7 +32,8 @@ Take the following test projects as examples:
|
|||
|
||||
### Tomcat-container Image Introduction
|
||||
|
||||
[Tomcat-container](../../../../../test/plugin/containers/tomcat-container) uses `tomcat:8.5-jdk8-openjdk`, `tomcat:8.5-jdk14-openjdk` or `tomcat:8.5-jdk17-openjdk` as the base image.
|
||||
[Tomcat-container](../../../../../test/plugin/containers/tomcat-container) uses `tomcat:8.5-jdk8-openjdk`, `tomcat:8.5-jdk14-openjdk`, `tomcat:8.5-jdk17-openjdk` as the base image.
|
||||
It is supported to custom the base Tomcat docker image by specify `base_image_tomcat`.
|
||||
The test case project must be packaged as `project-name.war` by using `mvn package`.
|
||||
|
||||
Take the following test project as an example
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@
|
|||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>skywalking/agent-test-jvm:${java.version}-${project.version}</name>
|
||||
<name>skywalking/agent-test-jvm:${container_image_version}</name>
|
||||
<build>
|
||||
<from>${base.image.java}</from>
|
||||
<from>${base_image_java}</from>
|
||||
<workdir>/usr/local/skywalking/scenario</workdir>
|
||||
<assembly>
|
||||
<mode>dir</mode>
|
||||
|
|
@ -71,32 +71,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk8</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<base.image.java>adoptopenjdk/openjdk8:alpine</base.image.java>
|
||||
<java.version>jdk8</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk14</id>
|
||||
<properties>
|
||||
<base.image.java>adoptopenjdk/openjdk14:alpine</base.image.java>
|
||||
<java.version>jdk14</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk17</id>
|
||||
<properties>
|
||||
<base.image.java>eclipse-temurin:17-alpine</base.image.java>
|
||||
<java.version>jdk17</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@
|
|||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<name>skywalking/agent-test-tomcat:${java.version}-${project.version}</name>
|
||||
<name>skywalking/agent-test-tomcat:${container_image_version}</name>
|
||||
<build>
|
||||
<from>${base.image.tomcat}</from>
|
||||
<from>${base_image_tomcat}</from>
|
||||
<workdir>/usr/local/skywalking/scenario</workdir>
|
||||
<env>
|
||||
<CATALINA_OPTS>""</CATALINA_OPTS>
|
||||
|
|
@ -74,31 +74,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk8</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<base.image.tomcat>tomcat:8.5-jdk8-openjdk</base.image.tomcat>
|
||||
<java.version>jdk8</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk14</id>
|
||||
<properties>
|
||||
<base.image.tomcat>tomcat:8.5-jdk14-openjdk</base.image.tomcat>
|
||||
<java.version>jdk14</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk17</id>
|
||||
<properties>
|
||||
<base.image.tomcat>tomcat:8.5-jdk17-openjdk</base.image.tomcat>
|
||||
<java.version>jdk17</java.version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
@ -30,7 +30,9 @@ jacoco_home="${home}"/../jacoco
|
|||
scenarios_home="${home}/scenarios"
|
||||
num_of_testcases=
|
||||
|
||||
image_version="jdk8-1.0.0"
|
||||
container_image_version="1.0.0"
|
||||
base_image_java="adoptopenjdk/openjdk8:alpine"
|
||||
base_image_tomcat="tomcat:8.5-jdk8-openjdk"
|
||||
jacoco_version="${JACOCO_VERSION:-0.8.6}"
|
||||
|
||||
os="$(uname)"
|
||||
|
|
@ -40,6 +42,9 @@ print_help() {
|
|||
echo -e "\t-f, --force_build \t\t do force to build Plugin-Test tools and images"
|
||||
echo -e "\t--cleanup, \t\t\t remove the related images and directories"
|
||||
echo -e "\t--debug, \t\t\t to save the log files and actualData.yaml"
|
||||
echo -e "\t--container_image_version, \t specify the container docker image version. default 1.0.0"
|
||||
echo -e "\t--base_image_java, \t\t specify the base java image name. the default is \"adoptopenjdk/openjdk8:alpine\""
|
||||
echo -e "\t--base_image_tomcat, \t\t specify the base tomcat image name. the default is \"tomcat:8.5-jdk8-openjdk\""
|
||||
}
|
||||
|
||||
parse_commandline() {
|
||||
|
|
@ -56,12 +61,26 @@ parse_commandline() {
|
|||
--debug)
|
||||
debug_mode="on";
|
||||
;;
|
||||
--image_version)
|
||||
image_version="$2"
|
||||
--container_image_version)
|
||||
container_image_version="$2"
|
||||
shift
|
||||
;;
|
||||
--image_version=*)
|
||||
image_version="${_key##--image_version=}"
|
||||
--container_image_version=*)
|
||||
container_image_version="${_key##--container_image_version=}"
|
||||
;;
|
||||
--base_image_java)
|
||||
base_image_java="$2"
|
||||
shift
|
||||
;;
|
||||
--base_image_java=*)
|
||||
base_image_java="${_key##--base_image_java=}"
|
||||
;;
|
||||
--base_image_tomcat)
|
||||
base_image_tomcat="$2"
|
||||
shift
|
||||
;;
|
||||
--base_image_tomcat=*)
|
||||
base_image_tomcat="${_key##--base_image_tomcat=}"
|
||||
;;
|
||||
-h|--help)
|
||||
print_help
|
||||
|
|
@ -157,8 +176,13 @@ sed -i '' '/<\/sourceDirectories>/i\'$'\n''<sourceDirectory>scenarios\/'"$scenar
|
|||
sed -i '/<\/sourceDirectories>/i <sourceDirectory>scenarios\/'"$scenario_name"'<\/sourceDirectory>' ./pom.xml
|
||||
|
||||
if [[ "$force_build" == "on" ]]; then
|
||||
profile=$(echo ${image_version} | grep -oE "jdk[0-9]+")
|
||||
${mvnw} --batch-mode -f ${home}/pom.xml clean package -DskipTests -P${profile}
|
||||
${mvnw} --batch-mode \
|
||||
-f ${home}/pom.xml \
|
||||
-DskipTests \
|
||||
-Dbase_image_java=${base_image_java} \
|
||||
-Dbase_image_tomcat=${base_image_tomcat} \
|
||||
-Dcontainer_image_version=${container_image_version} \
|
||||
clean package
|
||||
fi
|
||||
# remove scenario_name into plugin/pom.xml
|
||||
sed -i '' '/<sourceDirectory>scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml \
|
||||
|
|
@ -224,7 +248,7 @@ do
|
|||
-Dagent.dir=${_agent_home} \
|
||||
-Djacoco.home=${jacoco_home} \
|
||||
-Ddebug.mode=${debug_mode} \
|
||||
-Ddocker.image.version=${image_version} \
|
||||
-Ddocker.image.version=${container_image_version} \
|
||||
${plugin_runner_helper} 1>${case_work_logs_dir}/helper.log
|
||||
|
||||
[[ $? -ne 0 ]] && exitWithMessage "${testcase_name}, generate script failure!"
|
||||
|
|
|
|||
Loading…
Reference in New Issue