script {
def return_code = sh(script: "dotnet format --check --report dotnet-format-report ${SOLUTION_PATH}", returnStatus: true)
DOTNET_FORMAT_RESULT_CODE = return_code
- withCredentials([usernamePassword(credentialsId: 'http_server_password', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+
+ withCredentials([sshUserPrivateKey(credentialsId: 'http_server_ssh', keyFileVariable: 'SSH_KEY', passphraseVariable: 'PASSPHRASE', usernameVariable: 'USERNAME')]) {
def user_host = "${USERNAME}@${HTTP_SERVER}"
def www_path = ""
if(BRANCH_NAME == "tizen") {
www_path = "${HTTP_DOTNET_FORMAT_PATH}/${PROJECT_NAME}_dotnet_format_output/${BRANCH_NAME}/${GIT_COMMIT_REV}"
}
def path = "~/www/${www_path}"
+ def KEY_FILE = SSH_KEY
+ //sh "cat > ${KEY_FILE} <<EOF\n${SSH_KEY}\nEOF"
+ sh "chmod 400 ${KEY_FILE}"
if(BRANCH_NAME == "tizen") {
- sh "ssh -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
}
- sh "ssh -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
- sh "scp ${SOLUTION_DIR}/dotnet-format-report/format-report.json \"${user_host}:${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
+ sh "scp -i ${KEY_FILE} ${SOLUTION_DIR}/dotnet-format-report/format-report.json \"${user_host}:${path}\""
DOTNET_FORMAT_RESULT_URL="${HTTP_BASE_URL_PATH}/${www_path}/format-report.json"
}
}
sh "echo Clang format exited with unknown error"
currentBuild.result = 'FAILURE'
}
- withCredentials([usernamePassword(credentialsId: 'http_server_password', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+ withCredentials([sshUserPrivateKey(credentialsId: 'http_server_ssh', keyFileVariable: 'SSH_KEY', passphraseVariable: 'PASSPHRASE', usernameVariable: 'USERNAME')]) {
def user_host = "${USERNAME}@${HTTP_SERVER}"
def www_path = ""
if(BRANCH_NAME == "tizen") {
www_path = "${HTTP_CLANG_FORMAT_PATH}/${PROJECT_NAME}_clang_format_output/${BRANCH_NAME}/${GIT_COMMIT_REV}"
}
def path = "~/www/${www_path}"
+ def KEY_FILE = SSH_KEY
+ //sh "cat > ${KEY_FILE} <<EOF\n${SSH_KEY}\nEOF"
+ sh "chmod 400 ${KEY_FILE}"
if(BRANCH_NAME == "tizen") {
- sh "ssh -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
}
- sh "ssh -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
- sh "scp clang_format.diff \"${user_host}:${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
+ sh "scp -i ${KEY_FILE} clang_format.diff \"${user_host}:${path}\""
CLANG_RESULT_URL="${HTTP_BASE_URL_PATH}/${www_path}/clang_format.diff"
}
}
archiveArtifacts("${PROJECT_NAME}_SAM.zip")
sh "cp output/html/*.html output/html/report.html"
sh "cp output/html/*.png output/html/result.png"
- withCredentials([usernamePassword(credentialsId: 'http_server_password', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+ withCredentials([sshUserPrivateKey(credentialsId: 'http_server_ssh', keyFileVariable: 'SSH_KEY', passphraseVariable: 'PASSPHRASE', usernameVariable: 'USERNAME')]) {
def user_host = "${USERNAME}@${HTTP_SERVER}"
def www_path = ""
if(BRANCH_NAME == "tizen") {
www_path = "${HTTP_SAM_PATH}/${PROJECT_NAME}_SAM_output/${BRANCH_NAME}/${GIT_COMMIT_REV}"
}
def path = "~/www/${www_path}"
+ def KEY_FILE = SSH_KEY
+ //sh "cat > ${KEY_FILE} <<EOF\n${SSH_KEY}\nEOF"
+ sh "chmod 400 ${KEY_FILE}"
if(BRANCH_NAME == "tizen") {
- sh "ssh -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} rm -rf \"${path}\""
}
- sh "ssh -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
- sh "scp -r output \"${user_host}:${path}\""
- sh "scp ${PROJECT_NAME}_SAM.zip \"${user_host}:${path}\""
+ sh "ssh -i ${KEY_FILE} -o StrictHostKeychecking=no ${user_host} mkdir -p \"${path}\""
+ sh "scp -i ${KEY_FILE} -r output \"${user_host}:${path}\""
+ sh "scp -i ${KEY_FILE} ${PROJECT_NAME}_SAM.zip \"${user_host}:${path}\""
SAM_RESULT_URL="${HTTP_BASE_URL_PATH}/${www_path}/output/html/report.html"
}
}