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.

37 lines
1.2 KiB

  1. /**
  2. * Functionally tests pipelinelib by retrieving the patchset referenced by
  3. * `scm` and importing the library into the current context before making some
  4. * basic assertions about its methods behaviors. Note that the Jenkins job
  5. * that runs this Jenkinsfile must already define `scm` with the correct Zuul
  6. * parameters.
  7. */
  8. def plib = library(identifier: 'pipelinelib@FETCH_HEAD', retriever: legacySCM(scm)).org.wikimedia.integration
  9. def prunner = plib.PipelineRunner.new(this)
  10. def imageID
  11. node('blubber') {
  12. def blubberoidURL = "https://blubberoid.wikimedia.org/v1/"
  13. stage('Checkout SCM') {
  14. def patchset = plib.PatchSet.fromZuul(params)
  15. checkout(patchset.getSCM())
  16. }
  17. stage('Generate Dockerfile') {
  18. def blubber = plib.Blubber.new(this, '.pipeline/blubber.yaml', blubberoidURL)
  19. def dockerfile = blubber.generateDockerfile("test")
  20. echo 'Checking that Dockerfile was correctly generated'
  21. assert dockerfile.contains('LABEL blubber.variant="test"')
  22. }
  23. stage('Build test image') {
  24. imageID = prunner.build('test')
  25. echo 'Successfully built image "${imageID}" from "test" variant'
  26. }
  27. stage('Remove test image') {
  28. prunner.removeImage(imageID)
  29. echo 'Removed test image "${imageID}"'
  30. }
  31. }