2022-11-21 16:38:50 -05:00
|
|
|
#!/usr/bin/bash
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
set -o xtrace
|
2022-12-20 02:27:04 -08:00
|
|
|
cd "$(dirname "$0")"
|
2022-11-21 16:38:50 -05:00
|
|
|
|
|
|
|
# https://github.com/jenkinsci/acceptance-test-harness/releases
|
2025-06-05 02:53:12 -07:00
|
|
|
export ATH_VERSION=6254.vca_87b_2b_59e5a_
|
2022-11-21 16:38:50 -05:00
|
|
|
|
2023-04-19 08:06:26 -07:00
|
|
|
if [[ $# -eq 0 ]]; then
|
2023-06-30 15:53:21 +02:00
|
|
|
export JDK=17
|
2023-04-19 08:06:26 -07:00
|
|
|
export BROWSER=firefox
|
|
|
|
else
|
2023-04-27 09:38:13 -07:00
|
|
|
export JDK=$1
|
|
|
|
export BROWSER=$2
|
2023-04-19 08:06:26 -07:00
|
|
|
fi
|
|
|
|
|
2023-02-18 14:41:20 +01:00
|
|
|
MVN='mvn -B -ntp -Pquick-build -am -pl war package'
|
|
|
|
if [[ -n ${MAVEN_SETTINGS-} ]]; then
|
|
|
|
MVN="${MVN} -s ${MAVEN_SETTINGS}"
|
|
|
|
fi
|
2022-11-21 16:38:50 -05:00
|
|
|
|
2023-02-18 14:41:20 +01:00
|
|
|
[[ -f war/target/jenkins.war ]] || $MVN
|
2022-11-21 16:38:50 -05:00
|
|
|
|
|
|
|
mkdir -p target/ath-reports
|
|
|
|
chmod a+rwx target/ath-reports
|
|
|
|
|
2025-05-23 10:42:39 -07:00
|
|
|
curl \
|
|
|
|
--fail \
|
|
|
|
--silent \
|
|
|
|
--show-error \
|
|
|
|
--output /tmp/ath.yml \
|
|
|
|
--location "https://raw.githubusercontent.com/jenkinsci/acceptance-test-harness/refs/tags/${ATH_VERSION}/docker-compose.yml"
|
|
|
|
|
|
|
|
sed -i -e "s/jenkins\/ath:latest/jenkins\/ath:${ATH_VERSION}/g" /tmp/ath.yml
|
|
|
|
|
2024-09-06 14:54:46 +01:00
|
|
|
# obtain the groupId to grant to access the docker socket to run tests needing docker
|
2025-05-23 10:42:39 -07:00
|
|
|
if [[ -z ${DOCKER_GID:-} ]]; then
|
|
|
|
DOCKER_GID=$(docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ubuntu:noble stat -c %g /var/run/docker.sock) || exit 1
|
|
|
|
export DOCKER_GID
|
|
|
|
fi
|
|
|
|
|
|
|
|
trap 'docker-compose --file /tmp/ath.yml kill && docker-compose --file /tmp/ath.yml down' EXIT
|
2024-09-06 14:54:46 +01:00
|
|
|
|
2025-05-23 10:42:39 -07:00
|
|
|
exec docker-compose \
|
|
|
|
--file /tmp/ath.yml \
|
|
|
|
run \
|
2023-04-27 09:38:13 -07:00
|
|
|
--env JDK \
|
2022-12-20 02:27:04 -08:00
|
|
|
--env ATH_VERSION \
|
2023-04-19 08:06:26 -07:00
|
|
|
--env BROWSER \
|
2025-05-23 10:42:39 -07:00
|
|
|
--name mvn \
|
|
|
|
--no-TTY \
|
|
|
|
--rm \
|
2022-12-20 02:27:04 -08:00
|
|
|
--volume "$(pwd)"/war/target/jenkins.war:/jenkins.war:ro \
|
|
|
|
--volume "$(pwd)"/target/ath-reports:/reports:rw \
|
2025-05-23 10:42:39 -07:00
|
|
|
mvn \
|
2022-12-20 02:27:04 -08:00
|
|
|
bash <<-'INSIDE'
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
set -o xtrace
|
|
|
|
cd
|
2023-04-27 09:38:13 -07:00
|
|
|
set-java.sh "${JDK}"
|
2022-12-20 02:27:04 -08:00
|
|
|
env | sort
|
2025-05-23 10:42:39 -07:00
|
|
|
git clone --branch "${ATH_VERSION}" --depth 1 https://github.com/jenkinsci/acceptance-test-harness
|
2022-12-20 02:27:04 -08:00
|
|
|
cd acceptance-test-harness
|
2025-05-23 10:42:39 -07:00
|
|
|
run.sh "remote-webdriver-${BROWSER}" /jenkins.war \
|
2022-12-20 02:27:04 -08:00
|
|
|
-Dmaven.test.failure.ignore \
|
|
|
|
-DforkCount=1 \
|
|
|
|
-Dgroups=org.jenkinsci.test.acceptance.junit.SmokeTest
|
|
|
|
cp --verbose target/surefire-reports/TEST-*.xml /reports
|
|
|
|
INSIDE
|