stage('Copy to NAS with Login') {
steps {
withCredentials([usernamePassword(credentialsId: 'nas-credentials', usernameVariable: 'NAS_USER', passwordVariable: 'NAS_PASS')]) {
bat '''
chcp 65001
set "NAS_PATH=\\\\NAS01\\coverage-reports"
net use %NAS_PATH% /user:%NAS_USER% %NAS_PASS%
set "src=%WORKSPACE%\\build\\reports\\jacoco"
set "dst=%NAS_PATH%\\%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%"
mkdir "%dst%"
robocopy "%src%" "%dst%" /E
'''
}
}
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme