Skip to content

Instantly share code, notes, and snippets.

@heliocentric
Created October 13, 2017 18:31
Show Gist options
  • Select an option

  • Save heliocentric/496299e42f4bb990d691b1c4b5b17fe3 to your computer and use it in GitHub Desktop.

Select an option

Save heliocentric/496299e42f4bb990d691b1c4b5b17fe3 to your computer and use it in GitHub Desktop.

Revisions

  1. heliocentric created this gist Oct 13, 2017.
    150 changes: 150 additions & 0 deletions .gitlab-ci.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,150 @@
    ---
    .cache_bundler: &cache_bundler
    cache:
    untracked: true
    key: "$CI_BUILD_REF_NAME"
    paths:
    - '.vendor'
    - 'vendor'

    .setup_bundler_env: &setup_bundler_env
    before_script:
    # For FIPS compatibility
    - gem install bundler -v '~> 1.14.0'
    - rm -f Gemfile.lock
    - bundle install --no-binstubs --path .vendor "${FLAGS[@]}"

    .syntax_checks: &syntax_checks
    script:
    - bundle exec rake syntax
    - bundle exec rake check:dot_underscore
    - bundle exec rake check:test_file
    - bundle exec rake pkg:check_version
    - bundle exec rake compare_latest_tag

    .spec_tests: &spec_tests
    script:
    - bundle exec rake spec

    stages:
    - syntax
    - unit
    - acceptance
    - deploy

    puppet-syntax:
    stage: syntax
    tags:
    - docker
    image: ruby:2.4
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *syntax_checks

    # Puppet 4
    unit-test-ruby-2.1.9:
    stage: unit
    tags:
    - docker
    image: ruby:2.1.9
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *spec_tests

    # Puppet 5
    unit-test-ruby-2.4.1:
    stage: unit
    tags:
    - docker
    image: ruby:2.4
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *spec_tests

    # For PE LTS Support
    # See: https://puppet.com/misc/puppet-enterprise-lifecycle
    puppet4.7-syntax:
    stage: syntax
    tags:
    - docker
    image: ruby:2.1
    variables:
    PUPPET_VERSION: '4.7'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *syntax_checks

    unit-test-puppet4.7-ruby-2.1:
    stage: unit
    tags:
    - docker
    image: ruby:2.1
    variables:
    PUPPET_VERSION: '4.7'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *spec_tests

    puppet4.7-syntax:
    stage: syntax
    tags:
    - docker
    image: ruby:2.1
    variables:
    PUPPET_VERSION: '4.7'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *syntax_checks

    unit-test-puppet4.7-ruby-2.1:
    stage: unit
    tags:
    - docker
    image: ruby:2.1
    variables:
    PUPPET_VERSION: '4.7'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *spec_tests

    puppet5-syntax:
    stage: syntax
    tags:
    - docker
    image: ruby:2.4
    variables:
    PUPPET_VERSION: '5.0'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *syntax_checks

    unit-test-puppet5-ruby-2.4:
    stage: unit
    tags:
    - docker
    image: ruby:2.4
    variables:
    PUPPET_VERSION: '5.0'
    <<: *cache_bundler
    <<: *setup_bundler_env
    <<: *spec_tests

    compliance-test:
    stage: acceptance
    tags:
    - beaker
    <<: *cache_bundler
    <<: *setup_bundler_env
    script:
    - bundle exec rake beaker:suites

    code-manager-deploy:
    stage: deploy
    tags:
    - docker
    image: ruby:2.4
    <<: *cache_bundler
    <<: *setup_bundler_env
    script:
    # Stub just to show the preferred pipeline
    - 'true'