From: Javier BĂ©rtoli Date: Wed, 14 Oct 2020 20:29:56 +0000 (-0300) Subject: Merge pull request #4 from netmanagers/refactor-config-add-service X-Git-Url: https://git.arvados.org/arvados-formula.git/commitdiff_plain/0e92df5527997b13464edfd4d8041f1ce8a41cbb?hp=4bf9501a14f86845865244ee3ffb03a34707d36c Merge pull request #4 from netmanagers/refactor-config-add-service Upgrade formula for Arvados version 2.1.0 --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0efdb51 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +default_stages: [commit] +repos: + - repo: https://github.com/dafyddj/commitlint-pre-commit-hook + rev: v2.3.0 + hooks: + - id: commitlint + name: Check commit message using commitlint + description: Lint commit message against @commitlint/config-conventional rules + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + - id: commitlint-travis + stages: [manual] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + always_run: true + - repo: https://github.com/adithyabsk/mirrors-rubocop + rev: v0.91.0 + hooks: + - id: rubocop + name: Check Ruby files with rubocop + args: [--debug] + always_run: true + pass_filenames: false + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 2.1.3 + hooks: + - id: shellcheck + name: Check shell scripts with shellcheck + files: ^.*\.(sh|bash|ksh)$ + types: [] + args: [] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.23.0 + hooks: + - id: yamllint + name: Check YAML syntax with yamllint + args: [--strict, '.'] + always_run: true + pass_filenames: false + - repo: https://github.com/warpnet/salt-lint + rev: v0.3.0 + hooks: + - id: salt-lint + name: Check Salt files using salt-lint + files: ^.*\.(sls|jinja|j2|tmpl|tst)$ + - repo: https://github.com/myint/rstcheck + rev: 3f929574 + hooks: + - id: rstcheck + name: Check reST files using rstcheck + exclude: 'docs/CHANGELOG.rst' + args: [--report=warning] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 0000000..05856dc --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,3 @@ +[rstcheck] +report=error +ignore_language=rst diff --git a/.travis.yml b/.travis.yml index 3ced9e0..83b41c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,20 @@ jobs: - pre-commit run --all-files --verbose - pre-commit run --hook-stage manual --verbose commitlint-travis + # Run `pre-commit` linters in a single job + - language: 'python' + env: 'Lint_pre-commit' + name: 'Lint: pre-commit' + before_install: 'skip' + cache: + directories: + - $HOME/.cache/pre-commit + script: + # Install and run `pre-commit` + - pip install pre-commit==2.7.1 + - pre-commit run --all-files --color always --verbose + - pre-commit run --color always --hook-stage manual --verbose commitlint-travis + ## Define the rest of the matrix based on Kitchen testing # Make sure the instances listed below match up with # the `platforms` defined in `kitchen.yml` diff --git a/CODEOWNERS b/CODEOWNERS index 951541c..e9b234b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -10,6 +10,7 @@ # SECTION: Owner(s) for files/directories related to `semantic-release` # FILE PATTERN OWNER(S) /.github/workflows/ @saltstack-formulas/ssf +/bin/install-hooks @saltstack-formulas/ssf /bin/kitchen @saltstack-formulas/ssf /docs/AUTHORS.rst @saltstack-formulas/ssf /docs/CHANGELOG.rst @saltstack-formulas/ssf @@ -20,6 +21,8 @@ /test/integration/**/README.md @saltstack-formulas/ssf /.gitignore @saltstack-formulas/ssf /.cirrus.yml @saltstack-formulas/ssf +/.pre-commit-config.yaml @saltstack-formulas/ssf +/.rstcheck.cfg @saltstack-formulas/ssf /.rubocop.yml @saltstack-formulas/ssf /.salt-lint @saltstack-formulas/ssf /.travis.yml @saltstack-formulas/ssf diff --git a/Gemfile b/Gemfile index 5a232b6..f18b9e9 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,6 @@ source 'https://rubygems.org' -gem 'kitchen-docker', '>= 2.9' -gem 'kitchen-inspec', '>= 1.1' -gem 'kitchen-salt', '>= 0.6.0' +gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker', ref: '41e80fe' +gem 'kitchen-inspec', '>= 2.2.1' +gem 'kitchen-salt', '>= 0.6.3' diff --git a/Gemfile.lock b/Gemfile.lock index 7f95434..5addeb7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,15 @@ +GIT + remote: https://github.com/test-kitchen/kitchen-docker.git + revision: 41e80fed3a7cc86323e19c16a5a340cebf7e5848 + ref: 41e80fe + specs: + kitchen-docker (2.10.0) + test-kitchen (>= 1.0.0) + GEM remote: https://rubygems.org/ specs: - activesupport (5.2.4.3) + activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -9,186 +17,189 @@ GEM addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) aws-eventstream (1.1.0) - aws-partitions (1.332.0) - aws-sdk-apigateway (1.46.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-partitions (1.380.0) + aws-sdk-apigateway (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-apigatewayv2 (1.22.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-apigatewayv2 (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-athena (1.28.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-athena (1.33.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) aws-sdk-autoscaling (1.22.0) aws-sdk-core (~> 3, >= 3.52.1) aws-sigv4 (~> 1.1) - aws-sdk-budgets (1.31.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-budgets (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudformation (1.38.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudformation (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudfront (1.31.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudfront (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudhsm (1.23.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudhsm (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudhsmv2 (1.24.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudhsmv2 (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudtrail (1.24.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudtrail (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudwatch (1.39.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudwatch (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudwatchlogs (1.32.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudwatchlogs (1.38.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codecommit (1.34.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codecommit (1.40.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codedeploy (1.32.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codedeploy (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codepipeline (1.32.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codepipeline (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-configservice (1.46.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-configservice (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.100.0) + aws-sdk-core (3.109.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-costandusagereportservice (1.22.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-costandusagereportservice (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-dynamodb (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-dynamodb (1.49.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ec2 (1.198.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ec2 (1.168.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ecr (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ecr (1.31.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ecs (1.70.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ecs (1.65.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-efs (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-efs (1.30.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-eks (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-eks (1.38.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticache (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticache (1.38.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticbeanstalk (1.38.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticbeanstalk (1.32.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticloadbalancing (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticloadbalancing (1.23.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticloadbalancingv2 (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticloadbalancingv2 (1.45.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticsearchservice (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticsearchservice (1.37.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-firehose (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-firehose (1.29.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-guardduty (1.42.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-iam (1.40.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-iam (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kafka (1.22.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kafka (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kinesis (1.24.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kinesis (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kms (1.34.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kms (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-lambda (1.44.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-lambda (1.51.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) aws-sdk-organizations (1.17.0) aws-sdk-core (~> 3, >= 3.39.0) aws-sigv4 (~> 1.0) - aws-sdk-rds (1.87.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-rds (1.102.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-redshift (1.44.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-redshift (1.50.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53 (1.38.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53 (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53domains (1.23.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53domains (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53resolver (1.15.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53resolver (1.21.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.69.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-s3 (1.83.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sdk-securityhub (1.27.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-securityhub (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ses (1.31.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ses (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sms (1.21.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sms (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sns (1.25.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sns (1.32.1) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.27.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sqs (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ssm (1.82.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ssm (1.93.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.0) + aws-sigv4 (1.2.2) aws-eventstream (~> 1, >= 1.0.2) azure_graph_rbac (0.17.2) ms_rest_azure (~> 0.12.0) azure_mgmt_key_vault (0.17.6) ms_rest_azure (~> 0.12.0) - azure_mgmt_resources (0.17.9) + azure_mgmt_resources (0.18.0) ms_rest_azure (~> 0.12.0) azure_mgmt_security (0.18.2) ms_rest_azure (~> 0.12.0) - azure_mgmt_storage (0.21.1) + azure_mgmt_storage (0.22.0) ms_rest_azure (~> 0.12.0) bcrypt_pbkdf (1.0.1) builder (3.2.4) - chef-config (16.2.44) + chef-config (16.5.77) addressable - chef-utils (= 16.2.44) + chef-utils (= 16.5.77) fuzzyurl mixlib-config (>= 2.2.12, < 4.0) mixlib-shellout (>= 2.0, < 4.0) tomlrb (~> 1.2) - chef-telemetry (1.0.8) + chef-telemetry (1.0.14) chef-config concurrent-ruby (~> 1.0) ffi-yajl (~> 2.2) - chef-utils (16.2.44) + chef-utils (16.5.77) coderay (1.1.3) - concurrent-ruby (1.1.6) - declarative (0.0.10) + concurrent-ruby (1.1.7) + declarative (0.0.20) declarative-option (0.1.0) - diff-lcs (1.3) - docker-api (1.34.2) + diff-lcs (1.4.4) + docker-api (2.0.0) excon (>= 0.47.0) multi_json domain_name (0.5.20190701) @@ -196,21 +207,20 @@ GEM ecma-re-validator (0.2.1) regexp_parser (~> 1.2) ed25519 (1.2.4) - equatable (0.6.1) erubi (1.9.0) - excon (0.75.0) - faraday (0.17.3) + excon (0.76.0) + faraday (1.0.1) multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) http-cookie (~> 1.0.0) - faraday_middleware (0.12.2) - faraday (>= 0.7.4, < 1.0) + faraday_middleware (1.0.0) + faraday (~> 1.0) ffi (1.13.1) - ffi-yajl (2.3.3) + ffi-yajl (2.3.4) libyajl2 (~> 1.2) fuzzyurl (0.9.0) - google-api-client (0.34.1) + google-api-client (0.44.0) addressable (~> 2.5, >= 2.5.1) googleauth (~> 0.9) httpclient (>= 2.8.1, < 3.0) @@ -218,41 +228,39 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.0) signet (~> 0.12) - googleauth (0.10.0) - faraday (~> 0.12) + googleauth (0.13.0) + faraday (>= 0.17.3, < 2.0) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.12) + signet (~> 0.14) gssapi (1.3.0) ffi (>= 1.0.1) gyoku (1.3.1) builder (>= 2.1.2) hana (1.3.6) hashie (3.6.0) - htmlentities (4.3.4) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.8.3) + i18n (1.8.5) concurrent-ruby (~> 1.0) inifile (3.0.0) - inspec (4.20.10) - faraday_middleware (~> 0.12.2) - inspec-core (= 4.20.10) + inspec (4.23.11) + faraday_middleware (>= 0.12.2, < 1.1) + inspec-core (= 4.23.11) train (~> 3.0) train-aws (~> 0.1) train-habitat (~> 0.1) train-winrm (~> 0.2) - inspec-core (4.20.10) + inspec-core (4.23.11) addressable (~> 2.4) chef-telemetry (~> 1.0) - faraday (>= 0.9.0) + faraday (>= 0.9.0, < 1.1) hashie (~> 3.4) - htmlentities (~> 4.3) - json_schemer (~> 0.2.1) - license-acceptance (>= 0.2.13, < 2.0) + json_schemer (>= 0.2.1, < 0.2.12) + license-acceptance (>= 0.2.13, < 3.0) method_source (>= 0.8, < 2.0) mixlib-log (~> 3.0) multipart-post (~> 2.0) @@ -264,51 +272,49 @@ GEM rubyzip (~> 1.2, >= 1.2.2) semverse (~> 3.0) sslshake (~> 1.2) - term-ansicolor (~> 1.7) thor (>= 0.20, < 2.0) tomlrb (~> 1.2.0) train-core (~> 3.0) tty-prompt (~> 0.17) tty-table (~> 0.10) jmespath (1.4.0) - json (2.3.0) + json (2.3.1) json_schemer (0.2.11) ecma-re-validator (~> 0.2) hana (~> 1.3) regexp_parser (~> 1.5) uri_template (~> 0.7) - jwt (2.2.1) - kitchen-docker (2.10.0) - test-kitchen (>= 1.0.0) - kitchen-inspec (2.0.0) + jwt (2.2.2) + kitchen-inspec (2.2.1) hashie (~> 3.4) inspec (>= 2.2.64, < 5.0) - test-kitchen (>= 1.6, < 3) + test-kitchen (>= 2.7, < 3) kitchen-salt (0.6.3) hashie (>= 3.5) test-kitchen (>= 1.4) libyajl2 (1.2.0) - license-acceptance (1.0.19) + license-acceptance (2.1.2) pastel (~> 0.7) tomlrb (~> 1.2) - tty-box (~> 0.3) - tty-prompt (~> 0.18) + tty-box (~> 0.6) + tty-prompt (~> 0.20) little-plugger (1.1.4) - logging (2.2.2) + logging (2.3.0) little-plugger (~> 1.1) - multi_json (~> 1.10) + multi_json (~> 1.14) memoist (0.16.2) method_source (1.0.0) mini_mime (1.0.2) - minitest (5.14.1) - mixlib-config (3.0.6) + minitest (5.14.2) + mixlib-config (3.0.9) tomlrb - mixlib-install (3.12.1) + mixlib-install (3.12.3) mixlib-shellout mixlib-versioning thor - mixlib-log (3.0.8) - mixlib-shellout (3.0.9) + mixlib-log (3.0.9) + mixlib-shellout (3.1.6) + chef-utils mixlib-versioning (1.2.12) ms_rest (0.7.6) concurrent-ruby (~> 1.0) @@ -319,26 +325,24 @@ GEM faraday (>= 0.9, < 2.0.0) faraday-cookie_jar (~> 0.0.6) ms_rest (~> 0.7.6) - multi_json (1.14.1) + multi_json (1.15.0) multipart-post (2.1.1) - necromancer (0.5.1) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) net-ssh-gateway (2.0.0) net-ssh (>= 4.0.0) nori (2.6.0) - os (1.1.0) + os (1.1.1) parallel (1.19.2) parslet (1.8.2) - pastel (0.7.4) - equatable (~> 0.6) + pastel (0.8.0) tty-color (~> 0.5) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.5) - regexp_parser (1.7.1) + public_suffix (4.0.6) + regexp_parser (1.8.1) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) @@ -348,7 +352,7 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) @@ -369,18 +373,15 @@ GEM jwt (>= 1.5, < 3.0) multi_json (~> 1.10) sslshake (1.3.1) - strings (0.1.8) - strings-ansi (~> 0.1) + strings (0.2.0) + strings-ansi (~> 0.2) unicode-display_width (~> 1.5) unicode_utils (~> 1.4) strings-ansi (0.2.0) - sync (0.5.0) - term-ansicolor (1.7.1) - tins (~> 1.0) - test-kitchen (2.5.2) + test-kitchen (2.7.2) bcrypt_pbkdf (~> 1.0) ed25519 (~> 1.2) - license-acceptance (~> 1.0, >= 1.0.11) + license-acceptance (>= 1.0.11, < 3.0) mixlib-install (~> 3.6) mixlib-shellout (>= 1.2, < 4.0) net-scp (>= 1.1, < 4.0) @@ -393,23 +394,21 @@ GEM thor (1.0.1) thread_safe (0.3.6) timeliness (0.3.10) - tins (1.25.0) - sync tomlrb (1.2.9) - train (3.3.1) + train (3.3.24) activesupport (>= 5.2.4.3, < 6.0.0) azure_graph_rbac (~> 0.16) azure_mgmt_key_vault (~> 0.17) azure_mgmt_resources (~> 0.15) azure_mgmt_security (~> 0.18) azure_mgmt_storage (~> 0.18) - docker-api (~> 1.26) - google-api-client (>= 0.23.9, < 0.35.0) - googleauth (>= 0.6.6, < 0.11.0) + docker-api (>= 1.26, < 3.0) + google-api-client (>= 0.23.9, < 0.44.1) + googleauth (>= 0.6.6, < 0.13.1) inifile (~> 3.0) - train-core (= 3.3.1) + train-core (= 3.3.24) train-winrm (~> 0.2) - train-aws (0.1.17) + train-aws (0.1.18) aws-sdk-apigateway (~> 1.0) aws-sdk-apigatewayv2 (~> 1.0) aws-sdk-athena (~> 1.0) @@ -440,6 +439,7 @@ GEM aws-sdk-elasticloadbalancingv2 (~> 1.0) aws-sdk-elasticsearchservice (~> 1.0) aws-sdk-firehose (~> 1.0) + aws-sdk-guardduty (~> 1.31) aws-sdk-iam (~> 1.13) aws-sdk-kafka (~> 1.0) aws-sdk-kinesis (~> 1.0) @@ -458,7 +458,7 @@ GEM aws-sdk-sns (~> 1.9) aws-sdk-sqs (~> 1.10) aws-sdk-ssm (~> 1.0) - train-core (3.3.1) + train-core (3.3.24) addressable (~> 2.5) ffi (!= 1.13.0) json (>= 1.8, < 3.0) @@ -466,30 +466,28 @@ GEM net-scp (>= 1.2, < 4.0) net-ssh (>= 2.9, < 7.0) train-habitat (0.2.13) - train-winrm (0.2.6) + train-winrm (0.2.11) winrm (~> 2.0) + winrm-elevated (~> 1.2.2) winrm-fs (~> 1.0) - tty-box (0.5.0) - pastel (~> 0.7.2) - strings (~> 0.1.6) + tty-box (0.6.0) + pastel (~> 0.8) + strings (~> 0.2.0) tty-cursor (~> 0.7) - tty-color (0.5.1) + tty-color (0.5.2) tty-cursor (0.7.1) - tty-prompt (0.21.0) - necromancer (~> 0.5.0) - pastel (~> 0.7.0) - tty-reader (~> 0.7.0) - tty-reader (0.7.0) + tty-prompt (0.22.0) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.8.0) tty-cursor (~> 0.7) - tty-screen (~> 0.7) - wisper (~> 2.0.0) - tty-screen (0.8.0) - tty-table (0.11.0) - equatable (~> 0.6) - necromancer (~> 0.5) - pastel (~> 0.7.2) - strings (~> 0.1.5) - tty-screen (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) tzinfo (1.2.7) thread_safe (~> 0.1) uber (0.1.0) @@ -508,7 +506,7 @@ GEM logging (>= 1.6.1, < 3.0) nori (~> 2.0) rubyntlm (~> 0.6.0, >= 0.6.1) - winrm-elevated (1.2.1) + winrm-elevated (1.2.2) erubi (~> 1.8) winrm (~> 2.0) winrm-fs (~> 1.0) @@ -523,9 +521,9 @@ PLATFORMS ruby DEPENDENCIES - kitchen-docker (>= 2.9) - kitchen-inspec (>= 1.1) - kitchen-salt (>= 0.6.0) + kitchen-docker! + kitchen-inspec (>= 2.2.1) + kitchen-salt (>= 0.6.3) BUNDLED WITH 2.1.2 diff --git a/arvados/libtofs.jinja b/arvados/libtofs.jinja index 0668925..f39fd42 100644 --- a/arvados/libtofs.jinja +++ b/arvados/libtofs.jinja @@ -1,40 +1,37 @@ -{%- macro files_switch(source_files, - lookup=None, - default_files_switch=['id', 'os_family'], - indent_width=6, - use_subpath=False) %} - {#- +{%- macro files_switch( + source_files, + lookup=None, + default_files_switch=["id", "os_family"], + indent_width=6, + use_subpath=False + ) %} +{#- Returns a valid value for the "source" parameter of a "file.managed" state function. This makes easier the usage of the Template Override and Files Switch (TOFS) pattern. - Params: * source_files: ordered list of files to look for - * lookup: key under ':tofs:source_files' to prepend to the + * lookup: key under ":tofs:source_files" to prepend to the list of source files * default_files_switch: if there's no config (e.g. pillar) - ':tofs:files_switch' this is the ordered list of grains to + ":tofs:files_switch" this is the ordered list of grains to use as selector switch of the directories under "/files" * indent_width: indentation of the result value to conform to YAML * use_subpath: defaults to `False` but if set, lookup the source file recursively from the current state directory up to `tplroot` - Example (based on a `tplroot` of `xxx`): - If we have a state: - Deploy configuration: file.managed: - name: /etc/yyy/zzz.conf - - source: {{ files_switch(['/etc/yyy/zzz.conf', '/etc/yyy/zzz.conf.jinja'], - lookup='Deploy configuration' - ) }} + - source: {{ files_switch( + ["/etc/yyy/zzz.conf", "/etc/yyy/zzz.conf.jinja"], + lookup="Deploy configuration", + ) }} - template: jinja - In a minion with id=theminion and os_family=RedHat, it's going to be rendered as: - Deploy configuration: file.managed: - name: /etc/yyy/zzz.conf @@ -46,67 +43,73 @@ - salt://xxx/files/default/etc/yyy/zzz.conf - salt://xxx/files/default/etc/yyy/zzz.conf.jinja - template: jinja - #} - {#- Get the `tplroot` from `tpldir` #} - {%- set tplroot = tpldir.split('/')[0] %} - {%- set path_prefix = salt['config.get'](tplroot ~ ':tofs:path_prefix', tplroot) %} - {%- set files_dir = salt['config.get'](tplroot ~ ':tofs:dirs:files', 'files') %} - {%- set files_switch_list = salt['config.get']( - tplroot ~ ':tofs:files_switch', - default_files_switch - ) %} - {#- Lookup source_files (v2), files (v1), or fallback to an empty list #} - {%- set src_files = salt['config.get']( - tplroot ~ ':tofs:source_files:' ~ lookup, - salt['config.get'](tplroot ~ ':tofs:files:' ~ lookup, []) - ) %} - {#- Append the default source_files #} - {%- set src_files = src_files + source_files %} - {#- Only add to [''] when supporting older TOFS implementations #} - {%- set path_prefix_exts = [''] %} - {%- if use_subpath and tplroot != tpldir %} - {#- Walk directory tree to find {{ files_dir }} #} - {%- set subpath_parts = tpldir.lstrip(tplroot).lstrip('/').split('/') %} - {%- for path in subpath_parts %} - {%- set subpath = subpath_parts[0:loop.index] | join('/') %} - {%- do path_prefix_exts.append('/' ~ subpath) %} - {%- endfor %} - {%- endif %} - {%- for path_prefix_ext in path_prefix_exts|reverse %} - {%- set path_prefix_inc_ext = path_prefix ~ path_prefix_ext %} - {#- For older TOFS implementation, use `files_switch` from the config #} - {#- Use the default, new method otherwise #} - {%- set fsl = salt['config.get']( - tplroot ~ path_prefix_ext|replace('/', ':') ~ ':files_switch', - files_switch_list - ) %} - {#- Append an empty value to evaluate as `default` in the loop below #} - {%- if '' not in fsl %} - {%- set fsl = fsl + [''] %} - {%- endif %} - {%- for fs in fsl %} - {%- for src_file in src_files %} - {%- if fs %} - {%- set fs_dirs = salt['config.get'](fs, fs) %} - {%- else %} - {%- set fs_dirs = salt['config.get'](tplroot ~ ':tofs:dirs:default', 'default') %} - {%- endif %} - {#- Force the `config.get` lookup result as a list where necessary #} - {#- since we need to also handle grains that are lists #} - {%- if fs_dirs is string %} - {%- set fs_dirs = [fs_dirs] %} - {%- endif %} - {%- for fs_dir in fs_dirs %} - {%- set url = [ - '- salt:/', - path_prefix_inc_ext.strip('/'), - files_dir.strip('/'), - fs_dir.strip('/'), - src_file.strip('/'), - ] | select | join('/') %} +#} +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split("/")[0] %} +{%- set path_prefix = salt["config.get"](tplroot ~ ":tofs:path_prefix", tplroot) %} +{%- set files_dir = salt["config.get"](tplroot ~ ":tofs:dirs:files", "files") %} +{%- set files_switch_list = salt["config.get"]( + tplroot ~ ":tofs:files_switch", default_files_switch + ) %} +{#- Lookup source_files (v2), files (v1), or fallback to an empty list #} +{%- set src_files = salt["config.get"]( + tplroot ~ ":tofs:source_files:" ~ lookup, + salt["config.get"](tplroot ~ ":tofs:files:" ~ lookup, []), + ) %} +{#- Append the default source_files #} +{%- set src_files = src_files + source_files %} +{#- Only add to [""] when supporting older TOFS implementations #} +{%- set path_prefix_exts = [""] %} +{%- if use_subpath and tplroot != tpldir %} +{#- Walk directory tree to find {{ files_dir }} #} +{%- set subpath_parts = tpldir.lstrip(tplroot).lstrip("/").split("/") %} +{%- for path in subpath_parts %} +{%- set subpath = subpath_parts[0 : loop.index] | join("/") %} +{%- do path_prefix_exts.append("/" ~ subpath) %} +{%- endfor %} +{%- endif %} +{%- for path_prefix_ext in path_prefix_exts | reverse %} +{%- set path_prefix_inc_ext = path_prefix ~ path_prefix_ext %} +{#- For older TOFS implementation, use `files_switch` from the config #} +{#- Use the default, new method otherwise #} +{%- set fsl = salt["config.get"]( + tplroot ~ path_prefix_ext | replace("/", ":") ~ ":files_switch", + files_switch_list, + ) %} +{#- Append an empty value to evaluate as `default` in the loop below #} +{%- if "" not in fsl %} +{%- set fsl = fsl + [""] %} +{%- endif %} +{%- for fs in fsl %} +{%- for src_file in src_files %} +{%- if fs %} +{%- set fs_dirs = salt["config.get"](fs, fs) %} +{%- else %} +{%- set fs_dirs = salt["config.get"]( + tplroot ~ ":tofs:dirs:default", "default" + ) %} +{%- endif %} +{#- Force the `config.get` lookup result as a list where necessary #} +{#- since we need to also handle grains that are lists #} +{%- if fs_dirs is string %} +{%- set fs_dirs = [fs_dirs] %} +{%- endif %} +{%- for fs_dir in fs_dirs %} +{#- strip empty elements by using a select #} +{%- set url = ( + [ + "- salt:/", + path_prefix_inc_ext.strip("/"), + files_dir.strip("/"), + fs_dir.strip("/"), + src_file.strip("/"), + ] + | select + | join("/") + ) %} {{ url | indent(indent_width, true) }} - {%- endfor %} - {%- endfor %} - {%- endfor %} - {%- endfor %} +{%- endfor %} +{%- endfor %} +{%- endfor %} +{%- endfor %} {%- endmacro %} diff --git a/bin/install-hooks b/bin/install-hooks new file mode 100755 index 0000000..840bb6c --- /dev/null +++ b/bin/install-hooks @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +set -o nounset # Treat unset variables as an error and immediately exit +set -o errexit # If a command fails exit the whole script + +if [ "${DEBUG:-false}" = "true" ]; then + set -x # Run the entire script in debug mode +fi + +if ! command -v pre-commit >/dev/null 2>&1; then + echo "pre-commit not found: please install or check your PATH" >&2 + echo "See https://pre-commit.com/#installation" >&2 + exit 1 +fi + +pre-commit install --install-hooks +pre-commit install --hook-type commit-msg --install-hooks diff --git a/commitlint.config.js b/commitlint.config.js index 2f9d1aa..4eb37f4 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,8 @@ module.exports = { extends: ['@commitlint/config-conventional'], + rules: { + 'body-max-line-length': [2, 'always', 120], + 'footer-max-line-length': [2, 'always', 120], + 'header-max-length': [2, 'always', 72], + }, }; diff --git a/docs/README.rst b/docs/README.rst index de0e4a3..e5982c7 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -41,6 +41,11 @@ Contributing to this repo Please see `How to contribute `_ for more details. +Special notes +------------- + +None. + Requisites ---------- diff --git a/docs/TOFS_pattern.rst b/docs/TOFS_pattern.rst index 4fea5dd..dd2c17e 100644 --- a/docs/TOFS_pattern.rst +++ b/docs/TOFS_pattern.rst @@ -64,7 +64,7 @@ Example: NTP before applying TOFS Let's work with the NTP example. A basic formula that follows the `design guidelines `_ has the following files and directories tree: -.. code-block:: +.. code-block:: console /srv/saltstack/salt-formulas/ntp-saltstack-formula/ ntp/ @@ -226,7 +226,7 @@ We can make different templates coexist for different minions, classified by any If we decide that we want ``os_family`` as switch, then we could provide the formula template variants for both the ``RedHat`` and ``Debian`` families. -.. code-block:: +.. code-block:: console /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/ default/ @@ -449,7 +449,7 @@ Using sub-directories for ``components`` If your formula is composed of several components, you may prefer to provides files under sub-directories, like in the `systemd-formula `_. -.. code-block:: +.. code-block:: console /srv/saltstack/systemd-formula/ systemd/