Jenkinsfile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. node {
  2. def app
  3. /*stage('Initialize'){
  4. def dockerHome = tool 'myDocker'
  5. env.PATH = "${dockerHome}/bin:${env.PATH}"
  6. }*/
  7. stage('Clone repository') {
  8. /* Let's make sure we have the repository cloned to our workspace */
  9. checkout scm
  10. }
  11. stage('Build image') {
  12. /* This builds the actual image; synonymous to
  13. * docker build on the command line */
  14. app = docker.build("hochzeit:latest")
  15. }
  16. stage('Test image') {
  17. /* Ideally, we would run a test framework against our image.
  18. * For this example, we're using a Volkswagen-type approach ;-) */
  19. app.inside {
  20. sh 'echo "Tests passed"'
  21. }
  22. }
  23. stage('Snyk Test') {
  24. /* This stage runs Snyk to test the image for vulnerabilities.
  25. * Make sure you have the Snyk plugin installed in Jenkins. */
  26. snykSecurity test: 'hochzeit:latest', failOnError: true, failOnIssues: true, snykInstallation: 'snyk@latest', snykTokenId: "SNYK API"
  27. }
  28. stage('Push image') {
  29. /* Finally, we'll push the image with two tags:
  30. * First, the incremental build number from Jenkins
  31. * Second, the 'latest' tag.
  32. * Pushing multiple tags is cheap, as all the layers are reused. */
  33. docker.withRegistry('https://container.kornblum.dev', 'container-kornblum-dev') {
  34. app.push("${env.BUILD_NUMBER}")
  35. app.push("latest")
  36. }
  37. }
  38. stage('webhook deployment portainer') {
  39. sh "curl -X POST -k https://192.168.188.23:9443/api/stacks/webhooks/8da9930d-966f-4696-8087-302e2ce139ba"
  40. }
  41. }