新增测试环境后台地址和流水线脚本
This commit is contained in:
parent
ba42b49625
commit
3ae6f97756
@ -5,7 +5,7 @@ VUE_APP_BASE_API = '/console'
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
# application base url
|
||||
VUE_APP_BASE_URL ='https://console-test.lequdev.com'
|
||||
VUE_APP_BASE_URL ='http://192.168.0.117:32700'
|
||||
|
||||
# oss
|
||||
VUE_APP_OSS_BUCKET = 'tkm-likei'
|
||||
|
||||
52
pipeline-dev
52
pipeline-dev
@ -1,13 +1,19 @@
|
||||
pipeline {
|
||||
|
||||
agent {
|
||||
label "dev"
|
||||
label "dev"
|
||||
}
|
||||
|
||||
tools {
|
||||
nodejs 'node22'
|
||||
}
|
||||
|
||||
environment {
|
||||
PATH = "/var/jenkins_home/docker-cli/bin:/var/jenkins_home/kubectl/bin:${env.PATH}"
|
||||
BUILD_IMAGE = "${sh(script:'echo -n likei-dev:page-console-$(date +%Y%m%dv%H%M%S)', returnStdout: true)}"
|
||||
IMAGE_REP_TAG = "989328288674.dkr.ecr.ap-southeast-1.amazonaws.com/"
|
||||
K8S_NAMESPACE = "local"
|
||||
ALIYUN_REGISTRY = "registry.cn-hangzhou.aliyuncs.com/azizi-dev/page-console"
|
||||
IMAGE_REP_TAG = ""
|
||||
K8S_NAMESPACE = "azizi"
|
||||
K8S_DEPLOYMENT = "console-page"
|
||||
K8S_APP_LABEL = "console-page"
|
||||
}
|
||||
@ -15,25 +21,33 @@ pipeline {
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'export PATH=$HOME/bin:$PATH &&export NODE_HOME=/usr/local/node &&export PATH=$NODE_HOME/bin:$PATH &&export PATH=$PATH:/usr/local/go/bin &&npm install'
|
||||
sh 'export PATH=$HOME/bin:$PATH &&export NODE_HOME=/usr/local/node &&export PATH=$NODE_HOME/bin:$PATH &&export PATH=$PATH:/usr/local/go/bin &&npm run build:stage'
|
||||
sh 'export PATH=$HOME/bin:$PATH && export NODE_HOME=/usr/local/node && export PATH=$NODE_HOME/bin:$PATH && npm install'
|
||||
sh 'export PATH=$HOME/bin:$PATH && export NODE_HOME=/usr/local/node && export PATH=$NODE_HOME/bin:$PATH && npm run build:dev'
|
||||
sh 'du -sh dist'
|
||||
script {
|
||||
IMAGE_REP_TAG="${sh(script:'echo -n ${IMAGE_REP_TAG}${BUILD_IMAGE}', returnStdout: true)}"
|
||||
IMAGE_REP_TAG = "${ALIYUN_REGISTRY}:page-console-${sh(script:'date +%Y%m%dv%H%M%S', returnStdout: true).trim()}"
|
||||
}
|
||||
echo "---> Image registry tag: ${IMAGE_REP_TAG}"
|
||||
}
|
||||
}
|
||||
stage('Build image') {
|
||||
steps {
|
||||
sh "aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 989328288674.dkr.ecr.ap-southeast-1.amazonaws.com"
|
||||
sh "docker build -t ${BUILD_IMAGE} ."
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'aliyun-registry',
|
||||
usernameVariable: 'ALIYUN_USER',
|
||||
passwordVariable: 'ALIYUN_PASS'
|
||||
)]) {
|
||||
sh 'echo $ALIYUN_PASS | docker login --username $ALIYUN_USER --password-stdin registry.cn-hangzhou.aliyuncs.com'
|
||||
}
|
||||
sh "docker build -t ${IMAGE_REP_TAG} ."
|
||||
}
|
||||
}
|
||||
stage('Upload image') {
|
||||
steps {
|
||||
sh "docker tag ${BUILD_IMAGE} ${IMAGE_REP_TAG}"
|
||||
sh "docker push ${IMAGE_REP_TAG}"
|
||||
sh "docker rmi -f ${BUILD_IMAGE} ${IMAGE_REP_TAG}"
|
||||
sh "docker tag ${IMAGE_REP_TAG} ${ALIYUN_REGISTRY}:latest"
|
||||
sh "docker push ${ALIYUN_REGISTRY}:latest"
|
||||
sh "docker rmi -f ${IMAGE_REP_TAG} ${ALIYUN_REGISTRY}:latest"
|
||||
}
|
||||
}
|
||||
stage('Apply') {
|
||||
@ -41,17 +55,11 @@ pipeline {
|
||||
sh "kubectl -n ${K8S_NAMESPACE} set image deployment/${K8S_DEPLOYMENT} ${K8S_APP_LABEL}=${IMAGE_REP_TAG}"
|
||||
}
|
||||
}
|
||||
|
||||
// stage('Clear Cahe') {
|
||||
// steps {
|
||||
// sh 'sleep 40s'
|
||||
// sh 'aws cloudfront create-invalidation --distribution-id E3PFTQHTUMCCVT --paths "/*"'
|
||||
// }
|
||||
// }
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user