Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 23 additions & 26 deletions ansible/pbTestScripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,34 @@ These machines will then have the playbooks ran on them, with additional options

The top level script `vagrantPlayBookCheck.sh` takes a number of options:

| Option | Description | Example |
|----------------------------------|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| `--vagrantfile` / `-v` OS | Run against the specified operating system | `./vagrantPlaybookCheck.sh -v Ubuntu1804` |
| `--all` / `-a` | Runs for all OSs | `./vagrantPlaybookCheck.sh -a` |
| | | |
| `--URL` / `-u` Git URL | Specify the URL of the infrastructure repo to clone * | `./vagrantPlaybookCheck.sh -a --URL https://github.com/sxa/openjdk-infrastructure/tree/myBranch` |
| `--new-vagrant-file` / `-nv` | Use the vagrant files from the new URL | `./vagrantPlaybookCheck.sh -a -nv --URL https://...` |
| `--skip-more` / `-sm` | For speed/testing skip tags not needed for build test | `./vagrantPlaybookCheck.sh -a -sm` |
| `--clean-workspace` / `-c` | Delete the old workspace | `./vagrantPlaybookCheck.sh -a -c` |
| `--retainVM` / `-r` | Retains the VM after running the Playbook | `./vagrantPlaybookCheck.sh -a --retainVM` |
| `--no-halt` / `-nh` | Don't halt the Vagrant VMs at the end of the script | `./vagrantPlaybookCheck.sh -a --retainVM -nh` |
| `--help` | Displays usage | `./vagrantPlaybookCheck.sh --help` |
| | | |
| `--build` / `-b` | Build JDK8 on the VM after the playbook | `./vagrantPlaybookCheck.sh -a --build` |
| `--build-repo` / `-br` build URL | Specify the URL of the openjdk-build repo * | `./vagrantPlaybookCheck.sh -a --build -br https://github.com/sxa/openjdk-build/tree/myBranch |
| `--build-hotspot` | Specify to build the JDK with the Hotspot JVM * | `./vagrantPlaybookCheck.sh -a --build --build-hotspot |
| `--JDK-Version` / `-jdk` jdk | Specify which JDK to build, if applicable | `./vagrantPlaybookCheck.sh -a --build --JDK-version jdk11 |
| `--test` / `-t` | Run a small test on the built JDK within the VM * | `./vagrantPlaybookCheck.sh -a --build --test` |
| Option | Description | Example |
|---------------------------------------|-------------------------------------------------------|----------------------------------------------------------------|
| `--vagrantfile` / `-v` OS | Run against the specified operating system | `./vagrantPlaybookCheck.sh -v Ubuntu1804` |
| `--all` / `-a` | Runs for all OSs | `./vagrantPlaybookCheck.sh -a` |
| | | |
| `--fork` / `-f` Git fork | Specify the fork of the infrastructure repo to clone | `./vagrantPlaybookCheck.sh -a --fork willsparker |
| `--branch` / `-br` Git branch | Specify the branch of the fork to clone | `./vagrantPlaybookCheck.sh -a --fork willsparker --branch 1941 |
| `--new-vagrant-file` / `-nv` | Use the vagrant files from the new URL | `./vagrantPlaybookCheck.sh -a -nv --URL https://...` |
| `--skip-more` / `-sm` | For speed/testing skip tags not needed for build test | `./vagrantPlaybookCheck.sh -a -sm` |
| `--clean-workspace` / `-c` | Delete the old workspace | `./vagrantPlaybookCheck.sh -a -c` |
| `--retainVM` / `-r` | Retains the VM after running the Playbook | `./vagrantPlaybookCheck.sh -a --retainVM` |
| `--no-halt` / `-nh` | Don't halt the Vagrant VMs at the end of the script | `./vagrantPlaybookCheck.sh -a --retainVM -nh` |
| `--help` | Displays usage | `./vagrantPlaybookCheck.sh --help` |
| | | |
| `--build` / `-b` | Build JDK8 on the VM after the playbook | `./vagrantPlaybookCheck.sh -a --build` |
| `--build-fork` / `-bf` build fork | Specify the fork of the openjdk-build repo to clone | `./vagrantPlaybookCheck.sh -a --build --build-fork sxa |
| `--build-branch` / `-bb` build branch | Specify the branch of the build fork to clone | `./vagrantPlaybookCheck.sh -a --build --build-branch master |
| `--build-hotspot` | Specify to build the JDK with the Hotspot JVM * | `./vagrantPlaybookCheck.sh -a --build --build-hotspot |
| `--JDK-Version` / `-jdk` jdk | Specify which JDK to build, if applicable | `./vagrantPlaybookCheck.sh -a --build --JDK-version jdk11 |
| `--test` / `-t` | Run a small test on the built JDK within the VM * | `./vagrantPlaybookCheck.sh -a --build --test` |

