From fdf0cf3ff7471993d375836d0d2c9b4b5010d3bd Mon Sep 17 00:00:00 2001 From: George Adams Date: Wed, 26 Feb 2020 14:03:02 +0000 Subject: [PATCH] Docker inages (#1) * add first set of perf machines (#1038) * Fixed X11 Install from AIX Ansible Playbook (#969) * Added X11.vfb to AIX playbook * Adding XLC16 to aix playbook as its a requirement for JDK13 (#773) Signed-off-by: Joe deKoning * pbTests: Don't specify URL when git pulling (#1035) * pbTests: Don't specify URL when git pulling (#1035) * winPB: Change Git version to latest; use win_shell module (#1039) * UnixPB: Added retries to roles that often fail (#1011) * pbTests: Update testJDK.sh (#1040) * UnixPB: Changes so PB runs on Raspbian Buster (#1036) * pbTests: Find correct JDK versions for different OSs (#1034) Check and set correct Java_8 for CentOS And Ubuntu * pbTests: Refactor and clean-workspace option (#1030) * pbTests: Refactor and clean-workspace option * pbTests: Clean up checkLogFiles function * pbTests: Removal of -b option in the build and test commands * pbTests: Fixed pbFailed var assignment (#1046) * Passed the value of hosts from command line (#1017) - The variable groups['Vendor_groups'] is skipped due to lack of definition when we run AdoptOpenJDK Unix Playbook internally - Replaced it with a command line variable and set the value to all or a specific group [skip ci] Signed-off-by: Jenny Chen * pbTests: Altered Windows Scripts to build and test (#1053) * UnixPB: Debian Fixes + trailing space fix (#1052) * UnixPB: Fixed incorrectly named modules * Unix: Add Deb8 IP config for ansible, fix trailing space * pbTests: Put vagrant reload in the right place (#1055) * add missing swap_file tag (#1054) * add additional aarch64 test machines (#1050) * add additional aarch64 test machines * add missing deps * WinPB: Fix the Git installation for Windows (#1047) * WinPB: Create Git properties file and use for installation * WinPB: Set autocrlf to false in Cygwin Git * UnixPB: Add checksums to all `get_url` modules (#1051) * UnixPB: 1st Group of Checksums * UnixPB: 2nd Group of Checksums * Fix earlier swap_file tag indentation (#1057) Signed-off-by: Stewart Addison * WinPB: Added Checksums to win_get_url modules (#1058) * pbTests: Renamed testScript.sh (#1060) * Allow Debian8 as an option to vmDestroy.sh (#1064) Signed-off-by: Stewart Addison * PbTests: Updated READMEs relevant to the Test Scripts (#993) * Redraft and update ansible README.md (Phase 1!) (#1063) * PbTests: Updated READMEs relevant to the Test Scripts * Refactor and update ansible README.md Signed-off-by: Stewart Addison Co-authored-by: William Parker <52783864+Willsparker@users.noreply.github.com> * Made Deb8 VF find IP correctly (#1065) * Made Deb8 VF find IP correctly * Change Deb8 box * ansible: Add adoptopenjdk8 repository to Debian (#1068) Signed-off-by: Stewart Addison * pbTestScripts: Add Debian8 reference and link to VagrantPlaybookCheck job (#1069) Signed-off-by: Stewart Addison * UnixPB: Update playbook to allow SLES12 to work (#1062) * VFs: Add FreeBSD12 and SLES12 Vagrantfiles (#1073) * VFs: Add FreeBSD12 VF * pbTest: Update vmDestroy.sh to include FBSD12 * VFs: Add SLES12 VF & Add to vmDestroy.sh * Use vagrantfiles from main repo by default, option to take from the alternate branch (#1070) * Don't use vagrant files from the branch under test Signed-off-by: Stewart Addison * pbTestScripts: Add option to use Vagrant files from the new branch Signed-off-by: Stewart Addison * Fixup last commit which had wrong main Vagrantfile path (#1076) Signed-off-by: Stewart Addison * UnixPB: Remove 'group' tag from adoptopenjdk_install role (#1078) * UnixPB: Make changes so FreeBSD works (#1077) * pbTest: Run extended.system tests on Windows (#1079) * Update Marist zlinux inventory to the new z15 linux machines (#1041) * Add AIX71SP5TL5 machine for AIX JDK13+ builds Signed-off-by: Stewart Addison * inventory: Replace Marist machines with new z15 versions Signed-off-by: Stewart Addison * pbTests: Fix 'checkVagrantOS' error message (#1080) * ansible: Switch adoptopenjdk downloads to APIv3 from APIv2 (#1074) * pbTests: add optional extra skip tags to speed up testing (#1082) Signed-off-by: Stewart Addison * pbTests: ensure in correct directory to vagrant halt (#1089) * Add initial openjdk-infrastructure FAQ (#1066) * Add initial openjdk-infrastructure FAQ.md Signed-off-by: Stewart Addison * typo fix * jenkins_user tag, instead of jenkins The Jenkins roles in the Unix playbook are tagged with "jenkins_user", not "jenkins" (if it's these roles you were going for) Co-authored-by: George Adams Co-authored-by: Haroon Khel <34969545+Haroon-Khel@users.noreply.github.com> * UnixPB: Fixes for FreeBSD12 (#1083) * UnixPB: Set vars for if undefined and remove unneeded tasks (#1092) * unixPB: Enable protobuf for OpenJ9 JITserver (#1094) Signed-off-by: Stewart Addison * pbTests: Update buildJDK.sh to support FreeBSD & openSUSE (#1095) * pbTests: Update buildJDK.sh to support FreeBSD * pbTest: Set JAVA_HOME for FreeBSD * pbTests: Allow for openSUSE to be built * pbTests: Update testJDK.sh for FreeBSD * add build-macstadium-macos1014-1 (#1107) * Set Java 8 as Default in Alternatives for CentOS 6 Signed-off-by: Rajdeep Singh * Upgrade protobuf to v3.7.1 (#1112) Upgrade protobuf version from 3.5.1 to 3.7.1 and update the download link accordingly. Signed-off-by: Violeta Sebe * inventory: Add new AIX systems (#1109) Signed-off-by: Stewart Addison * Added build tags to appropriate roles (#1100) * Added build tags to appropriate roles * change hosts back from all * test prereq packages for centos added * added libcurl-devel packages * Remove trailing spaces * UnixPB: Add support for OpenSUSE12.3 (#1101) * unixPB: Add support for OpenSUSE12.3 * pbTests: add SUSE12 to vmDestroy and remove SLES12 VF * unixPB: Enable protobuf for OpenJ9 JITserver (#1094) Signed-off-by: Stewart Addison * pbTests: Update buildJDK.sh to support FreeBSD & openSUSE (#1095) * pbTests: Update buildJDK.sh to support FreeBSD * pbTest: Set JAVA_HOME for FreeBSD * pbTests: Allow for openSUSE to be built * pbTests: Update testJDK.sh for FreeBSD Co-authored-by: Stewart X Addison * unixPB: Passed CC/CXX to Protobuf build task (#1114) * winPB: Update checksums for win_get_url module (#1113) * winPB: Put checksum into correct format for win_get_url * winPB: Correct failing checksums * winPB: Changed Freemarker URL * Remove zulu-9 from Additional_Build_Tools var lists (#1116) * Remove zulu-9 from Additional_Build_Tools var lists * Remove tasks for adding zulu.repo * remove azul repo (#1117) * Set ansible_processor_vcpus for cmake role (#1110) Ensure ansible_processor_vcpus variable is inherited by cmake role when running tag only. Signed-off-by: Violeta Sebe * vagrant: Temporarily use alternate openjdk-build branch (#1122) Signed-off-by: Stewart Addison * pbTests: update testJDK.sh to not use run_configure.mk (#1123) * pbTests: Fixup last commit (#1126) * inventory: Add first 2 AWS Win2019 systems (#1130) Signed-off-by: Stewart Addison * updates to support RHEL 8 playbooks (#1129) * unixPB: Remove duplicate protobuf install (#1102) Signed-off-by: Stewart Addison * remove p7zip dependency on macOS (#1137) * More aix machines woohoo (#1115) * inventory: Add new AIX systems Signed-off-by: Stewart Addison * inventory: Add AIX machines correctly Signed-off-by: Stewart Addison * UnixPB: Remove CPAN role (#1136) * UnixPB: Remove CPAN role * Removed additional seperate packages * VFs: Ref #685 non-zero exit status fix (#1144) * UnixPB: Add support for SLES15-SP0 (#1140) * UnixPB: Add support for SLES15-SP0 * Remove ntp and enable chronyd for SLES15 * winPB: Passed the value of hosts from command line (#1075) * apply change to windows playbook as performed in #1017 * AdoptOpenJDK/openjdk-infrastructure#423 Signed-off-by: Joe deKoning * UnixPB: remove sudo from GIT_SOURCE role (#1147) * ansible: Remove old gcc 7 locations for Protobuf role Signed-off-by: Stewart Addison * UnixPB: Add support for CentOS8 (#1131) * UnixPB: Add support for CentOS8 * Add CentOS8 as vmDestroy option * win: Adjust cygwin setup checksum as it's been updated (#1149) Signed-off-by: Stewart Addison * pbTests: Change buildJDK to build from other URLs (#1152) * pbTests: Change buildJDK to be able to build JDKs 8-14 * Add various options to buildJDK.sh * Make build openj9 by default * pbTests: Add script to test U18 on s390x/ppc64le QEMU VMs (#1119) * pbTests: Initial commit of qemu_test_script * Add 'fastmode' to qemu script * PB: Add qemu to vagrant.yml * Make ppc64le machine as pseries-2.12 * Correct expect path; Add expect to vagrant.yml * Remove use of expect_script * Build Qemu 4.2; Add arguments to 'ps' * Ensure script stops if playbook fails * Add multi-core support to the qemu VMs * Fix syntax error * Update port detection logic to use netstat * Increase RAM on qemu systems as 1Gb is mean for SMP4 * Use xz compressed base images from /qemu_base_images * alter testJDK to accept other architectures * changes to allow for U18 s390x to work * Change infra repo to run playbook from * Add back in checksum Co-authored-by: Stewart X Addison * pbTests: Change URLs to run the playbook from (#1156) * UnixPB: Remove pulseaudio from Common/vars/SLES.yml (#1157) * playbook: Update gcc-7 role to install gcc 7.5 (#1158) Signed-off-by: Stewart Addison * Ram increase for Vagrant VMs (#1081) * Vagrant: 4GB of RAM, 50% CPU cap * Vagrant: Adjust RAM down to 2.5Gb * winPB: Change checksum for MSVS_2017 (#1162) * unixPB: Remove repeat in SLES package list (#1161) * unixPB: Remove checksum for gcc_7 task (#1160) * winPB: Switch adoptopenjdk download to use APIv3 (#1167) Signed-off-by: Stewart Addison * unixPB: Remove devtoolset-7 and require Adopt's GCC7.5 (#1166) Signed-off-by: Stewart Addison * unixPB: Alter adoptopenjdk_install role to allow for jdk8 (#1138) * unixPB: Alter adoptopenjdk_install to let jdk8 * Alter adoptopenjdk_install to exclude macOS * pbTests: Added option to specify openjdk-build repo (#1170) * add dockerfiles for aws codebuild Co-authored-by: Pav Salimon <32314784+olvap377@users.noreply.github.com> Co-authored-by: Joe deKoning Co-authored-by: William Parker <52783864+Willsparker@users.noreply.github.com> Co-authored-by: Jenny Chen <41126207+JennyChenyj@users.noreply.github.com> Co-authored-by: Stewart X Addison Co-authored-by: Haroon Khel <34969545+Haroon-Khel@users.noreply.github.com> Co-authored-by: Rajdeep Singh <56080803+rajdeepsingh1@users.noreply.github.com> Co-authored-by: vsebe Co-authored-by: Sej <41746002+sej-jackson@users.noreply.github.com> --- .github/workflows/build.yml | 56 ++++ .travis.yml | 2 +- FAQ.md | 147 ++++++++++ README.md | 5 + ansible/Dockerfile.CentOS6 | 22 ++ ansible/Dockerfile.JenkinsSlave | 24 ++ ansible/README.md | 219 ++++++++------- ansible/Vagrantfile.CentOS6 | 9 +- ansible/Vagrantfile.CentOS7 | 9 +- ansible/Vagrantfile.CentOS8 | 42 +++ ansible/Vagrantfile.Debian8 | 13 +- ansible/Vagrantfile.FreeBSD12 | 31 +++ ansible/Vagrantfile.SUSE12 | 31 +++ ansible/Vagrantfile.Ubuntu1604 | 9 +- ansible/Vagrantfile.Ubuntu1804 | 9 +- ansible/Vagrantfile.Win2012 | 2 + ansible/inventory.yml | 47 ++-- ansible/pbTestScripts/README.md | 40 ++- ansible/pbTestScripts/buildJDK.sh | 166 +++++++++++- ansible/pbTestScripts/buildJDKWin.sh | 2 - ansible/pbTestScripts/qemu_test_script.sh | 204 ++++++++++++++ ansible/pbTestScripts/testJDK.sh | 25 +- ansible/pbTestScripts/testJDKWin.sh | 6 +- ...{testScript.sh => vagrantPlaybookCheck.sh} | 255 +++++++++--------- ansible/pbTestScripts/vmDestroy.sh | 16 +- .../roles/Common/tasks/CentOS.yml | 20 -- .../roles/Common/vars/CentOS.yml | 1 - .../AdoptOpenJDK_Unix_Playbook/README.md | 3 - .../AdoptOpenJDK_Unix_Playbook/main.yml | 35 ++- .../roles/Ant-Contrib/tasks/main.yml | 1 + .../roles/CPAN/tasks/main.yml | 54 ---- .../roles/Common/tasks/CentOS.yml | 93 ++++--- .../roles/Common/tasks/Debian.yml | 32 ++- .../roles/Common/tasks/RedHat.yml | 52 +++- .../roles/Common/tasks/SLES.yml | 51 ++-- .../roles/Common/tasks/Ubuntu.yml | 7 + .../roles/Common/tasks/main.yml | 27 +- .../roles/Common/tasks/openSUSE.yml | 214 +++++++++++++++ .../roles/Common/vars/CentOS.yml | 30 ++- .../roles/Common/vars/Debian.yml | 3 +- .../roles/Common/vars/FreeBSD.yml | 36 +-- .../roles/Common/vars/MacOSX.yml | 1 - .../roles/Common/vars/RedHat.yml | 21 +- .../roles/Common/vars/SLES.yml | 29 +- .../roles/Common/vars/Ubuntu.yml | 6 +- .../roles/Common/vars/openSUSE.yml | 61 +++++ .../roles/Docker/tasks/main.yml | 23 +- .../roles/GIT_Source/tasks/main.yml | 13 +- .../roles/NTP_TIME/tasks/main.yml | 26 +- .../roles/NVidia_Cuda_Toolkit/tasks/main.yml | 42 ++- .../roles/Nagios_Plugins/tasks/main.yml | 1 + .../Nagios_Plugins/tasks/nagios_FreeBSD.yml | 2 + .../Nagios_Plugins/tasks/nagios_RedHat.yml | 2 + .../Nagios_Plugins/tasks/nagios_SLES.yml | 2 + .../roles/Nagios_Tunnel/tasks/main.yml | 1 + .../roles/OpenSSL102/tasks/main.yml | 11 +- .../roles/Protobuf/tasks/main.yml | 63 ++--- .../roles/Python3_Source/tasks/main.yml | 1 + .../roles/Swap_File/tasks/main.yml | 30 +-- .../roles/adoptopenjdk_install/tasks/main.yml | 80 +++--- .../roles/ant/tasks/main.yml | 1 + .../roles/autoconf/tasks/main.yml | 1 + .../roles/ccache/tasks/main.yml | 8 +- .../roles/cmake/tasks/main.yml | 11 +- .../roles/curl/tasks/main.yml | 5 + .../roles/gcc_48/tasks/main.yml | 1 + .../roles/gcc_7/tasks/main.yml | 67 +---- .../roles/gmake/tasks/main.yml | 26 +- .../AdoptOpenJDK_Windows_Playbook/main.yml | 5 +- .../roles/7-Zip/tasks/main.yml | 2 + .../roles/ANT/tasks/main.yml | 4 + .../roles/Clang_32bit/tasks/main.yml | 2 + .../roles/Clang_64bit/tasks/main.yml | 2 + .../roles/Firefox/tasks/main.yml | 2 + .../roles/Freemarker/tasks/main.yml | 4 +- .../roles/Freetype/tasks/main.yml | 2 + .../roles/GIT/tasks/main.yml | 9 +- .../roles/IcedTea-Web/tasks/main.yml | 2 + .../roles/Java7/tasks/main.yml | 2 + .../roles/Java_install/tasks/main.yml | 2 +- .../roles/MSVS_2010/tasks/main.yml | 2 + .../roles/MSVS_2017/tasks/main.yml | 2 + .../roles/NVidia_Cuda_Toolkit/tasks/main.yml | 4 + .../roles/OpenSSL/tasks/main.yml | 2 + .../roles/Rust/tasks/main.yml | 2 + .../roles/Strawberry_Perl/tasks/main.yml | 2 + .../roles/cmake/tasks/main.yml | 2 + .../roles/cygwin/tasks/main.yml | 8 + .../roles/nasm/tasks/main.yml | 2 + ansible/playbooks/aix.yml | 219 ++++++++------- ansible/playbooks/vagrant.yml | 44 +++ .../plugins/inventory/adoptopenjdk_yaml.py | 6 +- 92 files changed, 2132 insertions(+), 786 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 FAQ.md create mode 100644 ansible/Dockerfile.CentOS6 create mode 100644 ansible/Dockerfile.JenkinsSlave create mode 100644 ansible/Vagrantfile.CentOS8 create mode 100644 ansible/Vagrantfile.FreeBSD12 create mode 100644 ansible/Vagrantfile.SUSE12 create mode 100755 ansible/pbTestScripts/qemu_test_script.sh rename ansible/pbTestScripts/{testScript.sh => vagrantPlaybookCheck.sh} (55%) delete mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/CPAN/tasks/main.yml create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/openSUSE.yml create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/vars/openSUSE.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..0f4a48b25c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + pull_request: + paths: + - ansible/** + branches: + - master + push: + paths: + - ansible/** + branches: + - master + +env: + AWS_DEFAULT_REGION: eu-west-1 + AWS_DEFAULT_OUTPUT: json + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + CONTAINER_IMAGE: adoptopenjdk/centos6_image + SLAVE_IMAGE: adoptopenjdk/jenkins_slave + +jobs: + build-and-push: + name: Building and pushing image to AWS ECR + runs-on: ubuntu-latest + steps: + + - name: Login to ECR + if: github.ref == 'refs/heads/master' + run: | + $( aws ecr get-login --no-include-email ) + + - name: Build and tag Centos6 Image + run: | + docker build \ + -t $CONTAINER_IMAGE \ + -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$CONTAINER_IMAGE ./ansible/Dockerfile.Centos6 + + - name: Push Centos6 Image + if: github.ref == 'refs/heads/master' + run: | + docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$CONTAINER_IMAGE + + - name: Build and tag Jenkins Slave Image + if: github.ref == 'refs/heads/master' + run: | + docker build \ + -t $SLAVE_IMAGE \ + -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$SLAVE_IMAGE ./ansible/Dockerfile.JenkinsSlave + + - name: Push Slave Image + if: github.ref == 'refs/heads/master' + run: | + docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$SLAVE_IMAGE \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 84d7c4adeb..c9c1ae41ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ script: - cd ansible # Check that the inventory is valid - - ansible-inventory --host=build-marist-rhel74-s390x-1 + - ansible-inventory --host=build-marist-rhel77-s390x-1 # Check YAML validity - yamllint -c yamllint.yml . diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000000..80bc8a6f1a --- /dev/null +++ b/FAQ.md @@ -0,0 +1,147 @@ +# openjdk-infrastructure guide to frequent modifications and usage + +## Access control in the repository + +The three github teams relevant to this repository are as follows (Note, you +won't necessarily have access to see these links): + +- [adoptopenjdk-infrastructure](https://github.com/orgs/AdoptOpenJDK/teams/adoptopenjdk-infrastructure) - write access to the repository which lets you be an official approver of PRs (triage doesn't) +- [infrastructure](https://github.com/orgs/AdoptOpenJDK/teams/infrastructure) - higher level of access for system administrators only +- [admin_infrastructure](https://github.com/orgs/AdoptOpenJDK/teams/admin_infrastructure) - The Admin team - can force through changes without approval etc. + +## Commit messages + +Wherever possible, prefix the commit message with the area which you are +changing e.g. + +- unixPB: +- winPB: +- aixPB: +- ansible: +- vagrant: +- pbTests: +- docs: +- plugins: +- inventory: + +## Change approvals + +All changes to the repository should be made via GitHub pull requests. + +Reviews are required for PRs in this repository. In very special +circumstances such as a clear breakage that has a simple fix available +then a repository admin may override that requirement to push through +a change if no reviewers are available, but in such cases a comment +explaining why must be added to the Pull Request. + +## Running the ansible scripts on your local machine + +The full documentation for running locally is at [ansible/README.md] but +assuming you have ansible installed on your UNIX-based machine, clone this +repository, create an `inventory` text file with the word `localhost` +and run this from the `ansible` directory: + +``` +ansible-playbook -i inventory_file --skip-tags adoptopenjdk,jenkins_user playbooks/AdoptOpenJDK_Unix_Playbook/main.yml +``` + +NOTE: For windows machines you cannot use this method as ansible does not +run natively on Windows + +## Running the ansible scripts remotely on another machine + +Create an inventory file with the list of machines you want to set up, then +from the `ansible` directory in this repository run somethig like this: + +`ansible-playbook -i inventory_file --skip-tags=adoptopenjdk,jenkins playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags=adoptopenjdk,jenkins` + +If you don't have ssh logins enabled as root, add `-b -u myusername` to the +command line which will ssh into the target machine as `myusername` and use +`sudo` to gain root access to do the work. + +To do this you ideally need to be using key-based ssh logins. If you use a +passphrase on your ssh key use the following to hold the credentials in the +shell: + +``` +eval `` `ssh-agent` `` +ssh-add +``` + +and if using the `-b` option, ensure that your user has access to `sudo` +without a password to +the `root` account (often done by adding it to the `wheel` group) + +## Adding a new role to the ansible scripts + +Other than the dependencies on the machines which come from packages shipped +with the operating system, we generally use individual roles for each piece +of software which we install on the machines. For the main Unix and Windows +playbooks each rol has it's own directory and is called from the top level +`main.yml` playbook. They are fairly easy to add and in most cases you can +look at an existing one and copy it. + +As far as possibly, give each operation within the role a tags so that it +can either be skipped if someone doesn't want it, or run on its own if +desired. + +If something is specific to the adoptopenjdk infrastructure (e.g. setting +hostnames, or configuring things specific to our setup but aren't required +to be able to run build/test operations) then give the enitries in that role +an `adoptopenjdk` tag as well. If you need to do something potentially +adjusting the users' system, use the `dont_remove_system` tag. This is +occasionally required if, for example, we need a specific version of a tool +on the machine that is later than the default, and want to ensure that the +old version does not get invoked by default on the adoptopenjdk machines. +See +[GIT_Source](https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/master/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/GIT_Source/tasks/main.yml) +as an example + +## Testing changes + +If you are making a change which might have a negative effect on the +playbooks on other platforms, be sure to run it through the +[VagrantPlaybookCheck](https://ci.adoptopenjdk.net/view/work%20in%20progress/job/VagrantPlaybookCheck/) +job first. This job takes a branch from a fork of the +`openjdk-infrastructure` repository as a parameter and runs the playbooks +against a variety of Operating Systems using Vagrant and the scripts in +[pbTestScripts](https://github.com/AdoptOpenJDK/openjdk-infrastructure/tree/master/ansible/pbTestScripts) +to validate them. + +## Jenkins access + +The AdoptOpenJDK Jenkins server at https://ci.adoptopenjdk.net is used for all the +builds and testing automation. Since we're as open as possible, general read +access is enabled. For others, access is controlled via github teams (via +the Jenkins `Github Authentication Plugin` as follows. (Links here won't work for +most people as the teams are restricted access) + +- [release](https://github.com/orgs/AdoptOpenJDK/teams/jenkins-admins/members) can run and configure jobs and views +- [build](https://github.com/orgs/AdoptOpenJDK/teams/build/members) has the access for `release` plus the ability to create new jobs +- [testing]https://github.com/orgs/AdoptOpenJDK/teams/testing/members has the same access as `build` +- [infrastructure](https://github.com/orgs/AdoptOpenJDK/teams/infrastructure/members) has the same as `build`/`testing` plus can manage agent machines +- [jenkins-admins](https://github.com/orgs/AdoptOpenJDK/teams/jenkins-admins/members) as you might expect has access to Administer anything + +Some jobs within jenkins, such as the +[build signing job](https://ci.adoptopenjdk.net/job/build-scripts/job/release/job/sign_build) +and [Release tool job](https://ci.adoptopenjdk.net/job/build-scripts/job/release/job/refactor_openjdk_release_tool) +are restricted further via the `Enable project-based security` section of +the job definition. In the case of those two in particular it's `jenkins-admins` and +`release` teams only who have access to them respectively. + +## Adding new systems + +To add a new system: + +1. Ensure there is an issue documenting its creation somewhere (Can just be an existing issue that you add the hostname too so it can be found later +2. Obtain system from the appropriate infrastructure provider +3. Set it up using the appropriate ansible scripts for its purpose +4. Connect it to jenkins, verify a typical job runs on it if you can and add the tags +5. Add it to the [inventory.yml](https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/65aa9e2a15b7ebb81858f19e6e4048c16d7e8cd6/ansible/inventory.yml) + file. If you're adding a new type of machine (`build`, `perf` etc.) then you + should also add it to + [adoptopenjdk_taml.py](https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/master/ansible/plugins/inventory/adoptopenjdk_yaml.py#L45) + and, if it will be configured via the standard playbooks, added to the + list at the top of the main playbook files for + [*IX](https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/master/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml#L8) and + [windows](https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/master/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml#L20) diff --git a/README.md b/README.md index dbba95dbea..27b4fa8b63 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ Core infrastructure team - granted access to hosts on a case by case basis - [@mwornast](https://github.com/mwornast) - Marcus Wornast (IBM) - * - [@pnstanton](https://github.com/pnstanton) - Peter Stanton (IBM) - * - [@sej-jackson](https://github.com/sej-jackson) - Sej Jackson (IBM) +- [@sxa555](https://github.com/sxa555) - Stewart X Addison (IBM) - * - [@tellison](https://github.com/tellison) - Tim Ellison (IBM) - * - [@vsebe](https://github.com/vsebe) - Violeta Sebe (IBM) @@ -78,11 +79,15 @@ Issues can be assigned to these folks - [@AdamBrousseau](https://github.com/AdamBrousseau) - Adam Brousseau (IBM) - [@CJKwork](https://github.com/CJKwork) - Clive Kennedy (IBM) +- [@cwesMills](https://github.com/cwesMills) - Colton Mills (IBM) - [@cwillhelm](https://github.com/cwillhelm) - Connor Willhelm (IBM) +- [@Haroon-Khel](https://github.com/Haroon-Khel) - Haroon Khel (IBM) +- [@HusainYusafali](https://github.com/HusainYusufali) - Husain Yusufali (IBM) - [@jdekonin](https://github.com/jdekonin) - Joe deKoning (IBM) - [@karianna](https://github.com/karianna) - Martijn Verburg (Microsoft / LJC) - [@sej-jackson](https://github.com/sej-jackson) - Sej Jackson (IBM) - [@vsebe](https://github.com/vsebe) - Violeta Sebe (IBM) +- [@Willsparker](https://github.com/Willsparker) - William Parker (IBM) ## [@jenkins-admins](https://github.com/orgs/AdoptOpenJDK/teams/jenkins-admins) - [@ali-ince](https://github.com/ali-ince) Ali Ince (LJC) diff --git a/ansible/Dockerfile.CentOS6 b/ansible/Dockerfile.CentOS6 new file mode 100644 index 0000000000..359b18e750 --- /dev/null +++ b/ansible/Dockerfile.CentOS6 @@ -0,0 +1,22 @@ +FROM centos:6.9 + +ARG user=jenkins + +RUN yum -y update; yum clean all +RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; \ + yum -y install ansible sudo; yum clean all + +COPY . /ansible + +RUN echo "localhost ansible_connection=local" > /ansible/hosts + +RUN set -eux; \ + cd /ansible; \ + ansible-playbook -i hosts -s playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags="debug,hosts_file,hostname,adoptopenjdk,jenkins,nagios,superuser,docker,swap_file,crontab,adoptopenjdk_install" + +RUN groupadd -g 1000 ${user} +RUN useradd -c "Jenkins user" -d /home/${user} -u 1000 -g 1000 -m ${user} + +# OpenJDK 9+ gets auto installed in the build scripts +ENV JDK7_BOOT_DIR="/usr/lib/jvm/java-1.7.0-openjdk.x86_64" +ENV JDK8_BOOT_DIR="/usr/lib/jvm/java-1.8.0-openjdk.x86_64" \ No newline at end of file diff --git a/ansible/Dockerfile.JenkinsSlave b/ansible/Dockerfile.JenkinsSlave new file mode 100644 index 0000000000..c7953ff2ee --- /dev/null +++ b/ansible/Dockerfile.JenkinsSlave @@ -0,0 +1,24 @@ +FROM adoptopenjdk/centos6_image + +ARG VERSION=4.0.1 +ARG user=jenkins +ARG AGENT_WORKDIR=/home/${user}/agent + +RUN curl --create-dirs -fsSLo /usr/share/jenkins/agent.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar \ + && chmod 755 /usr/share/jenkins \ + && chmod 644 /usr/share/jenkins/agent.jar \ + && ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar + +RUN curl --create-dirs -fsLo /usr/local/bin/jenkins-agent https://raw.githubusercontent.com/jenkinsci/docker-jnlp-slave/master/jenkins-agent \ + && chmod +x /usr/local/bin/jenkins-agent \ + && ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave + +USER ${user} +ENV AGENT_WORKDIR=${AGENT_WORKDIR} +RUN mkdir /home/${user}/.jenkins && mkdir -p ${AGENT_WORKDIR} + +VOLUME /home/${user}/.jenkins +VOLUME ${AGENT_WORKDIR} +WORKDIR /home/${user} + +ENTRYPOINT ["jenkins-agent"] \ No newline at end of file diff --git a/ansible/README.md b/ansible/README.md index 188dcd9dd1..4b1d5269c4 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -1,65 +1,24 @@ -# Ansible playbooks to download and install dependencies for OpenJDK on various platforms +# Ansible playbooks to download and install dependencies for OpenJDK build and test on various platforms -# Quickstart Guide +# Quickstart guide -To test the ansible scripts, you'll need to install the following programs. - -For macOS: - -1. Install Homebrew 2.1.7 or later - ```bash - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - ``` -2. Install Vagrant 2.2.5 or later - ```bash - brew cask install vagrant - ``` -3. Install Virtualbox 6.0.8 or later: - ```bash - brew cask install virtualbox - ``` - -# Running via Vagrant and VirtualBox - -To test the ansible scripts you can set up a Virtual Machine isolated from your own local system. -A `Vagrantfile` has been provided and the usual `vagrant` commands should get it up and running. - -The following method runs the ansible playbooks on the local connection. -Normally you will be running ansible on your development machine, and using it -to modify remote hosts. - -**NOTE** The `/vagrant/` directory maps to the directory on your host that you launched the `VagrantFile` from -e.g. `~/workspace/AdoptOpenJDK/openjdk-infrastructure/ansible` - -```bash -vagrant up +The ansible playbooks under the `playbook` directory are used to set up all +of the adoptopenjdk machines to be able to run building and testing of the +openjdk and related projects. -vagrant ssh # Uses default ssh login, user=vagrant, password=vagrant +The main playbooks should be run from this directory using, for example, the +following command (the skipped tags are one that aren't needed on most +user's machines, but are needed if you're setting up a machine for the +official AdoptOpenJDK infrastructure): -cd /vagrant/playbooks ``` - -Note: - - A `hosts` file containing `localhost ansible_connection=local` will already be present in the directory with the playbook scripts (`/vagrant/playbooks`). - - A public key file `id_rsa.pub` will already be present in the `/home/vagrant/.ssh/` folder - -1) Run a playbook to install dependencies, for Ubuntu 14.x on x86: - -`ansible-playbook -s AdoptOpenJDK_Unix_Playbook/main.yml` - -or - -`ansible-playbook -i hosts -s AdoptOpenJDK_Unix_Playbook/main.yml` - -In case one or more tasks fail or should not be run in the local environment, see [Skipping one or more tags via CLI when running Ansible playbooks](https://github.com/AdoptOpenJDK/openjdk-infrastructure/tree/master/ansible#skipping-one-or-more-tags-via-cli-when-running-ansible-playbooks) for further details. Ideally, the below can be run for smooth execution in the `vagrant` box: - -```bash -ansible-playbook -i hosts -s AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags="install_zulu,jenkins_authorized_key,nagios_add_key,add_zeus_user_key" +ansible-playbook -i inventory_file --skip-tags adoptopenjdk,jenkins playbooks/AdoptOpenJDK_Unix_Playbook/main.yml ``` -# Running Manually +If you are interesting in running the playbooks within a virtual machine on your +host, checkout the section on Vagrant later in this readme -## Do I need to be a superuser to run the playbooks? +## Do I need to be a superuser on the target machine to run the playbooks? Yes, in order to access the package repositories (we will perform either `yum install` or `apt-get` commands) @@ -89,28 +48,31 @@ Yes, in order to access the package repositories (we will perform either `yum in 3) Run a playbook to install dependencies, e.g. for Ubuntu 14.x on x86: ```bash - ansible-playbook -s playbooks/AdoptOpenJDK_Unix_Playbook/main.yml + ansible-playbook -s playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags=adoptopenjdk,jenkins # Or to use a custom hosts file: - ansible-playbook -i /path/to/hosts -s AdoptOpenJDK_Unix_Playbook/main.yml + ansible-playbook -i /path/to/hosts -s AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags=adoptopenjdk,jenkins ``` 4) The Ansible playbook will download and install any dependencies needed to build OpenJDK -## How do I run the playbook on a Windows Machine? +## How do I run the playbook against a Windows Machine? -As Ansible can't run on Windows, it has to be run on a seperate system and then pointed at a Windows machine (such as a VM). To test the playbook, a vagrant VM can be used. +As Ansible can't run on Windows, it has to be run on a seperate system (e.g. a Linux VM) and then pointed at a Windows machine You can do this by following these steps: -1) Run `vagrant plugin install vagrant-disksize`. This will install a plugin that allows the user to specify the disksize of the VM. +1) Run `vagrant plugin install vagrant-disksize`. This will install a plugin that allows the user to specify the disksize of the VM and is required to use the Windows Vagrantfile. 2) `git clone "https://github.com/AdoptOpenJdk/openjdk-infrastructure/"` -3) `ln -sf Vagrantfile.WindowsS12 Vagrantfile && vagrant up` in the cloned `/openjdk-infrastructure/ansible` directory -4) Note the IP address that is output from running `vagrant up` and place it into a text file. e.g. `hosts.win`. Place this text file in `../anisble/playbooks/AdoptopenJDK_Windows_Playbook` -5) Edit `../AdoptOpenJDK_Windows_Playbook/main.yml` so the `- hosts :{{ groups['Vendor_groups'] ... etc` becomes `- hosts: all` -6) Add into `../AdoptOpenJDK_Windows_Playbook/group_vars/all/adoptopenjdk_variables.yml` the line `ansible_winrm_transport: credssp`. You'll also need to uncomment and change `ansible_password: CHANGE_ME`. -7) From the `../ansible` directory, running `sudo ansible-playbook -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win -u vagrant playbooks/AdoptOpenJDK_Windows_Playbook/main.yml` will start the playbook. +3) `ln -sf Vagrantfile.Win2012 Vagrantfile && vagrant up` in the cloned `openjdk-infrastructure/ansible` directory +4) You can optionally edit `Vagantfile.Win2012` so the GUI is shown when running `vagrant up` by changing `v.gui = false` to `v.gui = true`, though this is not necessary to run the playbook. +5) In `../ansible/playbooks/AdoptOpenJDK_Windows_Playbook/` a file called `hosts.tmp` will have been generated containing 2 IP addresses. Edit this file to remove the CRs and the lower IP address. +6) Edit `../AdoptOpenJDK_Windows_Playbook/main.yml` so the `- hosts :{{ groups['Vendor_groups'] ... etc` becomes `- hosts: all` +7) Add into `../AdoptOpenJDK_Windows_Playbook/group_vars/all/adoptopenjdk_variables.yml` the line `ansible_winrm_transport: credssp`. You'll also need to uncomment and change `ansible_password: CHANGE_ME` to `ansible_password: vagrant`. +8) From the `../ansible` directory, running `ansible-playbook -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.tmp -u vagrant --skip-tags adoptopenjdk,jenkins playbooks/AdoptOpenJDK_Windows_Playbook/main.yml` will start the playbook. + +Alternatively, [pbTestScripts/vagrantPlaybookCheck.sh](pbTestScripts/vagrantPlaybookCheck.sh) will do this for you when executing `./testScript.sh -v Win2012 -u https://github.com/adoptopenjdk/openjdk-infrastructure --retainVM` -Note: if using macOS Mojave, `export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES` will be required before starting the playbook. +Note: if using macOS Mojave, `export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES` will be required before starting the playbook and executing `testScript.sh` ## Can I have multiple VMs on different OSs? @@ -118,14 +80,28 @@ As vagrant uses Virtualbox to create VMs, multiple VMs on different OSs can be s You can do this by following these steps: 1. Make a copy of the existing directory you have. - 2. The "vagrantfile" is an alias to the vagrantfile that is labelled with the desired OS. Replace this so it is an alias of the OS you want. (default OS is CentOS) + 2. The `Vagrantfile` is a symmlink or copy of the Vagrantfile that is labelled with the desired OS (e.g. `VagrantFile.Ubuntu1804`) 3. Continue the vagrant functions as normal. -To access each vagrant VM, you'll need to be in the correct directory to `vagrant ssh` into. +To access each vagrant VM, you'll need to be in the correct directory to `vagrant ssh` into. +Use `vagrant-global-status` to find out which VMs you have in each directory ## Which playbook do I run? -Our playbooks are named according to the operating system they are supported for, keep in mind that package availability may differ between operating system releases +Our playbooks are named according to the operating system they are supported for, keep in mind that package availability may differ between operating system releases. + +The main ones are as follows: + +- AdoptOpenJDK_Unix_Playbook/main.yml (For all *IX machines including macOS) +- AdoptOpenJDK_Windows_Playbook/main.yml (Windows systems) +- aix.yml (For AIX systems - not currently split out into individual roles) +- AdoptOpenJDK_ITW_Playbooks (CentOS or Red Hat only - IcedTea-WEB setup) + +There are also various playbooks used to set up other machines in the +adoptopenjdk infrastructure - generally most end users won't need these but +I'll include them for completeness: + +- vagrant.yml (Used to set up an Ubuntu machine to run Vagrant playbook testing) ## Where can I run the playbooks? @@ -140,27 +116,29 @@ Running `ansible --version` will display your Ansible configuration folder that ## Skipping one or more tags via CLI when running Ansible playbooks -One of the two examples below is appropriate to run a playbook and skip tags, leading to linked and dependent tasks to be not executed: - -```bash -ansible-playbook -s playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags "jenkins_user" - -ansible-playbook -s playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags "install_zulu, jenkins_authorized_key, nagios_add_key, add_zeus_user_key" -``` +In general skipping `adoptopenjdk` and `jenkins` as per all of the examples +above will be all that's needed - those tags are in place for all roles +that will probe problematic on a non-AdoptOpenJDK owned machine. Most of the +roles have their own tags you can use to skip them if required, but one that +might be useful is `dont_remove_system`. We have one or two roles such as +`GIT_source` in the *IX playbook which can potentially remove any system +installed version of the tool after building a later one from source into +/usr/local. For maximum safety you can use that too, but you should consider +whether that's really what you want to do if you add that to your skip list. -## Skipping tasks via CLI when running Ansible playbooks (conditional and skipping tasks) +## Passing in extra variables from the command line The below example is appropriate to run playbook by skipping tasks by using a combination of conditionals and tags (linked and dependent tasks will not be executed): ```bash -ansible-playbook -i [/path/to/hosts] -s AdoptOpenJDK_Unix_Playbook/main.yml --extra-vars "Jenkins_Username=jenkins Jenkins_User_SSHKey=[/path/to/id_rsa.pub] Nagios_Plugins=Disabled Slack_Notification=Disabled Superuser_Account=Disabled" --skip-tags="install_zulu" +ansible-playbook -i [/path/to/hosts] -s AdoptOpenJDK_Unix_Playbook/main.yml --extra-vars "Jenkins_Username=jenkins Jenkins_User_SSHKey=[/path/to/id_rsa.pub] Nagios_Plugins=Disabled Slack_Notification=Disabled Superuser_Account=Disabled" --skip-tags="adoptopenjdk,jenkins,dont_remove_system" ``` -Note that when running from inside the `vagrant` instance: +Note that when running from inside a `vagrant` instance: - the `[/path/to/hosts]` can be replace with `/vagrant/playbooks/hosts` - the `[/path/to/id_rsa.pub]` can be replaced with `/home/vagrant/.ssh/id_rsa.pub` -Useful if one or more tasks are failing to execute successfully or if they need to be skipped due to not deemed to be executed in the right environment. +This is useful if one or more tasks are failing to execute successfully or if they need to be skipped due to not deemed to be executed in the right environment. ## Verbose mode, debugging Ansible playbooks @@ -180,21 +158,82 @@ A snippet from the man pages of Ansible: ## Expected output of a successful Ansible build -When the above `ansible-playbook` commands succeed, we should get something of this output (snippet): +When the above `ansible-playbook` commands succeed, we should get something like this: ``` -TASK [Start NTP] *************************************************************** - changed: [localhost] +PLAY RECAP ********************************************************************* +172.28.128.134 : ok=131 changed=96 unreachable=0 failed=0 +``` -TASK [Remove unneeded packages from the cache] ********************************* - ok: [localhost] +# Running via Vagrant and VirtualBox -TASK [Remove apt dependencies that are no longer required] ********************* - ok: [localhost] +We have some automation for running under Vagrant which we use to validate +playbook changes befor they are merged. See the +[pbTestScripts](pbTestScripts/) folder for more info. The scripts from there +are run on jenkins in the +[VagrantPlaybookCheck](https://ci.adoptopenjdk.net/view/Tooling/job/VagrantPlaybookCheck/) job -TASK [Send Slack notification, successful] ************************************* - skipping: [localhost] +## Vagrant setup guide - macOS -PLAY RECAP ********************************************************************* - localhost : ok=49 changed=21 unreachable=0 failed=0 +To test the ansible scripts, you'll need to install the following programs. + +1. Install Homebrew 2.1.7 or later + ```bash + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + ``` +2. Install Vagrant 2.2.5 or later + ```bash + brew cask install vagrant + ``` +3. Install Virtualbox 6.0.8 or later: + ```bash + brew cask install virtualbox + ``` + +## Vagrant setup guide - Ubuntu (other Linuxes are similar) + +If you're on Ubuntu we have a playbook that can be used to set up your +machine to run vagrant in [playbooks/vagrant.yml](playbooks/vagrant.yml) but +it simply installs Vagrant from https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb +and also [virtualbox from their web site](https://www.virtualbox.org/wiki/Downloads) + +## Executing under vagrant + +To test the ansible scripts you can set up a Virtual Machine isolated from your own host system. +Several `Vagrantfile`s have been provided and the usual `vagrant` commands should get it up and running. + +The following method runs the ansible playbooks on the local connection. +Normally you will be running ansible on your development machine, and using it +to modify remote hosts. + +**NOTE** The `/vagrant/` directory maps to the directory on your host that you launched the `VagrantFile` from +e.g. `~/workspace/AdoptOpenJDK/openjdk-infrastructure/ansible` + +```bash +ln -s Vagrantfile.Centos6 Vagrantfile + +vagrant up + +vagrant ssh # Uses default ssh login, user=vagrant, password=vagrant + +cd /vagrant/playbooks ``` + +Note when using our Vagrantfiles: + - A `hosts` file containing `localhost ansible_connection=local` will already be present in the directory with the playbook scripts (`/vagrant/playbooks`). + - A public key file `id_rsa.pub` will already be present in the `/home/vagrant/.ssh/` folder + +1) Run a playbook to install dependencies, for Linux on x86: + +`ansible-playbook -s AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags=adoptopenjdk,jenkins` + +or + +`ansible-playbook -i hosts -s AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags=adoptopenjdk,jenkins` + +In case one or more tasks fail or should not be run in the local environment, see [Skipping one or more tags via CLI when running Ansible playbooks](https://github.com/AdoptOpenJDK/openjdk-infrastructure/tree/master/ansible#skipping-one-or-more-tags-via-cli-when-running-ansible-playbooks) for further details. Ideally, the below can be run for smooth execution in the `vagrant` box: + +```bash +ansible-playbook -i hosts -s AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags="install_zulu,jenkins_authorized_key,nagios_add_key,add_zeus_user_key" +``` + diff --git a/ansible/Vagrantfile.CentOS6 b/ansible/Vagrantfile.CentOS6 index 5b0b089ee6..7a8649b067 100644 --- a/ansible/Vagrantfile.CentOS6 +++ b/ansible/Vagrantfile.CentOS6 @@ -26,7 +26,9 @@ echo "-------------------------------------------------------------------------- # Get IPs of the VM, and output to shared folder ifconfig | grep "inet" | awk '{print $2}' | sed 's/addr://' >> /vagrant/playbooks/AdoptOpenJDK_Unix_Playbook/hosts.tmp # Put the host machine's IP into the authorised_keys file on the VM -[ -r /vagrant/id_rsa.pub ] && mkdir -p $HOME/.ssh && cat /vagrant/id_rsa.pub >> $HOME/.ssh/authorized_keys +if [ -r /vagrant/id_rsa.pub ]; then + mkdir -p $HOME/.ssh && cat /vagrant/id_rsa.pub >> $HOME/.ssh/authorized_keys +fi SCRIPT # 2 = version of configuration file for Vagrant 1.1+ leading up to 2.0.x @@ -39,4 +41,9 @@ Vagrant.configure("2") do |config| adoptopenjdkC6.vm.network :private_network, type: "dhcp" adoptopenjdkC6.vm.provision "shell", inline: $script, privileged: false end + config.vm.provider "virtualbox" do |v| + v.gui = false + v.memory = 2560 + v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] + end end diff --git a/ansible/Vagrantfile.CentOS7 b/ansible/Vagrantfile.CentOS7 index 7513d0d57b..42ad815b13 100644 --- a/ansible/Vagrantfile.CentOS7 +++ b/ansible/Vagrantfile.CentOS7 @@ -26,7 +26,9 @@ echo "-------------------------------------------------------------------------- # Get IPs of the VM, and output to shared folder ifconfig | grep "inet" | awk '{print $2}' | sed 's/addr://' >> /vagrant/playbooks/AdoptOpenJDK_Unix_Playbook/hosts.tmp # Put the host machine's IP into the authorised_keys file on the VM -[ -r /vagrant/id_rsa.pub ] && mkdir -p $HOME/.ssh && cat /vagrant/id_rsa.pub >> $HOME/.ssh/authorized_keys +if [ -r /vagrant/id_rsa.pub ]; then + mkdir -p $HOME/.ssh && cat /vagrant/id_rsa.pub >> $HOME/.ssh/authorized_keys +fi SCRIPT # 2 = version of configuration file for Vagrant 1.1+ leading up to 2.0.x @@ -39,4 +41,9 @@ Vagrant.configure("2") do |config| adoptopenjdkC7.vm.network :private_network, type: "dhcp" adoptopenjdkC7.vm.provision "shell", inline: $script, privileged: false end + config.vm.provider "virtualbox" do |v| + v.gui = false + v.memory = 2560 + v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] + end end diff --git a/ansible/Vagrantfile.CentOS8 b/ansible/Vagrantfile.CentOS8 new file mode 100644 index 0000000000..5b16b9319e --- /dev/null +++ b/ansible/Vagrantfile.CentOS8 @@ -0,0 +1,42 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +$script = <