更新 'Jenkinsfile'

main
newrain001 11 months ago
parent 9e8b10a357
commit bc5cd37345
  1. 7
      Jenkinsfile

7
Jenkinsfile vendored

@ -81,6 +81,13 @@ spec:
stage('部署到kubernetes') { stage('部署到kubernetes') {
steps { steps {
container('kubectl') { container('kubectl') {
sh 'pwd;ls'
sh 'echo "REPLICAS: ${env.REPLICAS}"'
sh 'echo "HARBOR_HOST: ${env.HARBOR_HOST}"'
sh 'echo "NAMESPACE_NAME: ${env.NAMESPACE_NAME}"'
sh 'echo "REPOSITORY_NAME: ${env.REPOSITORY_NAME}"'
sh 'echo "TAG: ${env.TAG}"'
sh 'echo "YAML_PATH: ${env.YAML_PATH}"'
sh """ sh """
sed -i "s/REPLICAS/${env.REPLICAS}/;s/HARBOR_HOST/${env.HARBOR_HOST}/;s/NAMESPACE_NAME/${env.NAMESPACE_NAME}/;s/REPOSITORY_NAME/${env.REPOSITORY_NAME}/;s/TAG/${env.TAG}/" ${env.YAML_PATH} sed -i "s/REPLICAS/${env.REPLICAS}/;s/HARBOR_HOST/${env.HARBOR_HOST}/;s/NAMESPACE_NAME/${env.NAMESPACE_NAME}/;s/REPOSITORY_NAME/${env.REPOSITORY_NAME}/;s/TAG/${env.TAG}/" ${env.YAML_PATH}
kubectl apply -f ${env.YAML_PATH} kubectl apply -f ${env.YAML_PATH}

Loading…
Cancel
Save