Notes:
- If not specified, the URL will default to `https://github.com/adoptopenjdk/openjdk-infrastructure`
- If not specified, the build URL will default to `https://github.com/adoptopenjdk/openjdk-build`
- The `--fork` and `--branch` arguments default to `adoptopenjdk` and `master`, respectively.
- The `--build-fork` and `--build-branch` arguments also default to `adoptopenjdk` and `master`, respectively.
- By default, the JDK will be built with the OpenJ9 JVM, as it has more dependencies which is a better test for the playbooks.
- `--test` requires `--build` be enabled, otherwise the script will error.

The script is able to test specific branches of repositories, as well as the master branch, for example:
* "https://github.com/adoptopenjdk/openjdk-infrastructure" will git clone and test the master branch of adoptopenjdk/openjdk-infrastructure.
* "https://github.com/adoptopenjdk/openjdk-infrastructure/tree/branch_name" will git clone and test the "branch_name" branch of adoptopenjdk/openjdk-infrastructure

This can also be done on other people's forks of the repository, for example:
* "https://github.com/username/openjdk-infrastructure/tree/branch_name" will git clone the "branch_name" branch of "username"s fork of the repository
The script will first clone the repository specified by the `--fork` and `--branch` options. For example, if `--fork` is 'willsparker' and `--branch` is '1941', the repository being cloned is https://github.com/willsparker/openjdk-infrastructure/tree/1941.

The script will then make a directory in the `$WORKSPACE` location called _adoptopenjdkPBTests_, in which another directory containing the log files, and the Git repository is stored. Following that, the script will run each ansible playbook on their respective VMs, writing the output to the aforementioned log files. If not defined prior to running, `$WORKSPACE` will default to `$HOME`.

Expand Down
32 changes: 12 additions & 20 deletions ansible/pbTestScripts/buildJDK.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ processArgs() {
fi
checkJDK
shift;;
"--URL" | "-u" )
GIT_URL="$1"; shift;;
"--fork" | "-f" )
GIT_FORK="$1"; shift;;
"--branch" | "-b" )
GIT_BRANCH="$1"; shift;;
"--hotspot" | "-hs" )
VARIANT=hotspot;;
"--clean-workspace" | "-c" )
Expand All @@ -48,7 +50,8 @@ usage() {

Options:
--version | -v Specify the JDK version to build
--URL | -u Specify the github URL to clone openjdk-build from
--fork | -f Specify the fork of openjdk-build to build from (Default: adoptopenjdk)
--branch | -b Specify the branch of the fork to build from (Default: master)
--hotspot | -hs Builds hotspot, default is openj9
--clean-workspace | -c Removes old openjdk-build folder before cloning
--help | -h Shows this message
Expand All @@ -73,30 +76,18 @@ checkJDK() {
}

cloneRepo() {
local branch=""
IFS='/' read -r -a urlArray <<< "$GIT_URL"
if [ -d $WORKSPACE/openjdk-build ]; then
echo "Found existing openjdk-build folder"
cd $WORKSPACE/openjdk-build && git pull
elif [ ${urlArray[@]: -2:1} == 'tree' ]; then
GIT_URL=""
echo "Branch detected"
branch=${urlArray[@]: -1:1}
unset 'urlArray[${#urlArray[@]}-1]'
unset 'urlArray[${#urlArray[@]}-1]'
for urlPart in "${urlArray[@]}"
do
GIT_URL="$GIT_URL$urlPart/"
done
git clone -b $branch $GIT_URL $WORKSPACE/openjdk-build
else
echo "No branch detected"
git clone $GIT_URL $WORKSPACE/openjdk-build
echo "Cloning new openjdk-build folder"
git clone -b ${GIT_BRANCH} --single-branch https://github.com/${GIT_FORK}/openjdk-build $WORKSPACE/openjdk-build
fi
}

# Default values
GIT_URL="https://github.com/adoptopenjdk/openjdk-build"
GIT_BRANCH="master"
GIT_FORK="adoptopenjdk"
CLEAN_WORKSPACE=false
JDK_MAX=
JDK_GA=
Expand Down Expand Up @@ -139,7 +130,8 @@ echo "buildJDK.sh DEBUG:
JDK_BOOT_DIR=${JDK_BOOT_DIR:-}
JAVA_HOME=${JAVA_HOME:-}
WORKSPACE=${WORKSPACE:-}
GIT_URL=${GIT_URL:-}
FORK=${GIT_FORK:-}
BRANCH=$GIT_BRANCH:-}
FILENAME=${FILENAME:-}"

