Jenkinsfile 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. pipeline {
  2. agent any
  3. def app
  4. stage('Clone repository') {
  5. /* Let's make sure we have the repository cloned to our workspace */
  6. checkout scm
  7. }
  8. stage('Build image') {
  9. /* This builds the actual image; synonymous to
  10. * docker build on the command line */
  11. app = docker.build("hochzeit:latest")
  12. }
  13. stage('Test image') {
  14. /* Ideally, we would run a test framework against our image.
  15. * For this example, we're using a Volkswagen-type approach ;-) */
  16. app.inside {
  17. sh 'echo "Tests passed"'
  18. }
  19. }
  20. stage('Push image') {
  21. /* Finally, we'll push the image with two tags:
  22. * First, the incremental build number from Jenkins
  23. * Second, the 'latest' tag.
  24. * Pushing multiple tags is cheap, as all the layers are reused. */
  25. docker.withRegistry('https://container.kornbum.dev', 'container-kornblum-dev') {
  26. app.push("${env.BUILD_NUMBER}")
  27. app.push("latest")
  28. }
  29. }
  30. }