Yaml and Ansible linting in Molecule (#141)

* Removed old ansible-lint outside of molecule

* Yamlint

* Enabled ansible-lint with minimal rules

* Removed ansible-lint job
This commit is contained in:
Przemyslaw Rzad 2019-07-11 10:17:02 +02:00 committed by GitHub
parent 3f27b98b8b
commit 1da1acbfbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 61 additions and 42 deletions

@ -55,12 +55,6 @@ jobs:
- restore_cache: - restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }} key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run lint - run: yarn run lint
ansible-lint:
docker:
- image: particlekit/ansible-lint
steps:
- checkout
- run: ./deployment/lint.sh
test: test:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
@ -151,7 +145,6 @@ workflows:
filters: filters:
branches: branches:
only: master only: master
- ansible-lint
- oracle-e2e - oracle-e2e
- ui-e2e - ui-e2e
- monitor-e2e - monitor-e2e

@ -76,14 +76,6 @@ Running linter for all JS projects:
yarn lint yarn lint
``` ```
Running linter for all Ansible playbooks:
- [ansible-lint](https://github.com/ansible/ansible-lint) is required
```
yarn ansible-lint
```
## Tests ## Tests
Running tests for all projects: Running tests for all projects:

@ -1,3 +1,4 @@
---
## General settings ## General settings
BRIDGE_MODE: "ERC_TO_NATIVE" BRIDGE_MODE: "ERC_TO_NATIVE"
HOME_NATIVE_NAME: "xDai" HOME_NATIVE_NAME: "xDai"
@ -14,7 +15,7 @@ FOREIGN_RPC_URL: "https://mainnet.infura.io"
FOREIGN_NAME: "Ethereum Mainnet" FOREIGN_NAME: "Ethereum Mainnet"
FOREIGN_WITHOUT_EVENTS: false FOREIGN_WITHOUT_EVENTS: false
FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016" FOREIGN_BRIDGE_ADDRESS: "0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016"
ERC20_TOKEN_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" ERC20_TOKEN_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"
FOREIGN_POLLING_INTERVAL: 5000 FOREIGN_POLLING_INTERVAL: 5000
## Home Gasprice ## Home Gasprice

@ -1,3 +1,4 @@
---
## General settings ## General settings
BRIDGE_MODE: "NATIVE_TO_ERC" BRIDGE_MODE: "NATIVE_TO_ERC"
HOME_NATIVE_NAME: "POA" HOME_NATIVE_NAME: "POA"

@ -1,3 +1,4 @@
---
## General settings ## General settings
BRIDGE_MODE: "NATIVE_TO_ERC" BRIDGE_MODE: "NATIVE_TO_ERC"
HOME_NATIVE_NAME: "ETC" HOME_NATIVE_NAME: "ETC"

@ -1,3 +1,4 @@
---
sokol-kovan: sokol-kovan:
children: children:
oracle: oracle:

@ -1,3 +0,0 @@
#!/bin/bash
cd $(dirname $0)
ansible-lint -v -t bug ./oracle/roles/**

@ -1,4 +1,5 @@
FROM python:3.7-stretch FROM python:3.7-stretch
RUN curl -fsSL https://get.docker.com | sh RUN curl -fsSL https://get.docker.com | sh
RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8 RUN pip3 install docker molecule==2.22rc1 molecule[docker] flake8
WORKDIR runner
COPY . . COPY . .

@ -5,7 +5,10 @@ driver:
name: docker name: docker
lint: lint:
name: yamllint name: yamllint
enabled: False enabled: True
options:
config-data:
ignore: ../../hosts.yml
platforms: platforms:
- name: oracle-host - name: oracle-host
groups: groups:
@ -21,7 +24,9 @@ provisioner:
name: ansible name: ansible
lint: lint:
name: ansible-lint name: ansible-lint
enabled: False enabled: True
options:
r: ["bug"]
playbooks: playbooks:
prepare: prepare.yml prepare: prepare.yml
converge: ../../site.yml converge: ../../site.yml

@ -7,7 +7,7 @@
name: "{{ packages }}" name: "{{ packages }}"
vars: vars:
packages: packages:
- apt-transport-https - apt-transport-https
- rsyslog - rsyslog
- shell: service rsyslog start - shell: service rsyslog start
- shell: groupadd docker && chgrp docker /var/run/docker.sock - shell: groupadd docker && chgrp docker /var/run/docker.sock

@ -1,3 +1,4 @@
---
version: '3.0' version: '3.0'
services: services:
molecule_runner: molecule_runner:

@ -1,3 +1,4 @@
---
docker_compose_version: 1.23.2 docker_compose_version: 1.23.2
compose_service_user: poadocker compose_service_user: poadocker
bridge_path: "/home/{{ compose_service_user }}/bridge" bridge_path: "/home/{{ compose_service_user }}/bridge"

@ -1,3 +1,4 @@
---
- name: restart rsyslog - name: restart rsyslog
service: service:
name: rsyslog name: rsyslog

@ -1,3 +1,4 @@
---
- name: Install the gpg key for docker - name: Install the gpg key for docker
apt_key: apt_key:
url: "https://download.docker.com/linux/ubuntu/gpg" url: "https://download.docker.com/linux/ubuntu/gpg"

@ -1,3 +1,4 @@
---
- name: Set the local docker logs configuration file - name: Set the local docker logs configuration file
template: template:
src: 30-docker.conf.j2 src: 30-docker.conf.j2

@ -1,3 +1,4 @@
---
- include_tasks: dependencies.yml - include_tasks: dependencies.yml
- include_tasks: repo.yml - include_tasks: repo.yml
- include_tasks: logging.yml - include_tasks: logging.yml

@ -1,3 +1,4 @@
---
- name: Get bridge repo - name: Get bridge repo
git: git:
repo: "{{ bridge_repo }}" repo: "{{ bridge_repo }}"

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- role: common - role: common

@ -1,3 +1,4 @@
---
- name: Launch container - name: Launch container
shell: docker-compose up -d shell: docker-compose up -d
args: args:

@ -1,3 +1,4 @@
---
- include_tasks: pre_config.yml - include_tasks: pre_config.yml
- include_tasks: jumpbox.yml - include_tasks: jumpbox.yml
- include_tasks: servinstall.yml - include_tasks: servinstall.yml

@ -1,3 +1,4 @@
---
- name: Install .env config - name: Install .env config
template: template:
src: .env.j2 src: .env.j2

@ -1,3 +1,4 @@
---
bridge_path: "/home/{{ compose_service_user }}/bridge" bridge_path: "/home/{{ compose_service_user }}/bridge"
ALLOW_HTTP: no ALLOW_HTTP: no
QUEUE_URL: amqp://rabbit QUEUE_URL: amqp://rabbit

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- role: common - role: common

@ -1,3 +1,4 @@
---
- name: Launch container - name: Launch container
shell: docker-compose up -d shell: docker-compose up -d
args: args:

@ -1,3 +1,4 @@
---
- name: Slurp docker compose file - name: Slurp docker compose file
slurp: slurp:
src: "{{ bridge_path }}/oracle/docker-compose.yml" src: "{{ bridge_path }}/oracle/docker-compose.yml"

@ -1,3 +1,4 @@
---
- include_tasks: pre_config.yml - include_tasks: pre_config.yml
- include_tasks: logging.yml - include_tasks: logging.yml
- include_tasks: jumpbox.yml - include_tasks: jumpbox.yml

@ -1,3 +1,4 @@
---
- name: Get blocks - name: Get blocks
become_user: "{{ compose_service_user }}" become_user: "{{ compose_service_user }}"
shell: docker-compose run --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_affirmation shell: docker-compose run --entrypoint "node scripts/getValidatorStartBlocks.js" bridge_affirmation

@ -1,3 +1,4 @@
---
- name: Install .env config - name: Install .env config
template: template:
src: .env.j2 src: .env.j2

@ -1,2 +1,3 @@
---
dependencies: dependencies:
- role: common - role: common

@ -1,3 +1,4 @@
---
- name: Launch container - name: Launch container
shell: docker-compose up -d shell: docker-compose up -d
args: args:

@ -1,3 +1,4 @@
---
- name: Slurp docker compose file - name: Slurp docker compose file
slurp: slurp:
src: "{{ bridge_path }}/ui/docker-compose.yml" src: "{{ bridge_path }}/ui/docker-compose.yml"

@ -1,3 +1,4 @@
---
- include_tasks: pre_config.yml - include_tasks: pre_config.yml
- include_tasks: logging.yml - include_tasks: logging.yml
- include_tasks: jumpbox.yml - include_tasks: jumpbox.yml

@ -1,3 +1,4 @@
---
- name: Install .env config - name: Install .env config
template: template:
src: .env.j2 src: .env.j2

@ -1,3 +1,4 @@
---
- name: Install Oracle - name: Install Oracle
hosts: oracle hosts: oracle
become: true become: true

@ -1,3 +1,4 @@
---
version: '3' version: '3'
services: services:
parity1: parity1:

@ -1,3 +1,4 @@
---
version: '2.4' version: '2.4'
services: services:
monitor: monitor:

@ -1,3 +1,4 @@
---
version: '2.4' version: '2.4'
services: services:
rabbit: rabbit:

@ -35,7 +35,6 @@
"build": "yarn workspace ui run build", "build": "yarn workspace ui run build",
"lint": "yarn wsrun --exclude poa-parity-bridge-contracts lint", "lint": "yarn wsrun --exclude poa-parity-bridge-contracts lint",
"test": "yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test", "test": "yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test",
"ansible-lint": "./deployment/lint.sh",
"oracle-e2e": "./oracle-e2e/run-tests.sh", "oracle-e2e": "./oracle-e2e/run-tests.sh",
"ui-e2e": "./ui-e2e/run-tests.sh", "ui-e2e": "./ui-e2e/run-tests.sh",
"clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build", "clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build",

@ -1,3 +1,4 @@
---
version: '2.4' version: '2.4'
services: services:
ui: ui: