diff --git a/installation_and_upgrade/Jenkinsfile_vhd_creation b/installation_and_upgrade/Jenkinsfile_vhd_creation deleted file mode 100644 index 6e1e941..0000000 --- a/installation_and_upgrade/Jenkinsfile_vhd_creation +++ /dev/null @@ -1,68 +0,0 @@ -#!groovy - -pipeline { - - // agent defines where the pipeline will run. - agent { - label { - label "create_vhd" - } - } - - triggers { - upstream(upstreamProjects: 'EPICS_IOC_Windows_x64_CLEAN', threshold: hudson.model.Result.SUCCESS) - } - - stages { - stage("Checkout") { - steps { - timeout(time: 100, unit: 'MINUTES') { - echo "Branch: ${env.BRANCH_NAME}" - checkout scm - } - } - } - - stage("Build") { - steps { - timeout(time: 300, unit: 'MINUTES') { - bat """ - set BUILD_NUMBER=${env.BUILD_NUMBER} - installation_and_upgrade/vhd_build.bat - """ - } - } - } - } - - post { - cleanup { - timeout(time: 60, unit: 'MINUTES') { - bat """ - set BUILD_NUMBER=${env.BUILD_NUMBER} - installation_and_upgrade/vhd_build_force_cleanup.bat - """ - } - } - } - - // The options directive is for configuration that applies to the whole job. - options { - buildDiscarder(logRotator(numToKeepStr:'5', daysToKeepStr: '7')) - disableConcurrentBuilds() - timestamps() - office365ConnectorWebhooks([[ - name: "Office 365", - notifyBackToNormal: true, - startNotification: false, - notifyFailure: true, - notifySuccess: false, - notifyNotBuilt: false, - notifyAborted: false, - notifyRepeatedFailure: true, - notifyUnstable: true, - url: "${env.MSTEAMS_URL}" - ]] - ) - } -} diff --git a/installation_and_upgrade/Jenkinsfile_vhd_release_creation b/installation_and_upgrade/Jenkinsfile_vhd_release_creation deleted file mode 100644 index 65b983d..0000000 --- a/installation_and_upgrade/Jenkinsfile_vhd_release_creation +++ /dev/null @@ -1,64 +0,0 @@ -#!groovy - -pipeline { - - // agent defines where the pipeline will run. - agent { - label { - label "create_vhd" - } - } - - stages { - stage("Checkout") { - steps { - timeout(time: 100, unit: 'MINUTES') { - echo "Branch: ${env.BRANCH_NAME}" - checkout scm - } - } - } - - stage("Build") { - steps { - timeout(time: 300, unit: 'MINUTES') { - bat """ - set BUILD_NUMBER=${env.BUILD_NUMBER} - installation_and_upgrade/vhd_build_release.bat - """ - } - } - } - } - - post { - cleanup { - timeout(time: 60, unit: 'MINUTES') { - bat """ - set BUILD_NUMBER=${env.BUILD_NUMBER} - installation_and_upgrade/vhd_build_force_cleanup.bat - """ - } - } - } - - // The options directive is for configuration that applies to the whole job. - options { - buildDiscarder(logRotator(numToKeepStr:'5', daysToKeepStr: '7')) - disableConcurrentBuilds() - timestamps() - office365ConnectorWebhooks([[ - name: "Office 365", - notifyBackToNormal: true, - startNotification: false, - notifyFailure: true, - notifySuccess: false, - notifyNotBuilt: false, - notifyAborted: false, - notifyRepeatedFailure: true, - notifyUnstable: true, - url: "${env.MSTEAMS_URL}" - ]] - ) - } -} diff --git a/installation_and_upgrade/ibex_install_utils/install_tasks.py b/installation_and_upgrade/ibex_install_utils/install_tasks.py index a55357c..c0c8051 100644 --- a/installation_and_upgrade/ibex_install_utils/install_tasks.py +++ b/installation_and_upgrade/ibex_install_utils/install_tasks.py @@ -10,7 +10,6 @@ from ibex_install_utils.tasks.python_tasks import PythonTasks from ibex_install_utils.tasks.server_tasks import ServerTasks from ibex_install_utils.tasks.system_tasks import SystemTasks -from ibex_install_utils.tasks.vhd_tasks import VHDTasks from ibex_install_utils.user_prompt import UserPrompt @@ -81,15 +80,6 @@ def __init__( file_utils, ) - self._vhd_tasks = VHDTasks( - user_prompt, - server_source_dir, - client_source_dir, - genie_python3_dir, - ibex_version, - file_utils, - ) - self._backup_tasks = BackupTasks( user_prompt, server_source_dir, @@ -291,60 +281,6 @@ def run_developer_update(self) -> None: self._system_tasks.create_virtual_envs() self._system_tasks.update_rust() - def run_vhd_creation(self) -> None: - """Automated job which creates a set of VHDs containing all IBEX components. - - Note: this will run under jenkins, don't add interactive tasks to this list. - """ - # To try to start from a clean state if we already have partially mounted VHDs - self._vhd_tasks.request_dismount_vhds() - - self._vhd_tasks.copy_vhds_to_local_area() - self._vhd_tasks.request_mount_vhds() - try: - self._server_tasks.install_ibex_server() - self._python_tasks.install_genie_python3() - self._mysql_tasks.install_mysql_for_vhd() - self._client_tasks.install_ibex_client() - self._server_tasks.setup_config_repository() - - # Some config upgrade steps require MySQL to be running - # For the VHD build, we can always assume we have a MYSQL_PASSWORD env variable - mysql_password = os.getenv("MYSQL_PASSWORD") - if mysql_password is None: - raise Exception("MYSQL_PASSWORD environment variable not set") - with self._mysql_tasks.temporarily_run_mysql(mysql_password): - self._server_tasks.upgrade_instrument_configuration() - - self._server_tasks.setup_calibrations_repository() - self._server_tasks.update_calibrations_repository() - self._vhd_tasks.initialize_var_dir() - finally: - self._vhd_tasks.request_dismount_vhds() - - self._vhd_tasks.deploy_vhds() - - def mount_vhds(self) -> None: - """Task which actually mounts the VHDs (will be run as admin)""" - self._vhd_tasks.mount_vhds() - - def dismount_vhds(self) -> None: - """Task which actually dismounts the VHDs (will be run as admin)""" - self._vhd_tasks.dismount_vhds() - - def request_dismount_vhds(self) -> None: - """Standalone task to request VHDs to be dismounted""" - self._vhd_tasks.request_dismount_vhds() - - def run_vhd_post_install(self) -> None: - """This job is run by the MDT build system when it has built - a windows image and mounted the VHDS - It will tidy up and remaining jobs that were not possible when - the vdh was created e.g. register mysql service - """ - # self._server_tasks.update_icp(self.icp_in_labview_modules()) - self._mysql_tasks.configure_mysql_for_vhd_post_install() - # All possible upgrade tasks UPGRADE_TYPES = { @@ -401,20 +337,12 @@ def run_vhd_post_install(self) -> None: UpgradeInstrument.run_update_journal_parser, "update journal parser", ), - "developer_update": (UpgradeInstrument.run_developer_update, "install latest developer tools"), - "create_vhds": ( - UpgradeInstrument.run_vhd_creation, - "create a set of VHDS containing the latest IBEX release", - ), - "mount_vhds": (UpgradeInstrument.mount_vhds, "task to mount VHDs if needed"), - "dismount_vhds": (UpgradeInstrument.dismount_vhds, "task to dismount VHDs if needed"), - "request_dismount_vhds": ( - UpgradeInstrument.request_dismount_vhds, - "task to request a dismount of VHDs if needed", + "developer_update": ( + UpgradeInstrument.run_developer_update, + "install latest developer tools", ), - "run_vhd_post_install": ( - UpgradeInstrument.run_vhd_post_install, - "Run final task on system after VHD has been mounted locally", + "save_motor_params": ( + UpgradeInstrument.save_motor_params, + "Save motor parameters to csv file", ), - "save_motor_params": (UpgradeInstrument.save_motor_params, "Save motor parameters to csv file"), } diff --git a/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py b/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py index fd60094..f9430c9 100644 --- a/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py +++ b/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py @@ -48,7 +48,12 @@ VCRUNTIME140 = os.path.join("C:\\", "Windows", "System32", "vcruntime140_1.dll") VCRUNTIME140_INSTALLER = os.path.join( - INST_SHARE_AREA, "kits$", "CompGroup", "ICP", "vcruntime140_installer", "vc_redist.x64.exe" + INST_SHARE_AREA, + "kits$", + "CompGroup", + "ICP", + "vcruntime140_installer", + "vc_redist.x64.exe", ) SYSTEM_SETUP_PATH = os.path.join(EPICS_PATH, "SystemSetup") @@ -147,21 +152,6 @@ def _create_mysql_binaries(self) -> None: shutil.rmtree(mysql_unzip_temp) - def _initialize_mysql_data_area_for_vhd(self) -> None: - os.makedirs(os.path.join(MYSQL_FILES_DIR, "data")) - - RunProcess( - working_dir=os.path.join(MYSQL8_INSTALL_DIR, "bin"), - executable_file="mysqld.exe", - executable_directory=os.path.join(MYSQL8_INSTALL_DIR, "bin"), - prog_args=[ - f"--datadir={os.path.join(MYSQL_FILES_DIR, 'data')}", - "--initialize-insecure", - "--console", - "--log-error-verbosity=3", - ], - ).run() - @contextlib.contextmanager def temporarily_run_mysql(self, sql_password: str) -> Generator[None, None, None]: mysqld = os.path.join(MYSQL8_INSTALL_DIR, "bin", "mysqld.exe") @@ -187,7 +177,7 @@ def temporarily_run_mysql(self, sql_password: str) -> Generator[None, None, None log_command_args=False, # To make sure password doesn't appear in jenkins log. ).run() - def _setup_database_users_and_tables(self, vhd_install: bool = True) -> None: + def _setup_database_users_and_tables(self) -> None: sql_password = "" retry_count = 5 while --retry_count > 0: @@ -201,36 +191,28 @@ def _setup_database_users_and_tables(self, vhd_install: bool = True) -> None: if len(sql_password) > 0: break print("Please enter a non blank password") - if vhd_install: - # In the VHD install, need to explicitly temporarily run MySQL. - cm = self.temporarily_run_mysql(sql_password) - else: - # In normal installs, MySQL is already running as a service so do nothing - cm = contextlib.nullcontext() - - with cm: - RunProcess( - executable_directory=os.path.join(MYSQL8_INSTALL_DIR, "bin"), - working_dir=os.path.join(MYSQL8_INSTALL_DIR, "bin"), - executable_file="mysql.exe", - prog_args=[ - "-u", - "root", - "-e", - "ALTER USER 'root'@'localhost' " - f"IDENTIFIED WITH caching_sha2_password BY '{sql_password}';FLUSH " - "privileges; ", - ], - log_command_args=False, # To make sure password doesn't appear in jenkins log. - ).run() + RunProcess( + executable_directory=os.path.join(MYSQL8_INSTALL_DIR, "bin"), + working_dir=os.path.join(MYSQL8_INSTALL_DIR, "bin"), + executable_file="mysql.exe", + prog_args=[ + "-u", + "root", + "-e", + "ALTER USER 'root'@'localhost' " + f"IDENTIFIED WITH caching_sha2_password BY '{sql_password}';FLUSH " + "privileges; ", + ], + log_command_args=False, # To make sure password doesn't appear in jenkins log. + ).run() - RunProcess( - working_dir=SYSTEM_SETUP_PATH, - executable_directory=SYSTEM_SETUP_PATH, - executable_file="config_mysql.bat", - prog_args=[sql_password], - log_command_args=False, # To make sure password doesn't appear in jenkins log. - ).run() + RunProcess( + working_dir=SYSTEM_SETUP_PATH, + executable_directory=SYSTEM_SETUP_PATH, + executable_file="config_mysql.bat", + prog_args=[sql_password], + log_command_args=False, # To make sure password doesn't appear in jenkins log. + ).run() def _setup_mysql8_service(self) -> None: mysqld = os.path.join(MYSQL8_INSTALL_DIR, "bin", "mysqld.exe") @@ -239,7 +221,8 @@ def _setup_mysql8_service(self) -> None: # Wait for initialize since admin runner can't wait for completion. # Maybe we can detect completion another way? admin_commands.add_command( - mysqld, '--install MYSQL84 --datadir="{}"'.format(os.path.join(MYSQL_FILES_DIR, "data")) + mysqld, + '--install MYSQL84 --datadir="{}"'.format(os.path.join(MYSQL_FILES_DIR, "data")), ) admin_commands.add_command("sc", "start MYSQL84", expected_return_val=None) @@ -247,7 +230,8 @@ def _setup_mysql8_service(self) -> None: # where a required disk volume doesn't get mounted in time if just "auto" is used admin_commands.add_command("sc", "config MYSQL84 start= delayed-auto") admin_commands.add_command( - "sc", "failure MYSQL84 reset= 900 actions= restart/10000/restart/30000/restart/60000" + "sc", + "failure MYSQL84 reset= 900 actions= restart/10000/restart/30000/restart/60000", ) admin_commands.add_command("sc", "failureflag MYSQL84 1") admin_commands.add_command( @@ -292,37 +276,7 @@ def _install_latest_mysql8(self, clean_install: bool) -> None: sleep(5) # Time for service to start if clean_install: - self._setup_database_users_and_tables(vhd_install=False) - - @task("Install latest MySQL for VHD deployment") - def install_mysql_for_vhd(self) -> None: - """ - Installs MySQL for the VHD creation build. - - Ensure we start from a clean slate. We are creating VHDs so - we can assume that no files should exist in - C:\\instrument\\apps\\mysql or c:\\instrument\\var\\mysql and - delete them if they do exist. This facilitates - developer testing/resuming the script if it failed halfway through - """ - for path in [MYSQL_FILES_DIR, MYSQL8_INSTALL_DIR]: - if os.path.exists(path): - shutil.rmtree(path) - - self._create_mysql_binaries() - self._initialize_mysql_data_area_for_vhd() - - my_ini_file = os.path.join(EPICS_PATH, "systemsetup", "my.ini") - try: - shutil.copy(my_ini_file, MYSQL8_INSTALL_DIR) - except (OSError, IOError) as e: - self.prompt.prompt_and_raise_if_not_yes( - f"Couldn't copy my.ini from {my_ini_file} to {MYSQL8_INSTALL_DIR}" - f" because {e}. " - f"Please do this manually confirm when complete." - ) - - self._setup_database_users_and_tables(vhd_install=True) + self._setup_database_users_and_tables() def _install_vcruntime140(self) -> None: if not os.path.exists(VCRUNTIME140): @@ -375,15 +329,6 @@ def install_mysql(self, force: bool = False) -> None: if backup_data: self._reload_backup_data() - @task("Configure MySQL for VHD post install") - def configure_mysql_for_vhd_post_install(self) -> None: - """ - configure mysql after vhd is deployed to an instrukent/mdt build - """ - self._setup_mysql8_service() - - sleep(5) # Time for service to start - def _backup_data(self) -> None: """ Backup the data for transfer. This dumps just the data not the schema. diff --git a/installation_and_upgrade/ibex_install_utils/tasks/vhd_tasks.py b/installation_and_upgrade/ibex_install_utils/tasks/vhd_tasks.py deleted file mode 100644 index 52850a3..0000000 --- a/installation_and_upgrade/ibex_install_utils/tasks/vhd_tasks.py +++ /dev/null @@ -1,270 +0,0 @@ -import os -import shutil -import tempfile -from time import sleep - -from ibex_install_utils.admin_runner import AdminCommandBuilder -from ibex_install_utils.run_process import RunProcess -from ibex_install_utils.task import task -from ibex_install_utils.tasks import BaseTasks -from ibex_install_utils.tasks.common_paths import ( - APPS_BASE_DIR, - EPICS_PATH, - INST_SHARE_AREA, - INSTRUMENT_BASE_DIR, - SETTINGS_DIR, - VAR_DIR, -) - - -class Vhd: - def __init__( - self, name: str, source_filename: str, dest_filename: str, mount_point: str - ) -> None: - self.name = name - self.source_filename = source_filename - self.dest_filename = dest_filename - self.mount_point = mount_point - - -VHDS = [ - # Key = VHD location, Value = Mount point - Vhd( - name="Apps", - source_filename="empty_apps.vhdx", - dest_filename="apps.vhdx", - mount_point=APPS_BASE_DIR, - ), - Vhd( - name="Settings", - source_filename="empty_settings.vhdx", - dest_filename="settings.vhdx", - mount_point=SETTINGS_DIR, - ), - Vhd( - name="Var", source_filename="empty_var.vhdx", dest_filename="var.vhdx", mount_point=VAR_DIR - ), -] - - -FILE_TO_REQUEST_VHD_MOUNTING = os.path.join( - INSTRUMENT_BASE_DIR, "ibex_vhd_deployment_mount_vhds.txt" -) -FILE_TO_REQUEST_VHD_DISMOUNTING = os.path.join( - INSTRUMENT_BASE_DIR, "ibex_vhd_deployment_dismount_vhds.txt" -) -VHD_MOUNT_DISMOUNT_TIMEOUT = 300 - - -REMOTE_VHD_SRC_DIR = os.path.join(INST_SHARE_AREA, "Kits$", "CompGroup", "chris") -REMOTE_VHD_DEST_DIR = os.path.join(INST_SHARE_AREA, "Kits$", "CompGroup", "ICP", "W10Clone", "VHDS") -LOCAL_VHD_DIR = os.path.join("C:\\", "Instrument", "VHDS") - - -class VHDTasks(BaseTasks): - """ - Tasks relating to creating or using VHDs. - """ - - @task("Copy VHDs to local area") - def copy_vhds_to_local_area(self) -> None: - if os.path.exists(LOCAL_VHD_DIR): - try: - shutil.rmtree(LOCAL_VHD_DIR) - except (IOError, OSError): - self.request_dismount_vhds() - shutil.rmtree(LOCAL_VHD_DIR) - - os.mkdir(LOCAL_VHD_DIR) - for vhd in VHDS: - shutil.copyfile( - os.path.join(REMOTE_VHD_SRC_DIR, vhd.source_filename), - os.path.join(LOCAL_VHD_DIR, vhd.source_filename), - ) - - def _create_file_and_wait_for_it_to_be_deleted(self, filename: str, timeout: int) -> None: - with open(filename, "w") as f: - f.write("") - - print(f"Waiting for file at {filename} to be deleted...") - for _ in range(timeout): - if not os.path.exists(filename): - break - sleep(1) - else: - os.remove(filename) - print("---") - print("--- start scheduled task output ---") - print("---") - try: - with open( - os.path.join("C:\\", "Instrument", "scheduledtasklog_ibex_vhd_deploy"), "r" - ) as f: - for line in f.readlines(): - print("output from scheduled task: {}".format(line.rstrip())) - except FileNotFoundError: - print( - "File {} doesn't exist no log available".format( - os.path.join("C:\\", "Instrument", "scheduledtasklog_ibex_vhd_deploy") - ) - ) - print("---") - print("--- end scheduled task output ---") - print("---") - raise IOError( - f"File at {filename} still existed after {timeout}s, " - "check VHD scheduled task is running correctly " - ) - - @task("Request VHDs to be mounted") - def request_mount_vhds(self) -> None: - self._create_file_and_wait_for_it_to_be_deleted( - FILE_TO_REQUEST_VHD_MOUNTING, VHD_MOUNT_DISMOUNT_TIMEOUT - ) - - @task("Request VHDs to be dismounted") - def request_dismount_vhds(self) -> None: - self._create_file_and_wait_for_it_to_be_deleted( - FILE_TO_REQUEST_VHD_DISMOUNTING, VHD_MOUNT_DISMOUNT_TIMEOUT - ) - - @task("Mount VHDs") - def mount_vhds(self) -> None: - if not os.path.exists(FILE_TO_REQUEST_VHD_MOUNTING): - return - - admin_commands = AdminCommandBuilder() - - admin_commands.add_command("sc", "stop MYSQL80", expected_return_val=None) - - for vhd in VHDS: - driveletter_file = os.path.join(tempfile.gettempdir(), f"{vhd.name}_driveletter.txt") - if os.path.exists(driveletter_file): - os.remove(driveletter_file) - - if os.path.exists(vhd.mount_point): - admin_commands.add_command( - "move", - f'"{vhd.mount_point}" "{vhd.mount_point}_backup"', - expected_return_val=None, - ) - - # Mount the VHD and write it's assigned drive letter to a file. - admin_commands.add_command( - "powershell", - r'-command "Hyper-V\Mount-VHD -path {vhd_file} -Passthru | Get-Disk | ' - r"Get-Partition | Get-Volume | foreach {{ $_.DriveLetter }} | " - r'out-file -filepath {driveletter_file} -Encoding ASCII -NoNewline"'.format( - vhd_file=os.path.join(LOCAL_VHD_DIR, vhd.source_filename), - driveletter_file=driveletter_file, - ), - ) - - # Append :\\ to drive letter, e.g. E -> E:\\ - # (this is necessary so that directory junctions work correctly) - admin_commands.add_command( - "powershell", - r'-command "echo :\\ | out-file -filepath {driveletter_file} ' - r'-Encoding ASCII -Append -NoNewline"'.format(driveletter_file=driveletter_file), - ) - - # If parent of mount point doesn't exist mklink will fail, create it to avoid this - vhd_mount_point_parent = os.path.dirname(vhd.mount_point) - if not os.path.exists(vhd_mount_point_parent): - admin_commands.add_command( - "powershell", - r'-command "&cmd /c mkdir {mount_point_parent}"'.format( - mount_point_parent=vhd_mount_point_parent - ), - ) - - # Create a directory junction from the mount point to the disk's assigned drive letter - admin_commands.add_command( - "powershell", - r'-command "&cmd /c mklink /J /D {mount_point} @(cat {driveletter_file})"'.format( - mount_point=vhd.mount_point, driveletter_file=driveletter_file - ), - ) - - admin_commands.run_all() - - os.remove(FILE_TO_REQUEST_VHD_MOUNTING) - - @task("Dismount VHDs") - def dismount_vhds(self) -> None: - if not os.path.exists(FILE_TO_REQUEST_VHD_DISMOUNTING): - return - - admin_commands = AdminCommandBuilder() - - # Belt and braces - mysql should already be stopped, but make sure by - # explicitly stopping it again. - admin_commands.add_command("sc", "stop MYSQL80", expected_return_val=None) - - for vhd in VHDS: - # Dismount the VHD - admin_commands.add_command( - "powershell", - r'-command "Hyper-V\Dismount-VHD {vhd_file}"'.format( - vhd_file=os.path.join(LOCAL_VHD_DIR, vhd.source_filename) - ), - expected_return_val=None, - ) - - if os.path.exists(f"{vhd.mount_point}_backup") and os.path.exists(f"{vhd.mount_point}"): - # Can delete aggressively if we have a backup that we're moving - admin_commands.add_command( - "cmd", - r'/c "del /s /q {mount_point}"'.format(mount_point=vhd.mount_point), - expected_return_val=None, - ) - # If we don't have a backup then use rmdir to only delete the mount point - # (does nothing if the dir is non-empty) - admin_commands.add_command( - "cmd", - r'/c "rmdir {mount_point}"'.format(mount_point=vhd.mount_point), - expected_return_val=None, - ) - - # Restore previous directories to where they were before mounting VHDS - if os.path.exists(f"{vhd.mount_point}_backup"): - admin_commands.add_command( - "move", - f'"{vhd.mount_point}_backup" "{vhd.mount_point}"', - expected_return_val=None, - ) - - admin_commands.add_command("sc", "start MYSQL80", expected_return_val=None) - admin_commands.run_all() - - os.remove(FILE_TO_REQUEST_VHD_DISMOUNTING) - - @task("Deploy VHDS") - def deploy_vhds(self) -> None: - if self._ibex_version is not None: - build_folder = os.path.join( - REMOTE_VHD_DEST_DIR, "Releases", "{}".format(self._ibex_version) - ) - else: - build_folder = os.path.join( - REMOTE_VHD_DEST_DIR, "Builds", "Build-{}".format(os.environ["BUILD_NUMBER"]) - ) - os.makedirs(build_folder) - - for vhd in VHDS: - print(f"Deploying {vhd.source_filename} to '{build_folder}'") - shutil.copyfile( - os.path.join(LOCAL_VHD_DIR, vhd.source_filename), - os.path.join(build_folder, vhd.dest_filename), - ) - - print("Cleaning up local artefacts...") - shutil.rmtree(LOCAL_VHD_DIR) - - @task("Initialize var dir") - def initialize_var_dir(self) -> None: - """ - Creates the folder structure for the C:\\instrument\\var directory. - """ - # config_env creates all the necessary directories for us - RunProcess(working_dir=EPICS_PATH, executable_file="config_env.bat").run() diff --git a/installation_and_upgrade/vhd_build.bat b/installation_and_upgrade/vhd_build.bat deleted file mode 100644 index e20ff7b..0000000 --- a/installation_and_upgrade/vhd_build.bat +++ /dev/null @@ -1,23 +0,0 @@ -setlocal EnableDelayedExpansion -set PYTHONUNBUFFERED=1 -set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases" -set "KITS_ICP_PATH=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP" - -call "%~dp0set_epics_ca_addr_list.bat" -call "%~dp0install_or_update_uv.bat" -call "%~dp0set_up_venv.bat" - -IF %errorlevel% neq 0 EXIT /b %errorlevel% - -IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" ( - start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" -) - -call python "%~dp0IBEX_upgrade.py" --kits_icp_dir "%KITS_ICP_PATH%" create_vhds --quiet --no_log_to_var -IF %ERRORLEVEL% NEQ 0 ( - set errcode = %ERRORLEVEL% - call rmdir /s /q %UV_TEMP_VENV% - EXIT /b !errcode! -) - -call rmdir /s /q %UV_TEMP_VENV% diff --git a/installation_and_upgrade/vhd_build_force_cleanup.bat b/installation_and_upgrade/vhd_build_force_cleanup.bat deleted file mode 100644 index bac7c29..0000000 --- a/installation_and_upgrade/vhd_build_force_cleanup.bat +++ /dev/null @@ -1,23 +0,0 @@ -setlocal EnableDelayedExpansion -set PYTHONUNBUFFERED=1 -set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases" -set "KITS_ICP_PATH=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP" - -call "%~dp0set_epics_ca_addr_list.bat" -call "%~dp0install_or_update_uv.bat" -call "%~dp0set_up_venv.bat" -IF %errorlevel% neq 0 EXIT /b %errorlevel% - -IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" ( - start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" -) - -call python "%~dp0IBEX_upgrade.py" --kits_icp_dir "%KITS_ICP_PATH%" request_dismount_vhds --quiet --no_log_to_var - -IF %ERRORLEVEL% NEQ 0 ( - set errcode = %ERRORLEVEL% - call rmdir /s /q %UV_TEMP_VENV% - EXIT /b !errcode! -) - -call rmdir /s /q %UV_TEMP_VENV% diff --git a/installation_and_upgrade/vhd_build_release.bat b/installation_and_upgrade/vhd_build_release.bat deleted file mode 100644 index 62187f9..0000000 --- a/installation_and_upgrade/vhd_build_release.bat +++ /dev/null @@ -1,22 +0,0 @@ -setlocal EnableDelayedExpansion -set PYTHONUNBUFFERED=1 -set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases" - -call "%~dp0set_epics_ca_addr_list.bat" -call "%~dp0install_or_update_uv.bat" -call "%~dp0set_up_venv.bat" -IF %errorlevel% neq 0 EXIT /b %errorlevel% - -IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" ( - start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" -) - -call python -u "%~dp0IBEX_upgrade.py" --release_dir "%SOURCE%" create_vhds --quiet --no_log_to_var - -IF %ERRORLEVEL% NEQ 0 ( - set errcode = %ERRORLEVEL% - call rmdir /s /q %UV_TEMP_VENV% - EXIT /b !errcode! -) - -call rmdir /s /q %UV_TEMP_VENV% diff --git a/installation_and_upgrade/vhd_post_install.bat b/installation_and_upgrade/vhd_post_install.bat deleted file mode 100644 index 9f999b3..0000000 --- a/installation_and_upgrade/vhd_post_install.bat +++ /dev/null @@ -1,14 +0,0 @@ -setlocal -REM this is ran by an MDT configured system to complete tasks after VHDs are mounted -REM we will already have an installed IBEX system - -set PYTHONUNBUFFERED=1 -set "KITS_ICP_PATH=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP" -set "SOURCE=%KITS_ICP_PATH%\Releases" - -IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" ( - start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" -) - -call "C:\Instrument\Apps\Python3\python.exe" -u "%~dp0IBEX_upgrade.py" --client_dir="%TEMP%" --server_dir="%TEMP%" --genie_python3_dir="%TEMP%" run_vhd_post_install --quiet -IF %ERRORLEVEL% NEQ 0 EXIT /b %errorlevel% diff --git a/installation_and_upgrade/vhd_scheduled_task.bat b/installation_and_upgrade/vhd_scheduled_task.bat deleted file mode 100644 index 1cac9fd..0000000 --- a/installation_and_upgrade/vhd_scheduled_task.bat +++ /dev/null @@ -1,6 +0,0 @@ -REM NOTE: this is a separate task expected to be running as admin via a scheduled task every minute on the machine which builds VHDS. - -REM Use a locally installed python in C:\users\\Documents\Python as we don't want to execute code directly from -REM a network share as the admin user. -call "C:\Users\Administrator\Documents\Python\python.exe" "%~dp0vhd_scheduled_task.py" -IF %ERRORLEVEL% neq 0 EXIT /b %errorlevel% diff --git a/installation_and_upgrade/vhd_scheduled_task.py b/installation_and_upgrade/vhd_scheduled_task.py deleted file mode 100644 index 920a997..0000000 --- a/installation_and_upgrade/vhd_scheduled_task.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -Script to install IBEX to various machines -""" - -import sys -import traceback - -from ibex_install_utils.exceptions import ErrorInTask, UserStop -from ibex_install_utils.install_tasks import UpgradeInstrument -from ibex_install_utils.user_prompt import UserPrompt - -if __name__ == "__main__": - try: - prompt = UserPrompt(automatic=True, confirm_steps=False) - upgrade_instrument = UpgradeInstrument(prompt, None, None, None, None, None) - upgrade_instrument.dismount_vhds() - upgrade_instrument.mount_vhds() - except UserStop: - print("User stopped upgrade") - sys.exit(2) - except ErrorInTask: - traceback.print_exc() - sys.exit(1) - - print("Finished upgrade") - sys.exit(0)