你好,朋友们,我要进入詹金斯的世界,因为我的需要是自动化的过程,一旦这一切都纠正了jar或war被上传到一个特定的文件夹在谷歌驱动器,这是可能的?
我的jenkinsFile
"pipeline"{
"agent any
tools"{
"maven""MAVEN""jdk""Java11"
}"stages"{
"stage(""Clone the repo"")"{
"steps"{
"echo""Clone the repo""git credentialsId":"GitHub",
"url":"https://github.com/xxxxxxxxxxx.git"
}
}"stage(""Maven Build SETTINGS"")"{
"steps"{
"withMaven( mavenSettingsConfig":"mvn-setting-xml"")"{
"bat""mvn clean -U package"
}
}
}"stage(""Quality gate"")"{
"steps"{
"echo""stage Quality gate here"
}
}"stage(""Unit Test"")"{
"steps"{
"echo""stage 3 here"
}
}"stage(""SonarQube Test"")"{
"steps"{
"echo""stage 4 here"
}
}"stage(""Deploy"")"{
"steps"{
"echo""deployment here"
}
}
}
}
发布于 2022-06-07 10:20:57
您可以为Jenkins使用谷歌云存储插件。他们给出了一个非常全面的例子,说明如何为自由式项目和声明性项目做这件事。在此复制:
pipeline {
agent any
environment {
CREDENTIALS_ID ='<YOUR_CREDENTIALS_ID>'
BUCKET = '<YOUR_BUCKET_NAME>'
PATTERN = '<OBJECT_TO_UPLOAD>'
}
stages{
stage('Store to GCS') {
steps{
sh '''
env > build_environment.txt
'''
// If we name pattern build_environment.txt, this will upload the local file to our GCS bucket.
step([$class: 'ClassicUploadStep', credentialsId: env
.CREDENTIALS_ID, bucket: "gs://${env.BUCKET}",
pattern: env.PATTERN])
}
}
}
需要注意的一点是,您设置为<YOUR_CREDENTIALS_ID>
的凭据是从谷歌OAuth凭证插件中提取的,因此您需要安装该插件并设置它以提供您的凭据。这两个插件都有描述性很强的文档,所以一定要全部阅读。
https://stackoverflow.com/questions/72523006
复制相似问题