diff --git a/.travis/fixtures/new_provider_sync.yml b/.ci/fixtures/new_provider_sync.yml similarity index 100% rename from .travis/fixtures/new_provider_sync.yml rename to .ci/fixtures/new_provider_sync.yml diff --git a/.travis/install_pdk.sh b/.ci/install_pdk.sh similarity index 100% rename from .travis/install_pdk.sh rename to .ci/install_pdk.sh diff --git a/.travis/test_script.sh b/.ci/test_script.sh similarity index 86% rename from .travis/test_script.sh rename to .ci/test_script.sh index f97fb61f5a16c259b9c4ecb7bdd3820d6b555b6e..0484889077544d0a2ec4da10b9e55aba8d3eca60 100755 --- a/.travis/test_script.sh +++ b/.ci/test_script.sh @@ -6,13 +6,13 @@ TEMPLATE_PR_DIR=$PWD # Make a branch from checked out HEAD so that we can target # it specifically with --template-ref -git checkout -b travis_commit +git checkout -b ci_commit # Test if new module from PR commit is still functional. -pdk new module new_module --template-url="file://$TEMPLATE_PR_DIR" --template-ref=travis_commit --skip-interview +pdk new module new_module --template-url="file://$TEMPLATE_PR_DIR" --template-ref=ci_commit --skip-interview pushd new_module grep template < metadata.json -cp "$TEMPLATE_PR_DIR/.travis/fixtures/new_provider_sync.yml" ./.sync.yml +cp "$TEMPLATE_PR_DIR/.ci/fixtures/new_provider_sync.yml" ./.sync.yml pdk update --force pdk new class new_module pdk new defined_type test_type @@ -33,7 +33,7 @@ pdk new module convert_from_release_tag --skip-interview pushd convert_from_release_tag grep template < metadata.json # Attempt to convert to PR commit from release tag -pdk convert --template-url="file://$TEMPLATE_PR_DIR" --template-ref=travis_commit --skip-interview --force +pdk convert --template-url="file://$TEMPLATE_PR_DIR" --template-ref=ci_commit --skip-interview --force cat convert_report.txt popd @@ -44,6 +44,6 @@ pdk new module convert_from_main --template-url="https://github.com/puppetlabs/p pushd convert_from_main grep template < metadata.json # Attempt to convert to PR commit from official/main -pdk convert --template-url="file://$TEMPLATE_PR_DIR" --template-ref=travis_commit --skip-interview --force +pdk convert --template-url="file://$TEMPLATE_PR_DIR" --template-ref=ci_commit --skip-interview --force cat convert_report.txt popd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..11ef9736a19fed4c32ce70c972769ed20da71f26 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: "ci" + +on: + pull_request: + branches: + - "main" + workflow_dispatch: + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: "actions/checkout@v3" + + - name: "Export variables" + run: | + export PDK=release + export PDK_FRONTEND=noninteractive + echo $BASH_VERSION + + - name: "Install PDK" + run: | + .ci/install_pdk.sh + + - name: "Run Tests" + run: | + .ci/test_script.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000000000000000000000000000000000..69e76b20975a05d2779e5cc2432139d7ff871993 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,27 @@ +name: "nightly" + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: "actions/checkout@v3" + + - name: "Export variables" + run: | + export PDK=release + export PDK_FRONTEND=noninteractive + echo $BASH_VERSION + + - name: "Install PDK" + run: | + .ci/install_pdk.sh + + - name: "Run Tests" + run: | + .ci/test_script.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2c30c673bcbea7a8ef1ce2e5965adeb2280d527b..0000000000000000000000000000000000000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -os: linux -dist: focal -language: generic -env: - - PDK=release PDK_FRONTEND=noninteractive - - PDK=nightly PDK_FRONTEND=noninteractive -before_install: - - ".travis/install_pdk.sh" -script: - - ".travis/test_script.sh" -branches: - only: - - main -notifications: - email: false - slack: - secure: RuLR/yl5FTfo7jDywF/7p6ba2zsP5SEB2jiPLQPwN7VFi8i3kJDsElHVMVQIVD1Ubuuo+LAdCKhugDpgeO/TRBjEfFDAV9IAKb1l61GR4YZv51AUMT4L6PDUeCStDbbuqI1goDIIeZmHo1o2rPmOMLuOkQLB1r84Lre3bNTb9CAQXIqFqQmlVG8FbkaUhArWKHaWE6MWol6WX5Sq3We1nXo12javfDEdATJGzbLSzuwLMt7/oCT40w2WeJBN2+VjFPuLr6lA6UCXuLKCcgUCHl6ibM658calCDP6I14C/NwGFjUMV13PbML6iHgpK2xLUtOEvDSVuBmrmCn/0WVbm332feEOucg+SmI2LF1c+kn/52lnQAwQ17+B0Nl0CXW4de5oR47rvhvhWDJ+9AYHkOokO9Misd7arCLTJ2Z0pvqAysDxVaVQPcIZAsTHeWQPDVe2SHOMVP5LX8nvD3GNQBv7447uO32cDo9QWalLLUFF77uAVNSRgwDSMhHN2NnPV02oCOti0XUIn3Bz2gaqAsoXK2VszwrVk6GR+9rqXmvn+wTg1RizIcq3HuuvXIeDaGt7HYvdYPSC/EWsI+1UKuBhGCN1aiVOgfxyGHSC2WfIefbV4HNDPCbBdZluKWlHFuvUfQzCip3cfj2uyMCpfqPfw0LzrgPELPHwymCGzHY= diff --git a/README.md b/README.md index d79da4b7497558b8464d099c59d0d747cfa91bd8..1a5a7d01dab50a998b6b658ee930adf99bf009d1 100644 --- a/README.md +++ b/README.md @@ -129,50 +129,6 @@ In this example the automated release prep workflow is triggered every Saturday | required | The default list of files or paths for PDK to ignore when building a module package. | paths | Defines additional files or paths for PDK to ignore when building a module package. -### .travis.yml - ->[Travis CI](https://travis-ci.org/) is a hosted continuous integration platform that is free for all open source projects hosted on Github. -We can trigger automated builds with every change to our code base in the main branch, other branches or even a pull request. -Travis uses a .travis.yml file in the root of your repository to learn about your project and how you want your builds to be executed. - -| Key | Description | -| :------------- |:--------------| -| os | Set to an array of operating systems to test. See the [TravisCI documentation](https://docs.travis-ci.com/user/multi-os/) for more details. | -| dist | If specified, it will set the dist attribute. See the [TravisCI documentation](https://docs.travis-ci.com/user/reference/overview/#virtualisation-environment-vs-operating-system) for more details. | -| simplecov |Set to `true` to enable collecting ruby code coverage.| -| ruby\_versions |Define the ruby versions on which you want your builds to be executed.| -| bundler\_args |Define any arguments you want to pass through to bundler. The default is `--without system_tests` which avoids installing unnecessary gems.| -| env |Allows you to add new travis job matrix entries based on the included environment variables, one per `env` entry; for example, for adding jobs with specific `PUPPET_GEM_VERSION` and/or `CHECK` values. See the [Travis Environment Variables](https://docs.travis-ci.com/user/environment-variables) documentation for details.| -| global\_env |Allows you to set global environment variables which will be defined for all travis jobs; for example, `PARALLEL_TEST_PROCESSORS` or `TIMEOUT`. See the [Travis Global Environment Variables](https://docs.travis-ci.com/user/environment-variables/#Global-Variables) documentation for details.| -|docker\_sets |Allows you to configure sets of docker to run your tests on. For example, if I wanted to run on a docker instance of Ubuntu I would add `set:docker/ubuntu-14.04` to my docker\_sets attribute. The docker_sets is a hash that supports the 'set', 'testmode', and 'collection' keys. | -|docker\_sets['set']| This should reference the docker nodeset that you wish to run. | -|docker\_sets['testmode']| This configures the `BEAKER_TESTMODE` to use when testing the docker instance. The two options are `apply` and `agent` if omitted `apply` is used by default. | -|docker_sets['collection]| This configures the `BEAKER_PUPPET_COLLECTION` to use when testing the docker instance. The default is `puppet6`. -|docker_defaults |Defines what values are used as default when using the `docker_sets` definition. Includes ruby version, sudo being enabled, the distro, the services, the env variables and the script to execute.| -|stages |Allows the specification of order and conditions for travis-ci build stages. See [Specifying Stage Order and Conditions](https://docs.travis-ci.com/user/build-stages/#specifying-stage-order-and-conditions).| -|before_install_pre |Add install steps to the start of `before_install`. | -|before_install_post |Add install steps to the end of `before_install`. | -|includes |Ensures that the .travis file includes the following checks by default: Rubocop, Puppet Lint, Metadata Lint.| -|remove_includes |Allows you to remove includes set in `config_defaults.yml`.| -|branches |Allows you to specify the only branches that travis will run builds on. The default branches are `main` and `/^v\d/`. | -|branches_except |Allows you to specify branches that travis will not build on.| -|remove_branches |Allows you to remove default branches set in config_defaults.yml.| -|notifications |Allows you to specify the notifications configuration in the .travis.yml file.| -|remove_notifications |Allows you to remove default branches set in config_defaults.yml.| -|deploy_to_forge|Allows you to change the automatic deployment of modules to the forge. Sub keys are `enabled` and `tag_regex` which are detailed below| -|deploy_to_forge\\**enabled**|Allows you to enable or disable automatic forge deployments. Default is true| -|deploy_to_forge\\**tag_regex**|Allows you to use a regular expression to define which tags will trigger a deployment. The default is `^v\d`| -|before_deploy|An array which can allow a user to specify the commands to run before kicking off a deployment. See [https://docs.travis-ci.com/user/deployment/releases/#setting-the-tag-at-deployment-time].| -|use_litmus| By default it is disabled. Set to `true` to configure travis to use Litmus testing tool for acceptance testing jobs with default values.| -|litmus|Allows you to update default config values. Its sub keys are `provision_list`, `puppet_collection`, `rvm`, `install_wget` which are detailed below.| -|litmus\\**puppet_collection**|Allows you to specify the puppet version under test. Default test are ran on _puppet 5_ and _puppet 6_.| -|litmus\\**provision_list**|Allows you to specify the platforms list under test. Default test are ran on platformes defined in provision.yaml file under _travis_deb_ and _travis_el_| -|litmus\\**rvm**|Allows you to specify the ruby version under test. Default it is set to _2.5.7_| -|litmus\\**install_wget**|Allows you to enable automatic installation of wget on the platform under test. We need this when installing agent on travis_deb platforms. Default it is disabled. | -|litmus\\**complex\\collection**|Allows you to specify multiple collections of `puppet_collection` and `provision_list`, allowing you to set certain OS to only run on certain Puppet versions. | -|user|This string needs to be set to the Puppet Forge user name. To enable deployment the secure key also needs to be set.| -|secure|This string needs to be set to the encrypted password to enable deployment. See [https://docs.travis-ci.com/user/encryption-keys/#usage](https://docs.travis-ci.com/user/encryption-keys/#usage) for instructions on how to encrypt your password.| - ### .yardopts >[YARD](https://yardoc.org/) is a documentation generation tool for the Ruby programming language. It enables the user to generate consistent, usable documentation that can be exported to a number of formats very easily, and also supports extending for custom Ruby constructs such as custom class level definitions. diff --git a/config_defaults.yml b/config_defaults.yml index 2a7dbab4bf9590718846f11f6f08ef20959d9367..e358459b5d74a01c41d120a9aa07d51977262717 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -61,52 +61,11 @@ common: - '/rakelib/' - '/.rspec' - '/.rubocop.yml' - - '/.travis.yml' - '/.yardopts' - '/spec/' - '/.vscode/' - '/.sync.yml' - '/.devcontainer/' -.travis.yml: - stages: - - static - - spec - - acceptance - ruby_versions: - - 2.5.7 - bundler_args: --without system_tests - docker_sets: - docker_defaults: - # values will replace @@SET@@ with the docker_sets' value - rvm: 2.5.7 - sudo: required - dist: trusty - services: docker - bundler_args: --with system_tests - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=@@COLLECTION@@ BEAKER_set=@@SET@@ BEAKER_TESTMODE=@@TESTMODE@@ - script: bundle exec rake beaker - stage: acceptance - includes: - - env: CHECK="validate lint check rubocop" - stage: static - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - branches: - - main - - /^v\d/ - use_litmus: false - use_litmus_complex: false - litmus: - provision_list: [travis_deb, travis_el] - puppet_collection: [puppet6] - rvm: '2.5.7' - install_wget: "no" - notifications: - email: false - deploy_to_forge: - enabled: true - tag_regex: "^v\\d" .yardopts: markup: markdown appveyor.yml: diff --git a/moduleroot/.travis.yml.erb b/moduleroot/.travis.yml.erb deleted file mode 100644 index 281df3cd1dac8a33dc59f6fd60b0167262c36a5c..0000000000000000000000000000000000000000 --- a/moduleroot/.travis.yml.erb +++ /dev/null @@ -1,201 +0,0 @@ -<% - if @configs['deploy_to_forge']['enabled'] - # If Deploy To Forge is enabled.. - # - Inject the deployment stage using the tag regex - @configs['stages'] << { - 'name' => 'deploy', - 'if' => "tag =~ #{@configs['deploy_to_forge']['tag_regex']}" - } - # - Inject the deployment task into the includes - @configs['includes'] << { - 'env' => 'DEPLOY_TO_FORGE=yes', - 'stage' => 'deploy' - } - end --%> ---- -<% if @configs['os'] -%> -os: -<% @configs['os'].each do |os| -%> - - <%= os %> -<% end -%> -<% else -%> -os: linux -<% end -%> -<% if @configs['dist'] -%> -dist: <%= @configs['dist'] %> -<% else -%> -dist: xenial -<% end -%> -language: ruby -cache: bundler -<% if !@configs.nil? && @configs.has_key?('addons') -%> -addons: -<% @configs['addons'].each do |addon, params| -%> - <%= addon %>: -<% params.each do |param_name, param_value| -%> - <%= param_name %>:<%= param_value.is_a?(String) ? " #{param_value}" : "" %> -<% if param_value.is_a?(Array) -%> -<% param_value.each do |r| -%> - - <%= r %> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -before_install: -<% if @configs['before_install_pre'] -%> -<% @configs['before_install_pre'].each do |bip| -%> - - <%= bip %> -<% end -%> -<% end -%> - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -<% if @configs['before_install_post'] -%> -<% @configs['before_install_post'].each do |bip| -%> - - <%= bip %> -<% end -%> -<% end -%> -script: -<% if @configs['simplecov'] -%> - - 'SIMPLECOV=yes bundle exec rake $CHECK' -<% else -%> - - 'bundle exec rake $CHECK' -<% end -%> -bundler_args: <%= @configs['bundler_args'] %> -rvm: -<% @configs['ruby_versions'].each do |ruby_version| -%> - - <%= ruby_version %> -<% end -%> -<% if @configs.has_key?('env') || @configs.has_key?('global_env') -%> -env: -<% if @configs.has_key?('global_env') -%> - global: -<% @configs['global_env'].each do |env| -%> - - <%= env %> -<% end -%> -<% end -%> -<% if @configs.has_key?('env') -%> - jobs: -<% @configs['env'].each do |env| -%> - - <%= env %> -<% end -%> -<% end -%> -<% end -%> -<% if @configs.has_key?('stages') -%> -stages: -<% @configs['stages'].each do |stage| -%> -<% if stage.is_a?(String) -%> - - <%= stage %> -<% elsif stage.is_a?(Hash) -%> - - -<% stage.keys.sort.each do |key| -%> - <%= key %>: <%= stage[key] %> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -jobs: - fast_finish: true - include: -<% (@configs['docker_sets'] || []).each do |set| -%> -<% job = @configs['docker_defaults'].merge(set['options'] || {}) -%> - - -<% job.keys.sort.each do |key| -%> - <%= key %>: <%= job[key].gsub(/@@SET@@/, set['set']).gsub(/@@COLLECTION@@/, set.fetch('collection', 'puppet6')).gsub(/@@TESTMODE@@/, set.fetch('testmode', 'apply')) %> -<% end -%> -<% end -%> -<% if @configs['use_litmus'] - configs = if @configs['litmus']['complex'] - (@configs['litmus']['complex'] + [{'collection' =>@configs['litmus'] }]) - else - [{'collection' =>@configs['litmus'] }] - end - configs.each do |config| - config['collection']['puppet_collection'].each do |puppet_version| - config['collection']['provision_list'].each do |platform|-%> - - before_script: - - "bundle exec rake 'litmus:provision_list[<%=platform%>]'" -<% if @configs['litmus']['install_wget']-%> - - "bundle exec bolt command run 'apt-get install wget -y || yum install wget -y' --inventoryfile inventory.yaml --targets='localhost*'" -<% end-%> - - "bundle exec rake 'litmus:install_agent[<%=puppet_version%>]'" - - "bundle exec rake litmus:install_module" -<% if config['collection']['dist']-%> - dist: <%=config['collection']['dist']%> -<% end -%> - env: - PLATFORMS: <%=platform%>_<%=puppet_version%> - BUNDLE_WITH: system_tests - rvm: <%=@configs['litmus']['rvm']%> - script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] - services: docker - stage: acceptance -<% end -%> -<% end -%> -<% end -%> -<% end -%> -<% (@configs['includes'] - (@configs['remove_includes'] || []) + (@configs['extras'] || [])).each do |job| -%> - - -<% job.keys.sort.each do |key| -%> - <%= key %>: <%= job[key] %> -<% end -%> -<% end -%> -<% if @configs['allow_failures'] -%> - allow_failures: -<% @configs['allow_failures'].each do |job| -%> - - -<% job.keys.sort.each do |key| -%> - <%= key %>: <%= job[key] %> -<% end -%> -<% end -%> -<% end -%> -branches: -<% if ((@configs['branches'] || []) - (@configs['remove_branches'] || [])).any? -%> - only: -<% (@configs['branches'] - (@configs['remove_branches'] || [])).each do |branch| -%> - - <%= branch %> -<% end -%> -<% end -%> -<% if @configs['branches_except'] -%> - except: -<% @configs['branches_except'].each do |branch| -%> - - <%= branch %> -<% end -%> -<% end -%> -notifications: -<% notifications_arr = (@configs['notifications'].to_a - @configs['remove_notifications'].to_a) -%> -<% unless notifications_arr.empty? -%> -<% notifications = Hash[*notifications_arr.flatten] -%> -<% notifications.keys.sort.each do |key| -%> -<% if notifications[key].is_a?(Array) or notifications[key].is_a?(Hash) -%> - <%= key %>: - <%= notifications[key].to_yaml.sub(/---\R/, '').gsub(/\R/, "\n ").strip %> -<% else -%> - <%= key %>: <%= notifications[key] %> -<% end -%> -<% end -%> -<% end -%> -<% unless @configs['user'].nil? || @configs['secure'].nil? -%> -<% if @configs['before_deploy'] -%> -before_deploy: -<% @configs['before_deploy'].each do |b_deploy| -%> - - <%= b_deploy %> -<% end -%> -<% end -%> -deploy: - provider: puppetforge - username: <%= @configs['user'] %> - password: - secure: "<%= @configs['secure'] %>" - on: - tags: true - all_branches: true - condition: "$DEPLOY_TO_FORGE = yes" -<% end -%>