kitchen_template.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .run-kitchen:
  2. image: ruby:2.6.3
  3. stage: test
  4. tags:
  5. - saltstack-kitchen
  6. only:
  7. refs:
  8. - schedules
  9. variables:
  10. FORCE_FULL: 'true'
  11. GOLDEN_IMAGES_CI_BRANCH: master
  12. NOX_ENABLE_FROM_FILENAMES: 'true'
  13. NOX_ENV_NAME: runtests-zeromq
  14. NOX_PASSTHROUGH_OPTS: '--ssh-tests'
  15. SALT_KITCHEN_DRIVER: kitchen-conf/driver.yml
  16. SALT_KITCHEN_PLATFORMS: kitchen-conf/nox-platforms.yml
  17. SALT_KITCHEN_VERIFIER: kitchen-conf/nox-verifier.yml
  18. TEST_SUITE: py3
  19. USE_SPOT_INSTANCES: 'true'
  20. script:
  21. - apt update
  22. - apt -y install moreutils rsync dos2unix
  23. - mkdir -p ~/.ssh
  24. - echo "${KITCHEN_SSHKEY}" | tr -d '\r' > ~/.ssh/kitchen.pem
  25. - chmod 700 ~/.ssh/
  26. - chmod 600 ~/.ssh/kitchen.pem
  27. - git clone https://gitlab.com/saltstack/open/cicd/kitchen-conf.git
  28. - bundle install --with ec2 windows --without docker vagrant
  29. - t=$(shuf -i 30-150 -n 1); echo "Sleeping $t seconds"; sleep $t
  30. - if [ "${USE_SPOT_INSTANCES}" == "true" ]; then cp -f kitchen-conf/spot.yml .kitchen.local.yml; fi
  31. - 'bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM || (bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM; rm .kitchen.local.yml; bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM)'
  32. - bundle exec kitchen diagnose $TEST_SUITE-$TEST_PLATFORM > kitchen-diagnose-info.txt
  33. - grep 'image_id:' kitchen-diagnose-info.txt
  34. - grep 'instance_type:' -A5 kitchen-diagnose-info.txt
  35. - rm -f kitchen-diagnose-info.txt
  36. - rm -f .kitchen.local.yml
  37. - ssh-agent /bin/bash -xc 'ssh-add ~/.ssh/kitchen.pem; bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
  38. - TEST_EXIT_CODE=0
  39. - 'DONT_DOWNLOAD_ARTEFACTS=1 bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM|ts -s || TEST_EXIT_CODE=$?'
  40. - 'ONLY_DOWNLOAD_ARTEFACTS=1 bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM|ts -s || true'
  41. - bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM
  42. - exit $TEST_EXIT_CODE
  43. artifacts:
  44. when: always
  45. paths:
  46. - artifacts/
  47. - .kitchen/
  48. expire_in: 6 months