stage('Push to Git') {
  
         String NcpRepoUrl = "${env.NCP_REPO_URL}";
                   
// 새로운 디렉토리 생성 및 파일 복사
       dir('DOCKER') {
   
// NCP 리포지토리 targetDir을 clone,
// bat 실행 위치는 DOCKER 폴더 이기에 
// clone을 받은 local repository, DOCKER/targetDir에서 작업해야한다.

            bat """ 
            
            git clone --branch master https://${NCP_USER}:${NCP_PASSWORD}@${NcpRepoUrl}
            
            cd ./targetDir
            
            git config --global user.email "test_ncp@example.com"

            git config --global user.name "test_ncp"

            """
   
      
// push 하려는 파일 file.exe을
// targetDir로 복사
   
            bat "copy ../sourceDir/file.exe ./targetDir/"
   
   
// Git 푸시
   
            bat """
            
            cd ./targetDir
            
            git add -A

            git commit -m "Pushing file.exe to huniDev repository"

            git push https://${NCP_USER}:${NCP_PASSWORD}@${NcpRepoUrl} master

            """
      }
  }

'CI-CD' 카테고리의 다른 글

docker 사용 시 용량 부족 현상  (1) 2024.11.07

+ Recent posts