I am running into an error I don't quite understand. My windows and Batch are probably my worst so be gentle. I inherited this mess and I am trying to figure it out. I initially thought it was just a permissions error, as the team I took this from was passing the creds from jenkins into plain text file then into mpiexec. Yes I know... Now I am testing with just the creds in plain text to make sure its actually works period, then I will handle the proper solution. I have removed sensitive information from the code and log file.
I have made one change to this code so far, and that was removing the plain text file and just passing in the creds directly into mpiexec as you will see below. First is the log output, then the code.
ccr\******* c:\iusers\jenkins\workspace\impi_PR-3056_qy6gczv2>mpiexec -register -username CCR\****** -password ****
[2022-09-22T18:39:50.318Z] credentials were saved.
[2022-09-22T18:39:50.318Z] ) was unexpected at this time.
[2022-09-22T18:39:50.318Z] ccr\********c:\iusers\jenkins\workspace\impi_PR-3056_qy6gczv2>) else if /i "ONEAPI" equ "PSXE" (
script returned exit code 255
package impi
import infra.util.*
public class Deploy {
final private def script
final private String artifactsDir
final private def params
final private String siteId
public Deploy(final def script, final String artifactsDir, final def params, final String siteId) {
this.script = script
this.artifactsDir = artifactsDir
this.params = params
this.siteId = siteId
}
public void deployLinux() {
script.withEnv([
"PACKAGE_INSTALL_LAYOUT=${params.PACKAGE_INSTALL_LAYOUT ?: 'ONEAPI'}",
"artifacts_dir=${artifactsDir}",
"ONEAPI_GLOB=${Consts.OS_CUSTOMIZED_VARS.linux.oneapiPackageMask}",
"PSXE_GLOB=${Consts.OS_CUSTOMIZED_VARS.linux.psxePackageMask}"
]) {
script.sh('''#!/bin/bash
set -ex -o pipefail
# Package specifications
ONEAPI_DIR_NAME="oneapi_impi"
PSXE_DIR_NAME="psxe_impi"
###
PACKAGE_INSTALL_LAYOUT=${PACKAGE_INSTALL_LAYOUT:-ONEAPI}
echo "DEBUG: Install package for ${PACKAGE_INSTALL_LAYOUT} configuration"
selector_glob="${PACKAGE_INSTALL_LAYOUT}_GLOB"
selector_dirname="${PACKAGE_INSTALL_LAYOUT}_DIR_NAME"
package_path=$( ls -1 $artifacts_dir/${!selector_glob} )
package_target_dir_name=${!selector_dirname}
tar xfz $package_path
pushd $( basename $package_path .tgz ) > /dev/null
unzip -P accept package.zip
./install.sh -s -d $artifacts_dir/$package_target_dir_name
echo "DEBUG: Package in ${PACKAGE_INSTALL_LAYOUT} configuration successfully installed to $artifacts_dir/$package_target_dir_name dir"
popd > /dev/null
echo "DEBUG: Enable ${PACKAGE_INSTALL_LAYOUT} testing layout"
ln -s $artifacts_dir/$package_target_dir_name $artifacts_dir/impi
''')
}
}
public void deployWindows() {
script.withEnv([
"ARTIFACTS_DIR=${Utils.getWindowsPath(script, artifactsDir, "^/p/", BaseConsts.CIFS_SERVER_v0[siteId])}", // Autogen archive is always here
"""MPI_ARCHIVE_PATH=${params.MPI_ARCHIVE_PATH ?
Utils.getWindowsPath(script, params.MPI_ARCHIVE_PATH, "^/p/", BaseConsts.CIFS_SERVER_v0[siteId]) :
Utils.getWindowsPath(script, artifactsDir, '^/p/', BaseConsts.CIFS_SERVER_v0[siteId])}""",
"PSXE_PACKAGE_MASK=${Consts.OS_CUSTOMIZED_VARS.windows.psxePackageMask}",
"ONEAPI_PACKAGE_MASK=${Consts.OS_CUSTOMIZED_VARS.windows.oneapiPackageMask}",
"TOOLS_DIR=${Utils.getWindowsPath(script, BaseConsts.CIFS_TOOLS_DIR_v0, "^/p/", BaseConsts.CIFS_SERVER_v0[siteId])}",
"CYGWIN_DIR=${BaseConsts.CYGWIN_DIR}",
"SRC_DIR=${Consts.WINDOWS_SRC_DIR}",
"PACKAGE_INSTALL_LAYOUT=${params.PACKAGE_INSTALL_LAYOUT ?: 'ONEAPI'}"
]) {
script.withCredentials([script.usernamePassword(credentialsId: 'ec25177f-b239-43cb-a2d5-874a88f97fc9', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
script.bat('''
PATH=%TOOLS_DIR%\\unzip-5.51-1-bin\\bin;%CYGWIN_DIR%\\bin;%PATH%
REM Create a source dir in local workspace
if exist %SRC_DIR% rmdir /s/q %SRC_DIR%
if %errorlevel% neq 0 exit /b %errorlevel%
mkdir %SRC_DIR%
REM Obtain IMPI sources with autogen results
copy %MPI_ARCHIVE_PATH%\\impi_src.tgz .
copy %ARTIFACTS_DIR%\\workspace-1-autogen.tgz .
tar -xzf impi_src.tgz -C %SRC_DIR%
if %errorlevel% neq 0 exit /b %errorlevel%
tar -xzf workspace-1-autogen.tgz -C %SRC_DIR%
icacls %SRC_DIR% /remove sys_ctlab
icacls %SRC_DIR% /Q /grant sys_ctlab:(OI)(CI)F /T
icacls %SRC_DIR%
echo "INFO: Deploy %PACKAGE_INSTALL_LAYOUT% package layout"
REM (echo CCR\\%USERNAME%& echo %PASSWORD%& echo %PASSWORD%) > auth_data.txt
mpiexec -register -username CCR\\****** -password ****
REM Obtain IMPI packages and configure services
if /i "%PACKAGE_INSTALL_LAYOUT%" equ "ONEAPI" (
copy %MPI_ARCHIVE_PATH%\\%ONEAPI_PACKAGE_MASK% .
unzip -o -P"accept" %ONEAPI_PACKAGE_MASK%
if %errorlevel% neq 0 exit /b %errorlevel%
bin\\hydra_service.exe -install
if %errorlevel% neq 0 exit /b %errorlevel%
env\\vars.bat
if %errorlevel% neq 0 exit /b %errorlevel%
REM TODO: Fix the mpiexec register call w/ credentials
REM type auth_data.txt | mpiexec -register
REM if %errorlevel% neq 0 exit /b %errorlevel%
) else if /i "%PACKAGE_INSTALL_LAYOUT%" equ "PSXE" (
copy %MPI_ARCHIVE_PATH%\\%PSXE_PACKAGE_MASK% .
unzip -o -P"accept" %PSXE_PACKAGE_MASK%
if %errorlevel% neq 0 exit /b %errorlevel%
intel64\\bin\\hydra_service.exe -install
if %errorlevel% neq 0 exit /b %errorlevel%
intel64\\bin\\mpivars.bat
if %errorlevel% neq 0 exit /b %errorlevel%
REM TODO: Fix the mpiexec register call w/ credentials
REM type auth_data.txt | mpiexec -register
REM if %errorlevel% neq 0 exit /b %errorlevel%
) else (
echo "ERROR: PACKAGE_INSTALL_LAYOUT=%PACKAGE_INSTALL_LAYOUT% is not correct! Please use PSXE or ONEAPI."
exit /b 1
)
del auth_data.txt
'''.stripIndent())
}
}
}
public void uninstallWindows() {
script.withEnv([
"PACKAGE_INSTALL_LAYOUT=${params.PACKAGE_INSTALL_LAYOUT ?: 'ONEAPI'}"
]) {
script.bat('''
if /i "%PACKAGE_INSTALL_LAYOUT%" equ "ONEAPI" (
if exist "bin\\hydra_service.exe" bin\\hydra_service.exe -remove
if %errorlevel% neq 0 exit /b %errorlevel%
rem rmdir /s /q "bin"
rem if %errorlevel% neq 0 exit /b %errorlevel%
) else if /i "%PACKAGE_INSTALL_LAYOUT%" equ "PSXE" (
if exist "intel64\\bin\\hydra_service.exe" intel64\\bin\\hydra_service.exe -remove
if %errorlevel% neq 0 exit /b %errorlevel%
rem rmdir /s /q "intel64\\bin"
rem if %errorlevel% neq 0 exit /b %errorlevel%
) else (
echo "ERROR: PACKAGE_INSTALL_LAYOUT=%PACKAGE_INSTALL_LAYOUT% is not correct! Please use PSXE or ONEAPI."
)
'''.stripIndent())
}
}
}