Ai
1 Star 0 Fork 0

biancl/ansible-maven-sample

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Jenkinsfile-deploy 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
占翼 提交于 2018-12-25 16:26 +08:00 . 删除不必要的部署脚本。整理README.
#!groovy
node('ansible-master') {
def artServer = Artifactory.newServer url: "$ATF_URL", credentialsId: 'GLOBAL-ARTIFACTORY';
def ansible_ssh_credential='app-172.17.197.195';
def playbook_path='deploy/app.yml';
def inventory_path='deploy/inventories/stage/hosts';
def group_path='com/cfets/devops/ansible-maven-sample';
def artifact_id='ansible-maven-sample';
def classifier='deploy';
def artifact_type='tar';
properties([
parameters([
string(defaultValue: '', description: '版本号,应当与构建产出物版本号一致', name: 'version')])])
stage('download artifacts'){
cleanWs();
echo "ATF_URL=${ATF_URL}";
echo "version=${env.version}";
withCredentials([usernameColonPassword(credentialsId: 'GLOBAL-ARTIFACTORY', variable: 'ATF_TOKEN')]){
sh "curl -k -u $ATF_TOKEN -O ${ATF_APP_REPO}/${group_path}/${version}/${artifact_id}-${version}-${classifier}.${artifact_type}"
sh "curl -k -u $ATF_TOKEN -O ${ATF_APP_REPO}/${group_path}/${version}/${artifact_id}-${version}-${classifier}.${artifact_type}.md5"
}
def name="$artifact_id-${version}-${classifier}.${artifact_type}";
def md5name="$artifact_id-${version}-${classifier}.${artifact_type}.md5";
echo "name=$name"
sh "echo \" $name\" >> $md5name";
sh "md5sum -c $md5name"
sh "tar -xvf *.tar"
}
stage('deploy'){
ansiblePlaybook credentialsId: "$ansible_ssh_credential", extras: "-e app_version=${version}", inventory: "$inventory_path", playbook: "$playbook_path"
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/biancl/ansible-maven-sample.git
git@gitee.com:biancl/ansible-maven-sample.git
biancl
ansible-maven-sample
ansible-maven-sample
develop

搜索帮助