Przeglądaj źródła

🐞 fix: ip

修改ip

修改111ip
tags/小炒逻辑变更前
txb 2 lat temu
rodzic
commit
47066db305
2 zmienionych plików z 33 dodań i 33 usunięć
  1. +31
    -31
      Jenkinsfile
  2. +2
    -2
      k8s_kitchenweb.yaml

+ 31
- 31
Jenkinsfile Wyświetl plik

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


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


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


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


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


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


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


sh "rm -rf ./dist/*" 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') { stage('Push') {
steps {
steps {
script{ script{
echo "4.Push Docker Image Stage" echo "4.Push Docker Image Stage"
withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) { 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') 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') { stage('Deploy') {


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


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




} }
} }
} }
}
}

+ 2
- 2
k8s_kitchenweb.yaml Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz