Cron with interval 1 second, yaml based configs
go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1KB

  1. node {
  2. checkout scm
  3. def registry = "registry.blindage.org"
  4. def tag = env.TAG_NAME
  5. def image
  6. def repository = "gogocron"
  7. def image_name = "${repository}:${tag}"
  8. stage("Build app binary") {
  9. sh "docker run --rm -v jenkins_jenkins-data:/var/jenkins_home golang:1.13 /bin/sh -c 'cd ${WORKSPACE} && go build -mod vendor'"
  10. }
  11. stage("Build app image") {
  12. try {
  13. sh "docker build -t ${image_name} ."
  14. image = docker.image(image_name)
  15. } catch (Exception e) {
  16. error("Failed to build image")
  17. }
  18. }
  19. stage("Build deb package") {
  20. sh "./build/deb/build.sh"
  21. archiveArtifacts "gogocron-${tag}.deb"
  22. sh "mv *.deb /var/packages/"
  23. }
  24. stage("Push Image") {
  25. try {
  26. docker.withRegistry("https://${registry}", "registry") {
  27. image.push()
  28. }
  29. } catch(Exception e) {
  30. error("Failed to push image")
  31. } finally {
  32. sh "docker rmi ${registry}/${image_name} || true"
  33. }
  34. }
  35. }