cloneRepo
Expand Down
34 changes: 13 additions & 21 deletions ansible/pbTestScripts/buildJDKWin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ processArgs() {
fi
checkJDK
shift;;
"--URL" | "-u" )
GIT_URL="$1"; shift;;
"--fork" | "-f" )
GIT_FORK="$1"; shift;;
"--branch" | "-b" )
GIT_BRANCH="$1"; shift;;
"--hotspot" | "-hs" )
export VARIANT=hotspot;;
"--clean-workspace" | "-c" )
Expand Down Expand Up @@ -51,8 +53,9 @@ usage() {

Options:
--version | -v <JDK> Specify the JDK version to build
--URL | -u Specify the github URL to clone openjdk-build from
--hotspot | -hs Builds hotspot, instead of openj9 (openj9 by default)
--fork | -f Specify the fork of openjdk-build to build from (Default: adoptopenjdk)
--branch | -b Specify the branch of the fork to build from (Default: master)
--hotspot | -hs Builds hotspot, instead of openj9 (Default: openj9)
--clean-workspace | -c Removes old openjdk-build folder before cloning
--help | -h Shows this message

Expand Down Expand Up @@ -81,31 +84,19 @@ checkJDK() {
}

cloneRepo() {
local branch=""
IFS='/' read -r -a urlArray <<< "$GIT_URL"
if [ -d $WORKSPACE/openjdk-build ]; then
echo "Found existing openjdk-build folder"
cd $WORKSPACE/openjdk-build && git pull
elif [ ${urlArray[@]: -2:1} == 'tree' ]; then
GIT_URL=""
echo "Branch detected"
branch=${urlArray[@]: -1:1}
unset 'urlArray[${#urlArray[@]}-1]'
unset 'urlArray[${#urlArray[@]}-1]'
for urlPart in "${urlArray[@]}"
do
GIT_URL="$GIT_URL$urlPart/"
done
git clone -b $branch $GIT_URL $WORKSPACE/openjdk-build
else
echo "No branch detected"
git clone $GIT_URL $WORKSPACE/openjdk-build
echo "Cloning new openjdk-build directory"
git clone -b ${GIT_BRANCH} --single-branch https://github.com/${GIT_FORK}/openjdk-build $WORKSPACE/openjdk-build
fi
}
# Set defaults
export JAVA_HOME=/cygdrive/c/openjdk/jdk-8

GIT_URL=https://github.com/adoptopenjdk/openjdk-build
GIT_FORK=adoptopenjdk
GIT_BRANCH=master
CLEAN_WORKSPACE=false
JDK_GA=
JDK_MAX=
Expand All @@ -122,7 +113,8 @@ echo "buildJDKWin.sh DEBUG:
JDK_BOOT_DIR=${JDK_BOOT_DIR:-}
JAVA_HOME=${JAVA_HOME:-}
WORKSPACE=${WORKSPACE:-}
GIT_URL=${GIT_URL:-}
FORK=${GIT_FORK:-}
BRANCH=${GIT_BRANCH:-}
FILENAME=${FILENAME:-}"

echo "Running $WORKSPACE/openjdk-build/build-farm/make-adopt-build-farm.sh"
Expand Down
Loading