Просмотр исходного кода

🐞 fix: ip

修改ip

修改111ip
tags/小炒逻辑变更前
txb 2 лет назад
Родитель
Сommit
47066db305
2 измененных файлов: 33 добавлений и 33 удалений
  1. +31
    -31
      Jenkinsfile
  2. +2
    -2
      k8s_kitchenweb.yaml

+ 31
- 31
Jenkinsfile Просмотреть файл

@@ -11,7 +11,7 @@ def getHost(){
}

pipeline{
agent any
agent any
parameters {
choice(
description: 'EIP环境',
@@ -21,19 +21,19 @@ pipeline{

choice(
description: '执行操作(发布|回滚)',
name: 'operation',
name: 'operation',
choices: ['develop', 'rollback']
)

choice(
description: '是否下载包',
name: 'isDownloadPackage',
name: 'isDownloadPackage',
choices: ['是','否']
)

string(
name: 'tag',
defaultValue: '',
name: 'tag',
defaultValue: '',
description: '版本tag'
)

@@ -43,7 +43,7 @@ pipeline{
{

stage('Prepare') {
steps {
steps {
script{
echo "1.Prepare Stage"
echo "当前环境${params.environment}"
@@ -64,67 +64,67 @@ pipeline{
}
}
stage('Test') {
steps {
steps {
script{
echo "2.Test Stage"
}
}
}
stage('Build') {
steps {
steps {
script{
echo "3.Build Docker Image Stage"
if(params.operation=='develop')
{
nodejs("nodejs") {
}
if(params.isDownloadPackage=='是')
{
sh "npm install --unsafe-perm=true --allow-root"
sh "npm install --unsafe-perm=true --allow-root"
}

sh "rm -rf ./dist/*"
sh "npm run build"
sh "docker build -t 111.9.47.105:10249/bpa/kitchenweb:${build_tag} ."
}
sh "npm run build"
sh "docker build -t 10.2.1.24:10242/bpa/kitchenweb:${build_tag} ."
}
}
}

}





stage('Push') {
steps {
steps {
script{
echo "4.Push Docker Image Stage"
withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) {
sh "docker login -u ${harborUser} -p ${harborPassword} 111.9.47.105:10249"
sh "docker login -u ${harborUser} -p ${harborPassword} 10.2.1.24:10242"
if(params.operation=='develop')
{
sh "docker push 111.9.47.105:10249/bpa/kitchenweb:${build_tag}"
{
sh "docker push 10.2.1.24:10242/bpa/kitchenweb:${build_tag}"
}
}
}
}

}

stage('Deploy') {

steps {
steps {
script{
echo "5. Deploy Stage"
// server = getHost()
// sshCommand remote: server, command: """
// sshCommand remote: server, command: """
// /root/eip/web/shell/linux-eipweb.install.sh eipweb ${build_tag} 80
// """

@@ -135,9 +135,9 @@ pipeline{
}


}
}
}
}
}

+ 2
- 2
k8s_kitchenweb.yaml Просмотреть файл

@@ -4,7 +4,7 @@ metadata:
name: kitchenweb
namespace: kube-<NAMESPACES>
spec:
selector:
matchLabels:
app: kitchenweb
@@ -15,7 +15,7 @@ spec:
app: kitchenweb
spec:
containers:
- image: 111.9.47.105:10249/bpa/kitchenweb:<BUILD_TAG>
- image: 10.2.1.24:10242/bpa/kitchenweb:<BUILD_TAG>
imagePullPolicy: IfNotPresent
name: kitchenweb
env:


Загрузка…
Отмена
Сохранить