1 Star 0 Fork 986

guhongwei123/yygh-parent

forked from leifengyang/yygh-parent 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hospital_Jenkinsfile 3.95 KB
一键复制 编辑 原始数据 按行查看 历史
guhongwei 提交于 2024-06-14 17:59 . 资源配额修改
pipeline {
agent {
node {
label 'maven'
}
}
stages {
stage('拉取代码') {
agent none
steps {
container('maven') {
git(url: 'https://gitee.com/guhongwei123/yygh-parent.git', credentialsId: 'gitee-id', branch: 'master', changelog: true, poll: false)
sh 'ls -al'
}
}
}
stage('项目编译') {
agent none
steps {
container('maven') {
sh 'ls'
sh 'mvn clean package -pl hospital-manage -Dmaven.test.skip=true'
sh 'ls hospital-manage/target'
}
}
}
stage('default-2') {
parallel {
stage('构建hospital-manage镜像') {
agent none
steps {
container('maven') {
sh 'ls hospital-manage/target'
sh 'docker build -t hospital-manage:latest -f ./hospital-manage/Dockerfile ./hospital-manage/target/'
}
}
}
}
}
stage('default-3') {
parallel {
stage('推送hospital-manage镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USER_VAR' ,passwordVariable : 'DOCKER_PWD_VAR' ,)]) {
sh 'echo "$DOCKER_PWD_VAR" | docker login $REGISTRY -u "$DOCKER_USER_VAR" --password-stdin'
sh 'docker tag hospital-manage:latest $REGISTRY/$DOCKERHUB_NAMESPACE/hospital-manage:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/hospital-manage:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
}
}
stage('default-4') {
parallel {
stage('hospital-manage - 部署到dev环境') {
agent none
steps {
container ('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'ls -l'
sh 'envsubst < hospital-manage/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
}
}
//1、配置全系统的邮件: 全系统的监控
//2、修改ks-jenkins的配置,里面的邮件; 流水线发邮件
// stage('发送确认邮件') {
// agent none
// steps {
// mail(to: '17512080612@163.com', subject: '构建结果', body: "构建成功了 $BUILD_NUMBER")
// }
// }
//http://10.211.55.7:30880/devops_webhook/git/?url=https://gitee.com/guhongwei123/yygh-site.git
}
environment {
DOCKER_CREDENTIAL_ID = 'dockerhub-id'
GITHUB_CREDENTIAL_ID = 'github-id'
// 使用admin的config
KUBECONFIG_CREDENTIAL_ID = 'kubectl-id'
REGISTRY = 'registry.cn-beijing.aliyuncs.com'
DOCKERHUB_NAMESPACE = 'ddup-his'
ALIYUNHUB_NAMESPACE = 'ddup-his'
GITHUB_ACCOUNT = 'kubesphere'
APP_NAME = 'devops-java-sample'
}
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/guhongwei123/yygh-parent.git
git@gitee.com:guhongwei123/yygh-parent.git
guhongwei123
yygh-parent
yygh-parent
master

搜索帮助