-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gitlab-ci beaker #104
Comments
The current code for determining what stage something should be in is based on the name of the check and I changed that to be more descriptive and it made it so there is no differentiation of stages any more. https://github.com/puppetlabs/pdk-templates/blob/master/moduleroot/.gitlab-ci.yml.erb#L46-L47 The stage should be provided via config IMO but given the way it's written there is no way to do that. I suspect the easiest way to allow this is to have the user provide a hash with the key being the check to perform and stage, variables, image, etc... would be in a hash as the value. Something like:
|
Ah so you broke it. LOL |
As to @npwalker's comment about the different ways to configure gitlab-ci.yml, there are hundreds of ways a user can configure |
Here's an example of a working gitlab ci config in .gitlab-ci.yml:
override: true
custom:
custom_stages:
- syntax
- unit
- acceptance
- deploy
bundler_args: '--without system_tests'
ruby_versions:
2.4.4:
checks:
- syntax
- lint
- rubocop
- metadata_lint
- spec
puppet_version: '~> 5.0'
tags:
- 'puppet-unit'
custom_jobs:
acceptance:
stage: acceptance
variables:
BEAKER_debug: 'true'
BEAKER_set: 'ec2'
BEAKER_PUPPET_COLLECTION: 'puppet5'
PLATFORM_type: 'appliance'
before_script:
- rvm use 2.4.4
- ruby -v
- bundle update
script:
- bundle exec rake acceptance
when: on_success
tags:
- puppet-acceptance
except:
- tags
- master
pages:
stage: deploy
image: ruby:2.4
before_script:
- bundle install
script:
- echo "Deploying Documentation"
- bundle exec rake strings:generate
artifacts:
paths:
- public
only:
- master
tags:
- puppet-acceptance
release:
stage: deploy
before_script:
- bundle update
script:
- 'GIT_SERVER=$(echo $CI_REPOSITORY_URL | cut -d"@" -f2 | cut -d"/" -f1)'
- 'git remote set-url origin git@$GIT_SERVER:$CI_PROJECT_PATH.git'
- 'bundle exec rake module_release'
only:
- master
when: on_success
tags:
- puppet-acceptance
build:
stage: deploy
before_script:
- bundle update
script:
- "\"export VERSION=$(grep \\\"version\\\": metadata.json | awk '{ print $2 }' | sed 's/,//' | sed 's/\\\"//g')\""
- bundle exec rake build
artifacts:
paths:
- pkg/internal-$CI_PROJECT_NAME-*.tar.gz
only:
- master
when: on_success
tags:
- puppet-acceptance It generates: ---
stages:
- syntax
- unit
- acceptance
- deploy
before_script:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem update bundler
- gem --version
- bundle -v
- bundle install --without system_tests
syntax-2.4.4:
stage: syntax
image: ruby:2.4.4
script:
- bundle exec rake syntax
variables:
PUPPET_GEM_VERSION: '~> 5.0'
tags:
- puppet-unit
lint-2.4.4:
stage: syntax
image: ruby:2.4.4
script:
- bundle exec rake lint
variables:
PUPPET_GEM_VERSION: '~> 5.0'
tags:
- puppet-unit
rubocop-2.4.4:
stage: syntax
image: ruby:2.4.4
script:
- bundle exec rake rubocop
variables:
PUPPET_GEM_VERSION: '~> 5.0'
tags:
- puppet-unit
metadata_lint-2.4.4:
stage: syntax
image: ruby:2.4.4
script:
- bundle exec rake metadata_lint
variables:
PUPPET_GEM_VERSION: '~> 5.0'
tags:
- puppet-unit
spec-2.4.4:
stage: unit
image: ruby:2.4.4
script:
- bundle exec rake spec
variables:
PUPPET_GEM_VERSION: '~> 5.0'
tags:
- puppet-unit
acceptance:
stage: 'acceptance'
variables:
BEAKER_debug: 'true'
BEAKER_set: 'ec2'
BEAKER_PUPPET_COLLECTION: 'puppet5'
PLATFORM_type: 'appliance'
before_script:
- rvm use 2.4.4
- ruby -v
- bundle update
script:
- bundle exec rake acceptance
when: 'on_success'
tags:
- puppet-acceptance
except:
- tags
- master
pages:
stage: 'deploy'
image: 'ruby:2.4'
before_script:
- bundle install
script:
- echo "Deploying Documentation"
- bundle exec rake strings:generate
artifacts:
paths:
- public
only:
- master
tags:
- puppet-acceptance
release:
stage: 'deploy'
before_script:
- bundle update
script:
- GIT_SERVER=$(echo $CI_REPOSITORY_URL | cut -d"@" -f2 | cut -d"/" -f1)
- git remote set-url origin git@$GIT_SERVER:$CI_PROJECT_PATH.git
- bundle exec rake module_release
only:
- master
when: 'on_success'
tags:
- puppet-acceptance
build:
stage: 'deploy'
before_script:
- bundle update
script:
- "export VERSION=$(grep \"version\": metadata.json | awk '{ print $2 }' | sed 's/,//' | sed 's/\"//g')"
- bundle exec rake build
artifacts:
paths:
- pkg/ntts-$CI_PROJECT_NAME-*.tar.gz
only:
- master
when: 'on_success'
tags:
- puppet-acceptance NOTE - I am not using the |
@cdenneen The override option should be removing ALL default jobs and stages. I'll look at that when I have time. For the caching. It's, in my opinion, better to run more jobs in parallel than one at a time. Maybe the option here is to have the |
Closing out old beaker stuff. |
@dhollinger @npwalker
Few things:
acceptance
anymore... needs to bebeaker
bundle install
for acceptance job needs to bebundle install --with system_tests
otherwise the bundle install does nothing but uses whats in cache and beaker never gets installed..sync
orconfig_defaults
and if set prepend with the registry_host/converts to
BEAKER_debug: true
and then fails ci lint as it needs to beBEAKER_debug: 'true'
gem install nokogiri
even cached will recompile during acceptance job I believe because that needs to be installed with--prune
flag or something if I recall reading that somewhere.bundle install --with development
and creates the cache (seems like waste for container so still recommend moving the linting to first stage)? It's possibly the lint was supposed to be first then at that point the ERB is just a typo and the spec ones should beunit
stagessyntax
andunit
from the stages but not the jobs. I believe if there are jobs calling a stage that is no longer defined this will break ci linting. So maybe if override the jobs get removed as well as the stages?The text was updated successfully, but these errors were encountered: