0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Jenkinsの認証情報を用いてbatでNASにアクセスする

Posted at
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
            '''
        }
    }
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?