Skip to content

Commit 930da1a

Browse files
Merge pull request #252 from ISISComputingGroup/new_builds_fixes
Fixes for new jenkins build names
2 parents 1be4b32 + 21afea4 commit 930da1a

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

installation_and_upgrade/IBEX_upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def _get_latest_existing_dir_path(release_dir: str, component: str) -> str:
117117
parser.add_argument(
118118
"--server_winbuild",
119119
dest="server_winbuild",
120-
default="win7",
121-
choices=["win7", "win10", "win11"],
120+
default="win",
121+
choices=["win"],
122122
help="Server winbuild.",
123123
)
124124

installation_and_upgrade/ibex_install_utils/tasks/server_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def upgrade_instrument_configuration(self) -> None:
252252
"""Update the configuration on the instrument using its upgrade config script."""
253253
manual_prompt = (
254254
"Merge the master configurations branch into the instrument configuration. "
255-
"From C:\Instrument\Settings\config\[machine name] run:\n"
255+
"From C:\\Instrument\\Settings\\config\\[machine name] run:\n"
256256
" 0. Clean up any in progress merge (e.g. git merge --abort)\n"
257257
" 1. git checkout master\n"
258258
" 2. git pull\n"
@@ -340,7 +340,7 @@ def setup_calibrations_repository(self) -> None:
340340
self.update_calibrations_repository()
341341
else:
342342
repo_url = "https://gitlab.stfc.ac.uk/isisexperimentcontrols/common.git"
343-
location = "C:\Instrument\Settings\config\common"
343+
location = r"C:\Instrument\Settings\config\common"
344344
RunProcess(
345345
working_dir=os.curdir,
346346
executable_file="git",

installation_and_upgrade/ibex_install_utils/tasks/vhd_tasks.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919

2020
class Vhd:
21-
def __init__(self, name, source_filename, dest_filename, mount_point):
21+
def __init__(
22+
self, name: str, source_filename: str, dest_filename: str, mount_point: str
23+
) -> None:
2224
self.name = name
2325
self.source_filename = source_filename
2426
self.dest_filename = dest_filename
@@ -65,7 +67,7 @@ class VHDTasks(BaseTasks):
6567
"""
6668

6769
@task("Copy VHDs to local area")
68-
def copy_vhds_to_local_area(self):
70+
def copy_vhds_to_local_area(self) -> None:
6971
if os.path.exists(LOCAL_VHD_DIR):
7072
try:
7173
shutil.rmtree(LOCAL_VHD_DIR)
@@ -80,7 +82,7 @@ def copy_vhds_to_local_area(self):
8082
os.path.join(LOCAL_VHD_DIR, vhd.source_filename),
8183
)
8284

83-
def _create_file_and_wait_for_it_to_be_deleted(self, filename, timeout):
85+
def _create_file_and_wait_for_it_to_be_deleted(self, filename: str, timeout: int) -> None:
8486
with open(filename, "w") as f:
8587
f.write("")
8688

@@ -110,24 +112,24 @@ def _create_file_and_wait_for_it_to_be_deleted(self, filename, timeout):
110112
print("--- end scheduled task output ---")
111113
print("---")
112114
raise IOError(
113-
f"File at {filename} still existed after {timeout}s, check VHD scheduled task is running "
114-
f"correctly "
115+
f"File at {filename} still existed after {timeout}s, "
116+
"check VHD scheduled task is running correctly "
115117
)
116118

117119
@task("Request VHDs to be mounted")
118-
def request_mount_vhds(self):
120+
def request_mount_vhds(self) -> None:
119121
self._create_file_and_wait_for_it_to_be_deleted(
120122
FILE_TO_REQUEST_VHD_MOUNTING, VHD_MOUNT_DISMOUNT_TIMEOUT
121123
)
122124

123125
@task("Request VHDs to be dismounted")
124-
def request_dismount_vhds(self):
126+
def request_dismount_vhds(self) -> None:
125127
self._create_file_and_wait_for_it_to_be_deleted(
126128
FILE_TO_REQUEST_VHD_DISMOUNTING, VHD_MOUNT_DISMOUNT_TIMEOUT
127129
)
128130

129131
@task("Mount VHDs")
130-
def mount_vhds(self):
132+
def mount_vhds(self) -> None:
131133
if not os.path.exists(FILE_TO_REQUEST_VHD_MOUNTING):
132134
return
133135

@@ -150,18 +152,20 @@ def mount_vhds(self):
150152
# Mount the VHD and write it's assigned drive letter to a file.
151153
admin_commands.add_command(
152154
"powershell",
153-
r'-command "Hyper-V\Mount-VHD -path {vhd_file} -Passthru | Get-Disk | Get-Partition | Get-Volume | foreach {{ $_.DriveLetter }} | out-file -filepath {driveletter_file} -Encoding ASCII -NoNewline"'.format(
155+
r'-command "Hyper-V\Mount-VHD -path {vhd_file} -Passthru | Get-Disk | '
156+
r"Get-Partition | Get-Volume | foreach {{ $_.DriveLetter }} | "
157+
r'out-file -filepath {driveletter_file} -Encoding ASCII -NoNewline"'.format(
154158
vhd_file=os.path.join(LOCAL_VHD_DIR, vhd.source_filename),
155159
driveletter_file=driveletter_file,
156160
),
157161
)
158162

159-
# Append :\\ to drive letter, e.g. E -> E:\\ (this is necessary so that directory junctions work correctly)
163+
# Append :\\ to drive letter, e.g. E -> E:\\
164+
# (this is necessary so that directory junctions work correctly)
160165
admin_commands.add_command(
161166
"powershell",
162-
r'-command "echo :\\ | out-file -filepath {driveletter_file} -Encoding ASCII -Append -NoNewline"'.format(
163-
driveletter_file=driveletter_file
164-
),
167+
r'-command "echo :\\ | out-file -filepath {driveletter_file} '
168+
r'-Encoding ASCII -Append -NoNewline"'.format(driveletter_file=driveletter_file),
165169
)
166170

167171
# If parent of mount point doesn't exist mklink will fail, create it to avoid this
@@ -187,13 +191,14 @@ def mount_vhds(self):
187191
os.remove(FILE_TO_REQUEST_VHD_MOUNTING)
188192

189193
@task("Dismount VHDs")
190-
def dismount_vhds(self):
194+
def dismount_vhds(self) -> None:
191195
if not os.path.exists(FILE_TO_REQUEST_VHD_DISMOUNTING):
192196
return
193197

194198
admin_commands = AdminCommandBuilder()
195199

196-
# Belt and braces - mysql should already be stopped, but make sure by explicitly stopping it again.
200+
# Belt and braces - mysql should already be stopped, but make sure by
201+
# explicitly stopping it again.
197202
admin_commands.add_command("sc", "stop MYSQL80", expected_return_val=None)
198203

199204
for vhd in VHDS:
@@ -213,8 +218,8 @@ def dismount_vhds(self):
213218
r'/c "del /s /q {mount_point}"'.format(mount_point=vhd.mount_point),
214219
expected_return_val=None,
215220
)
216-
# If we don't have a backup then use rmdir to only delete the mount point (does nothing if the dir
217-
# is non-empty)
221+
# If we don't have a backup then use rmdir to only delete the mount point
222+
# (does nothing if the dir is non-empty)
218223
admin_commands.add_command(
219224
"cmd",
220225
r'/c "rmdir {mount_point}"'.format(mount_point=vhd.mount_point),
@@ -235,7 +240,7 @@ def dismount_vhds(self):
235240
os.remove(FILE_TO_REQUEST_VHD_DISMOUNTING)
236241

237242
@task("Deploy VHDS")
238-
def deploy_vhds(self):
243+
def deploy_vhds(self) -> None:
239244
if self._ibex_version is not None:
240245
build_folder = os.path.join(
241246
REMOTE_VHD_DEST_DIR, "Releases", "{}".format(self._ibex_version)
@@ -257,9 +262,9 @@ def deploy_vhds(self):
257262
shutil.rmtree(LOCAL_VHD_DIR)
258263

259264
@task("Initialize var dir")
260-
def initialize_var_dir(self):
265+
def initialize_var_dir(self) -> None:
261266
"""
262-
Creates the folder structure for the C:\instrument\var directory.
267+
Creates the folder structure for the C:\\instrument\\var directory.
263268
"""
264269
# config_env creates all the necessary directories for us
265270
RunProcess(working_dir=EPICS_PATH, executable_file="config_env.bat").run()

installation_and_upgrade/instrument_install_latest_build_only.bat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
REM Install latest version of IBEX
22
REM argument 1 is CLEAN, INCR or RELEASE for type of build touse (default: CLEAN)
33
REM argument 2 is a server build prefix
4-
REM normally will use EPICS_win7_x64 or EPICS_CLEAN_win7_x64 depending on incremental/clean
5-
REM with prefix specified will use {prefix}_win7_x64 and {prefix}_CLEAN_win7_x64 for server install source directory
4+
REM normally will use EPICS_win_x64 or EPICS_CLEAN_win_x64 depending on incremental/clean
5+
REM with prefix specified will use {prefix}_win_x64 and {prefix}_CLEAN_win_x64 for server install source directory
66
REM argument 3 can be x86 or x64, defaults to x64 if not specified.
7-
REM this will change e.g. {prefix}_win7_x64 to {prefix}_win7_x86 as server source directory to use
8-
REM argument 4 can be server winbuild, defaults to win7 if not specified.
9-
REM this will change e.g. {prefix}_win7_x64 to {prefix}_win1_x64 as server source directory to use
7+
REM this will change e.g. {prefix}_win_x64 to {prefix}_win_x86 as server source directory to use
8+
REM argument 4 can be server winbuild, defaults to win if not specified.
9+
REM this will change e.g. {prefix}_win_x64 to {prefix}_winABC_x64 as server source directory to use
1010

1111
setlocal EnableDelayedExpansion
1212

0 commit comments

Comments
 (0)