ath.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/bash
  2. set -o errexit
  3. set -o nounset
  4. set -o pipefail
  5. set -o xtrace
  6. cd "$(dirname "$0")"
  7. # https://github.com/jenkinsci/acceptance-test-harness/releases
  8. export ATH_VERSION=6724.va_7c5c4b_fcf9c
  9. if [[ $# -eq 0 ]]; then
  10. export JDK=21
  11. export BROWSER=firefox
  12. else
  13. export JDK=$1
  14. export BROWSER=$2
  15. fi
  16. MVN='mvn -B -ntp -Pquick-build -am -pl war package'
  17. if [[ -n ${MAVEN_SETTINGS-} ]]; then
  18. MVN="${MVN} -s ${MAVEN_SETTINGS}"
  19. fi
  20. [[ -f war/target/jenkins.war ]] || $MVN
  21. mkdir -p target/ath-reports
  22. chmod a+rwx target/ath-reports
  23. curl \
  24. --fail \
  25. --silent \
  26. --show-error \
  27. --output /tmp/ath.yml \
  28. --location "https://raw.githubusercontent.com/jenkinsci/acceptance-test-harness/refs/tags/${ATH_VERSION}/docker-compose.yml"
  29. sed -i -e "s/jenkins\/ath:latest/jenkins\/ath:${ATH_VERSION}/g" /tmp/ath.yml
  30. # obtain the groupId to grant to access the docker socket to run tests needing docker
  31. if [[ -z ${DOCKER_GID:-} ]]; then
  32. 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
  33. export DOCKER_GID
  34. fi
  35. trap 'docker-compose --file /tmp/ath.yml kill && docker-compose --file /tmp/ath.yml down' EXIT
  36. exec docker-compose \
  37. --file /tmp/ath.yml \
  38. run \
  39. --env JDK \
  40. --env ATH_VERSION \
  41. --env BROWSER \
  42. --name mvn \
  43. --no-TTY \
  44. --rm \
  45. --volume "$(pwd)"/war/target/jenkins.war:/jenkins.war:ro \
  46. --volume "$(pwd)"/target/ath-reports:/reports:rw \
  47. mvn \
  48. bash <<-'INSIDE'
  49. set -o errexit
  50. set -o nounset
  51. set -o pipefail
  52. set -o xtrace
  53. cd
  54. set-java.sh "${JDK}"
  55. env | sort
  56. git clone --branch "${ATH_VERSION}" --depth 1 https://github.com/jenkinsci/acceptance-test-harness
  57. cd acceptance-test-harness
  58. run.sh "remote-webdriver-${BROWSER}" /jenkins.war \
  59. -Dmaven.test.failure.ignore \
  60. -DforkCount=1 \
  61. -Dgroups=org.jenkinsci.test.acceptance.junit.SmokeTest
  62. cp --verbose target/surefire-reports/TEST-*.xml /reports
  63. INSIDE