Selaa lähdekoodia

添加 'Jenkinsfile'

chenghongxi 4 vuotta sitten
vanhempi
commit
bd92c224e6
1 muutettua tiedostoa jossa 20 lisäystä ja 0 poistoa
  1. 20 0
      Jenkinsfile

+ 20 - 0
Jenkinsfile

@@ -0,0 +1,20 @@
+def git_auth="d4b4c06c-7a45-4969-a06d-8363858e81cd"
+def git_url="https://gitee.com/chenghongxi/demo.git"
+def jenkins_home="/var/jenkins_home/workspace/k8s/"
+def xy_image="registry-vpc.cn-beijing.aliyuncs.com/xinyue-jenkins/"
+def release="${BUILD_NUMBER}"
+
+node {
+    stage('pull code') {
+        checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${git_auth}", url: "${git_url}"]]])}
+    stage('build images') {
+        sh "cd ${jenkins_home}${project_name}"
+        sh "docker build -t ${xy_image}${project_name}:${release} -f ${jenkins_home}${project_name}/Dockerfile ${jenkins_home}${project_name}"
+    }
+    stage('push aliyuncs') {
+        sh "docker push ${xy_image}${project_name}:${BUILD_NUMBER}"
+   }
+   stage('pod health'){
+        sh "kubectl"
+   }
+}