#!/bin/bash set -u # Usage: # Run with no args, or optionally a 'branch' arg with value of the branch # of the Helix Installer to use (e.g. 'main' or 'dev'). If omitted, the # branch is detected if possible, or else defaulted to 'main'. # Bootstraps a new Linux server with requirements Helix Installer testing. function msg () { echo -e "$*"; } #shellcheck disable=SC2086 function bail () { msg "\\nError: ${1:-Unknown Error}\\n"; exit ${2:-1}; } declare Version=1.0.1 declare Branch=${1:-Unset} msg "Starting ${0##*/} v$Version at $(date)." if [[ "$Branch" == "Unset" ]]; then if [[ "$PWD" == *"/dev/"* ]]; then Branch="dev" elif [[ "$PWD" == *"/main/"* ]]; then Branch="main" else Branch="dev" msg "Warning: Helix Installer branch auto-detect failed; Using '$Branch'." fi fi # Currently, RHEL/CentOS is supported, Ubuntu is not (yet) supported. if [[ -r "/etc/redhat-release" ]]; then msg "Verified: Running on supported Red Hat or similar Linux OS." elif [[ -r "/etc/lsb-release" ]]; then bail "Running on unsupported Ubuntu or similar Linux OS. Aborting." else msg "Warning: Running on unknown OS. Hoping for the best." fi sudo yum install -y gcc gcc-c++ rsync zlib-devel openssl-devel sudo useradd perforce #shellcheck disable=SC2024 sudo echo -e " # Source global definitions [[ -r /etc/bashrc ]] && source /etc/bashrc # User specific aliases and functions [[ -r /p4/common/bin/p4_vars ]] && source /p4/common/bin/p4_vars 1 export PS1='\$USER@\${HOSTNAME%%.*}:\$PWD ' alias cls=clear alias md='mkdir -p' alias rd=rmdir alias o='p4 opened ...' set -o vi" > ~perforce/.bashrc msg "Adding perforce to sudoers." #shellcheck disable=SC2024 sudo sed s:vagrant:perforce:g /etc/sudoers.d/vagrant > /tmp/perforce.sudo.$$ sudo cp /tmp/perforce.sudo.$$ /etc/sudoers.d/perforce sudo chmod 400 /etc/sudoers.d/perforce sudo rm /tmp/perforce.sudo.$$ sudo mkdir -p /hxdepots/reset sudo chown -R perforce:perforce /hxdepots/reset cd /hxdepots/reset || bail "Failed to do 'cd /hxdepots/reset'. Aborting." curl -k -s -O https://swarm.workshop.perforce.com/downloads/guest/perforce_software/helix-installer/main/src/reset_sdp.sh sudo chmod +x reset_sdp.sh HelixInstallerVersion=$(grep '^Version=' reset_sdp.sh) HelixInstallerVersion=${HelixInstallerVersion#declare } msg "Installer Installer version: $HelixInstallerVersion" msg "Updating the /etc/hosts to add host aliases." #shellcheck disable=SC2024 sudo echo -e "127.0.0.1\\tbos-helix bos-perforce helix perforce swarm" >> /etc/hosts HelixInstallerCmd="./reset_sdp.sh -b $Branch" msg "Calling Helix Installer: $HelixInstallerCmd" #shellcheck disable=SC2086,SC2024 sudo $HelixInstallerCmd > reset_sdp.log 2>&1
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#25 | 27288 | C. Thomas Tyler | Removed old Vagrant Test suite. | ||
#24 | 26965 | C. Thomas Tyler | Fixed typo in Redhat-like OS detection. | ||
#23 | 26922 | C. Thomas Tyler |
Narrowed workworkaround for CentOS 8 SELinux enforcing mode issue. The first iteration of this workaround disabled SELinux on all platforms. This disables SELinux on CentOS 8 only. This can be undone done when fixes for SDP-562 and/or HI-54 are released. |
||
#22 | 26829 | C. Thomas Tyler | Disabled SELinux to fix test failure on CentOS 8. | ||
#21 | 26799 | C. Thomas Tyler |
Added '-M' multi-run option to disable the 'run once' safety feature, to simplify multiple tests. |
||
#20 | 26795 | C. Thomas Tyler |
Fixed test suite issues: * Shell environment for test suite regression fixed. * Vagrantfile referred to SDP rather than Helix Installer (old Copy/Paste issue, harmless but wrong). * Updated baseline Vagrant image for CentOS6 box. * Fixed issue with setting hostname on CentOS6 by making hostname a paramter to the bootstrap script, and adjusting the bootstrap script. Along with this change, added missing hostmanager plugin on test machine. |
||
#19 | 26784 | C. Thomas Tyler |
reset_sdp.sh v3.17.0: Made /hx* mount points configurable in settings.cfg, and updated documentation accordingly. Added support for configuring /hxmetadata1 and /hxmetadata2 with different values. Added test coverage for changing /hxdepots from the default. Enhanced test suite. TEST FAIL NOTE: As of this change, tests are succeeding on all platforms except CentOS 6. Failures are in the test suite infrastructure, not related to this change. |
||
#18 | 26575 | C. Thomas Tyler | Switched back to SDP main branch. | ||
#17 | 26567 | C. Thomas Tyler | Changed default test branch from main to dev. | ||
#16 | 26023 | C. Thomas Tyler |
Removed obsolete HelixInstallerBranch refs due to new usage of machine.vm.synced_folder setting in Vagrantfile. |
||
#15 | 26005 | C. Thomas Tyler | Back to -fast. | ||
#14 | 25994 | C. Thomas Tyler | Change back to skipping '-fast'. | ||
#13 | 25990 | C. Thomas Tyler |
Refined test mechanism so local workspace dirs aren't modified by test operations. Changed logfile name to make it easier to find with prefix rather than suffix. |
||
#12 | 25987 | C. Thomas Tyler |
Enhanced test suite to mount the local dir with checked out files into the test VMs, rather than using 'curl' from a URL which can only get submitted revisions of reset_sdp.sh. |
||
#11 | 25882 | C. Thomas Tyler | Configured for a comprehensive test; removed '-fast'. | ||
#10 | 25820 | C. Thomas Tyler |
Enhanced bootstrap test to call Heilx Installer with '-i' to enable testing of scenarios involving newly added files. |
||
#9 | 25754 | C. Thomas Tyler |
Helix Installer test suite changes: Added new test outcome 'SKIP' to supplement 'PASS'/'FAIL'. Added logic to not bother running P4Perl/P4Python tests if '-fast' is specified in the bootstrap script, as in that case we don't expect those to have been installed. Changed bootstrap method back to '-fast' for now. |
||
#8 | 25727 | C. Thomas Tyler |
Removed '-fast' flag to Helix Installer reset_sdp.sh script for comprehensive (but slower) testing. |
||
#7 | 25675 | C. Thomas Tyler | Default changed from fast to comprehensive test. | ||
#6 | 25674 | C. Thomas Tyler | Code optional bypass of Perl/Python compiles to make it faster. | ||
#5 | 25670 | C. Thomas Tyler |
Gave each box its own IP. Added Ubuntu 16.10 and Ubuntu 18.10 to boxes to test. Adjusted bootstrap script to support Ubuntu 16.10 and 18.10. |
||
#4 | 25163 | C. Thomas Tyler | Corrected comment. | ||
#3 | 24879 | C. Thomas Tyler |
Made compliant with shellcheck. Added version id and message to display it. Addded 'sudo' for 'perforce' user. |
||
#2 | 24870 | C. Thomas Tyler |
Various test environment tweaks: * Adjusted host name to bos-helix-01 to be a simplified variant of the Battle School Lab. * Changed defalt SDP branch to pull to auto-detected, using SDP 'dev' branch if in the Helix Installer dev branch, and SDP 'main' branch if in the Helix Installer main branch. * Added host aliases in /etc/hosts. * Added niceties in ~perforce/.bashrc file. |
||
#1 | 24860 | C. Thomas Tyler |
Added basic Vagrant test suite for Helix Installer for testing on CentOS 6.10. |