From 223a620d2eea3bf26a8efa86a9fdd8deae7655f3 Mon Sep 17 00:00:00 2001 From: Santiago Traversa Date: Tue, 19 Oct 2021 17:46:52 -0300 Subject: [PATCH] Adds CI to GitHub Actions (#120) * Delete .travis.yml * Adds YAML lint * Adds Markdown lint * Adds Github Actions CI * Add actions build badge Co-authored-by: Stephen Nelson --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++++++++++ .markdownlint.yaml | 3 ++ .travis.yml | 48 ------------------ .yamllint | 7 +++ CHANGELOG.md | 2 - README.md | 43 ++++++++-------- kitchen.yml | 16 +++--- test/cookbooks/pdns_test/README.md | 1 - 8 files changed, 117 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .markdownlint.yaml delete mode 100644 .travis.yml create mode 100644 .yamllint delete mode 100644 test/cookbooks/pdns_test/README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6a8ae518 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +--- +name: ci + +"on": + pull_request: + push: + branches: + - main + +jobs: + delivery: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Chef Workstation + uses: actionshub/chef-install@main + - name: Run Chef Delivery + run: chef exec delivery local all + env: + CHEF_LICENSE: accept-no-persist + + markdownlint-cli: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Run markdownlint-cli + uses: nosborn/github-action-markdown-cli@v2.0.0 + with: + files: . + config_file: ".markdownlint.yaml" + + yamllint: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Run YAML Lint + uses: actionshub/yamllint@main + + integration: + needs: [delivery, markdownlint-cli, yamllint] + runs-on: ubuntu-latest + strategy: + matrix: + os: + - 'centos-7' + - 'centos-8' + - 'debian-10' + - 'debian-9' + - 'ubuntu-1804' + - 'ubuntu-2004' + suite: + - 'authoritative-multi' + - 'authoritative-postgres' + - 'recursor-multi' + fail-fast: false + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Chef Workstation + uses: actionshub/chef-install@main + - name: Run Test Kitchen + uses: actionshub/test-kitchen@main + env: + CHEF_LICENSE: accept-no-persist + KITCHEN_LOCAL_YAML: kitchen.yml + with: + suite: ${{ matrix.suite }} + os: ${{ matrix.os }} + - name: Debug + if: failure() + run: | + set -x + sudo journalctl -l --since today + KITCHEN_LOCAL_YAML=kitchen.yml /usr/bin/kitchen exec \ + ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l" diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 00000000..75b752ba --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,3 @@ +--- +default: true +line-length: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f6d296a8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -dist: focal - -services: docker - -env: - global: - - CHEF_LICENSE="accept-silent" - - secure: IfD/3A3IPxozFCSTlI5q6PIr1D78WupjhZVU5RlvDRsuajZuhCJHYHQvD1SI0cLAE+MG3XPhg8BXbPDtHGPCpNKybEFhWlRU9tghTxpzijMBvImBVPNzo8otn8ywvpw1XSFHKd79dFj1SRZqWbEFW4G/JFHarxl9svggyrfMTx8= - matrix: - # Split up the test-kitchen run to avoid exceeding 50 minutes: - - TASK="quick" - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-centos-7 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-centos-8 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-debian-9 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-debian-10 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-ubuntu-1804 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-multi-ubuntu-2004 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-centos-7 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-centos-8 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-debian-9 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-debian-10 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-ubuntu-1804 - - TASK="kitchen" KITCHEN_REGEXP=authoritative-postgres-ubuntu-2004 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-centos-7 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-centos-8 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-debian-9 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-debian-10 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-ubuntu-1804 - - TASK="kitchen" KITCHEN_REGEXP=recursor-multi-ubuntu-2004 - -matrix: - fast_finish: true - -before_install: - - curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef-workstation - -install: echo "skip bundle install" - -before_script: - - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) - - eval "$(chef shell-init bash)" - -script: chef exec rake $TASK - -notifications: - email: false - slack: - secure: "dJySJ4LWsx6C9+rDKyt07d57pFwJX/aycW2K9AM7DzujEU/EomIIswXD1zU1znQUUmxc87OdTOIJq7vo6uVTlG0aiN34RGOn7s25os0S3GEVeEOHsJou2pKxK0TjmBbsg+nSMudzet/1UJ9pIDgjg8RY7/GLjEiEU6T/CNbya7M=" diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..7ef65d33 --- /dev/null +++ b/.yamllint @@ -0,0 +1,7 @@ +--- +extends: default +rules: + document-start: false + line-length: + max: 256 + level: warning diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b526730..1b5a379e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -397,6 +397,4 @@ - \[COOK-2986\] Fix foodcritic warnings [\#7](https://github.com/dnsimple/chef-pdns/pull/7) ([stevendanna](https://github.com/stevendanna)) - \[COOK-2604\] Configure a PowerDNS server [\#2](https://github.com/dnsimple/chef-pdns/pull/2) ([dje](https://github.com/dje)) - - \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/README.md b/README.md index 8a3b36bc..5de22f33 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # PowerDNS Community Cookbook +![CI](https://github.com/dnsimple/pdns/actions/workflows/ci.yml/badge.svg) + Provides resources for installing and configuring both PowerDNS authoritative and recursor. It uses the official PowerDNS repositories for packages and installs the appropriate configuration for your platform's init system. ## Build Status @@ -31,20 +33,20 @@ You can look at the [test cookbook](https://github.com/dnsimple/chef-pdns/blob/m ## Requirements -### Platforms: +### Platforms - Ubuntu 18.04 and newer - Debian 9 and newer - RHEL 7 and newer - CentOS 7 and newer -### Chef: +### Chef - Chef 15 or newer -### Init Systems: +### Init Systems -* systemd +- systemd ## Usage @@ -93,7 +95,7 @@ end Will create a file named `/etc/powerdns/pdns-server_01.conf`: -``` +```shell launch ['gpgsql'] gpgsql-host=127.0.0.1 gpgsql-user=pdns @@ -117,7 +119,7 @@ Most of the properties are optional and have sane defaults, so they are only rec Installs PowerDNS authoritative server 4.4.x series using PowerDNS official repository in the supported platforms. -#### Properties +#### pdns_authoritative_install Properties | Name | Type | Default value | |---------------|-------------|----------------| @@ -129,7 +131,7 @@ Installs PowerDNS authoritative server 4.4.x series using PowerDNS official repo **Note:** When specifying backends, the name of the backend must match the repository package. For example, in Debian systems the Postgresql backend is actually named `pgsql` while on RHEL systems it is `postgresql`. Consider using the `value_for_platform` if you are installing on multiple platforms. There is an example of this technique in the test folder cookbook recipe. -#### Usage examples +#### pdns_authoritative_install Usage examples Install the latest 4.4.x series PowerDNS Authoritative Server @@ -167,7 +169,7 @@ end Creates a PowerDNS authoritative configuration, there is a fixed set of required properties (listed below) but most of the configuration is left to the user freely, every property set in the `variables` hash property will be rendered in the config template. Remember that using underscores `_` for property names is required and it's translated to hyphens `-` in configuration templates. -#### Properties +#### pdns_authoritative_config Properties | Name | Class | Default value | Consistent? | |----------------|------------|-------------------------------------------------------------|-------------| @@ -188,11 +190,11 @@ Creates a PowerDNS authoritative configuration, there is a fixed set of required - `variables`: Variables for the configuration template. - `virtual` : Is this a virtual instance or the default? -#### Usage Example +#### pdns_authoritative_config Usage Example Create a PowerDNS authoritative configuration file named `server-01`: -``` +```ruby pdns_authoritative_config 'server_01' do virtual true launch ['gpgsql'] @@ -216,7 +218,7 @@ Creates a service to manage a PowerDNS authoritative instance. This service supp *Important:* services are not restarted or reloaded automatically on config changes in this cookbook, you need to add this in your wrapper cookbook if you desire this functionality, the `pdns_authoritative_service` cookbook provides actions to do it. -#### Properties +#### pdns_authoritative_service Properties | Name | Class | Default value | Consistent? | |----------------|-------------|------------------------------------------------------------|-------------| @@ -224,7 +226,7 @@ Creates a service to manage a PowerDNS authoritative instance. This service supp | config_dir | String | See `default_authoritative_config_directory` helper method | Yes | | virtual | Boolean | false | No | -#### Usage example +#### pdns_authoritative_service Usage example To enable and start the default PowerDNS Authoritative server @@ -247,7 +249,7 @@ end Installs PowerDNS recursor 4.4.x series using PowerDNS official repository in the supported platforms. -#### Properties +#### pdns_recursor_install Properties | Name | Type | Default value | |----------------|-------------|-----------------| @@ -256,7 +258,7 @@ Installs PowerDNS recursor 4.4.x series using PowerDNS official repository in th | debug | true, false | false | | allow_upgrade | true, false | false | -#### Usage examples +#### pdns_recursor_install Usage examples Install the latest 4.4.x release PowerDNS recursor @@ -285,7 +287,7 @@ end Creates a PowerDNS recursor configuration. -#### Properties +#### pdns_recursor_config Properties | Name | Class | Default value | Consistent? | |----------------|------------|-------------------------------------------------------------|-------------| @@ -310,8 +312,7 @@ Sets up a PowerDNS recursor instance. *Important:* services not restarted or reloaded automatically on config changes in this cookbook, you need to add this in your wrapper cookbook if you desire this functionality, the `pdns_recursor_service` cookbook provides actions to do it. - -#### Properties +#### pdns_recursor_service Properties | Name | Class | Default value | Consistent? | |----------------|-------------|------------------------------------------------------------|-------------| @@ -319,9 +320,9 @@ Sets up a PowerDNS recursor instance. | config_dir | String | See `default_recursor_config_directory` helper method | Yes | | virtual | Boolean | false | No | -#### Usage Example +#### pdns_recursor_service Usage Examples -Disable the default PowerDNS recursor install service +##### Disable the default PowerDNS recursor install service ```ruby pdns_recursor_service 'default' do @@ -339,9 +340,7 @@ pdns_recursor_service 'my_recursor' do end ``` -#### Usage Example - -Customize the default recursor installation and change it's port to 54: +##### Customize the default recursor installation and change it's port to 54 ```ruby pdns_recursor_config 'default' do diff --git a/kitchen.yml b/kitchen.yml index 41e44aff..06bfec06 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -30,32 +30,32 @@ platforms: image: dokken/debian-9 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install dnsutils -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install dnsutils -y - name: debian-10 driver: image: dokken/debian-10 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install dnsutils -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install dnsutils -y - name: ubuntu-18.04 driver: image: dokken/ubuntu-18.04 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install dnsutils -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install dnsutils -y - name: ubuntu-20.04 driver: image: dokken/ubuntu-20.04 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install dnsutils -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install dnsutils -y suites: - name: recursor-multi diff --git a/test/cookbooks/pdns_test/README.md b/test/cookbooks/pdns_test/README.md deleted file mode 100644 index aa15ee20..00000000 --- a/test/cookbooks/pdns_test/README.md +++ /dev/null @@ -1 +0,0 @@ -A small cookbook to aid in testing `pdns` \ No newline at end of file