Jenkinsfile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #! groovy
  2. node {
  3. def namespace = "yili"
  4. def project = "ai-proj-demo"
  5. def imageTag = new Date().format('yyyyMMddHHmm')
  6. def imageDev = "SXKJ:32775/yili-dag-frontend:${imageTag}"
  7. def branch = params.BRANCH
  8. try {
  9. stage('Clone target repo') {
  10. sh "echo 'clone start'"
  11. checkout([$class: 'GitSCM'],
  12. doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [],
  13. userRemoteConfigs: [[url: 'http://gogsb.soaringnova.com/liutao/ai-proj-demo.git']])
  14. sh "echo 'clone stop'"
  15. }
  16. stage('Build image') {
  17. sh "echo 'build image'"
  18. sh "make dev image-dev=${imageDev}"
  19. // sh "make package package-image=${packageImage}"
  20. }
  21. // stage('Build release') {
  22. // sh "make build-release-image release-image=${releaseImage}"
  23. // }
  24. stage('Push release image to registry') {
  25. sh "docker push ${imageDev}"
  26. // withDockerRegistry(credentialsId: 'docker-user', url: 'https://registry.cn-hangzhou.aliyuncs.com') {
  27. // sh "docker push ${releaseImage}"
  28. // }
  29. }
  30. // stage('Deploy') {
  31. // sh """
  32. // kubectl config use-context dev
  33. // helm -n ${namespace} upgrade ${project} chart \
  34. // -f chart/values.yaml \
  35. // --set-string image.tag=${imageTag} \
  36. // --wait --install
  37. // """
  38. // }
  39. } catch (Exception e) {
  40. currentBuild.result = 'FAILURE'
  41. } finally {
  42. // sh """
  43. // docker image rm ${releaseImage} || true
  44. // docker image rm ${packageImage} || true
  45. // """
  46. deleteDir()
  47. }
  48. }