Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
Signed-off-by: kogeler <roman.gavrilov@parity.io>
  • Loading branch information
kogeler committed May 25, 2024
1 parent de2adfc commit a4918be
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 66 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/requirements-molecule.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ansible-lint==24.5.0
attrs==23.2.0
black==24.4.2
bracex==2.4
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
click-help-colors==0.9.4
cryptography==42.0.7
distro==1.9.0
enrich==1.2.7
filelock==3.14.0
idna==3.7
importlib_metadata==7.1.0
Jinja2==3.1.4
jmespath==1.0.1
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
molecule==24.2.1
molecule-plugins==23.5.3
mypy-extensions==1.0.0
packaging==24.0
pathspec==0.12.1
platformdirs==4.2.2
pluggy==1.5.0
pycparser==2.22
Pygments==2.18.0
PyYAML==6.0.1
referencing==0.35.1
resolvelib==1.0.1
rich==13.7.1
rpds-py==0.18.1
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
selinux==0.3.0
subprocess-tee==0.4.1
urllib3==2.2.1
wcmatch==8.5.2
yamllint==1.35.1
zipp==3.18.2
# requests > 2.31.0 brakes Docker Python library
# The fix https://github.com/docker/docker-py/pull/3257/files
# has not been in a release of the Docker Python library
# they should be updated together
# when new versions of the Docker Python library > 7.1.0 are released
docker==7.1.0
requests==2.31.0
28 changes: 12 additions & 16 deletions .github/workflows/reusable-molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,26 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.12'
- name: Check molecule
run: |
if [ -d "molecule" ]; then
echo "MOLECULE_IS_PRESENT=PRESENT" >> "${GITHUB_ENV}"
fi
working-directory: "${{ github.repository }}/roles/${{ inputs.role-name }}"
- name: Setup molecule
- name: Install Python modules
run: |
pip3 install --no-cache-dir yamllint ansible==${{ inputs.ansible-version }} ansible-lint \
molecule molecule-plugins[docker] docker \
jmespath
- name: Print Ansible version
run: ansible --version
- name: Setup LXD
if: ${{ env.MOLECULE_IS_PRESENT && inputs.molecule-driver == 'lxd' }}
# https://github.com/canonical/setup-lxd
uses: canonical/setup-lxd@v0.1.1
with:
channel: latest/stable
- name: Setup LXD molecule module
if: ${{ env.MOLECULE_IS_PRESENT && inputs.molecule-driver == 'lxd' }}
set -e
echo "ansible==${{ inputs.ansible-version }}" >> requirements-molecule.txt
pip3 install --no-cache-dir -r requirements-molecule.txt
working-directory: "${{ github.repository }}/.github/workflows"
- name: Print versions
run: |
pip3 install --no-cache-dir molecule-lxd
set -e
ansible --version
molecule --version
yamllint --version
ansible-lint --version
- name: Run lint
run: |
set -e
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace: paritytech
name: chain

# The version of the collection. Must be compatible with semantic versioning
version: 1.9.0
version: 1.9.1

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
8 changes: 0 additions & 8 deletions roles/nginx/molecule/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,3 @@ molecule verify
molecule destroy
```

#### LXD
Test role with LXD driver
```shell
DRIVER=lxd molecule create
DRIVER=lxd molecule converge
DRIVER=lxd molecule verify
DRIVER=lxd molecule destroy
```
3 changes: 0 additions & 3 deletions roles/nginx/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-nginx
# LXD
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
2 changes: 1 addition & 1 deletion roles/node/molecule/default/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ansible_user: root
## Node
node_chain: polkadot
node_app_name: "{{ node_chain }}"
node_binary_version: v1.3.0
node_binary_version: v1.12.0
node_legacy_rpc_flags: false
node_rpc_port: 9944
node_binary: https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-{{ node_binary_version }}/polkadot
Expand Down
3 changes: 0 additions & 3 deletions roles/node/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-node
# LXD
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
3 changes: 0 additions & 3 deletions roles/node/molecule/parachain/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-node-parachain
# LXD
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
2 changes: 0 additions & 2 deletions roles/node/molecule/parachain_remote_rc/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-node-parachain-remote-rc
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
7 changes: 0 additions & 7 deletions roles/node_backup/molecule/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@ molecule converge
molecule destroy
```

#### LXD
Test role with LXD driver
```shell
DRIVER=lxd molecule create
DRIVER=lxd molecule converge
DRIVER=lxd molecule destroy
```

3 changes: 0 additions & 3 deletions roles/node_backup/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-node-backup
# LXD
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
15 changes: 10 additions & 5 deletions roles/ws_health_exporter/molecule/default/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
ansible_user: root

## node
node_binary_version: v0.9.42
node_role: "validator"
node_user: polkadot
node_binary: https://github.com/paritytech/polkadot/releases/download/{{ node_binary_version }}/polkadot
node_chain: rococo-local
node_chain: westend-local
node_chain_backup_chain_path: "westend_local_testnet"
node_chain_backup_restoring_type: none
node_parachain_chain_backup_restoring_type: none
node_p2p_bind_addr: "127.0.0.1"
node_ansible_annotation_path: /tmp/substrate.prom
node_binary_version: v1.12.0
node_binary: "https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-{{ node_binary_version }}/polkadot"
node_prepare_worker_binary: "https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-{{ node_binary_version }}/polkadot-prepare-worker"
node_execute_worker_binary: "https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-{{ node_binary_version }}/polkadot-execute-worker"

## ws_health_exporter
ws_health_exporter_user: "{{ node_user }}"
Expand All @@ -19,5 +24,5 @@ ws_health_exporter_node_max_unsynchronized_block_drift: 2
ws_health_exporter_node_min_peers: 1

ws_health_exporter_ws_urls:
- ws://127.0.0.1:9944
- ws://127.0.0.1:9945
- ws://127.0.0.1:9933
- ws://127.0.0.1:9934
3 changes: 0 additions & 3 deletions roles/ws_health_exporter/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ driver:
name: ${DRIVER:-docker}
platforms:
- name: molecule-instance-ws-health-exporter
# LXD
source:
alias: debian/bullseye/amd64
# DOCKER
image: paritytech/debian11:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
Expand Down
28 changes: 21 additions & 7 deletions roles/ws_health_exporter/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,43 @@
- name: Install Python3
ansible.builtin.raw: apt -y update && apt install -y python3
changed_when: false
- name: Install required packages
ansible.builtin.apt:
name:
- gpg
update_cache: false
changed_when: false
tasks:
- name: Include node alice
# use include role to skip ansible-lint
ansible.builtin.include_role:
name: node
vars:
node_app_name: rococo-alice
node_data_root_path: /opt/{{ node_app_name }}
node_app_name: "alice"
node_data_root_path: "/opt/{{ node_app_name }}"
# 12D3KooWHhB5LqXji1moEvbzCEq7HzJuMvqi5E3BkoceUcQFPX2f
node_p2p_private_key: "4f1ae54a051e08161456b74a70b85e45e161fd4f614637f50a2a5f09ba7afb2e"
node_custom_options:
- --alice
- "--alice"
- "--bootnodes /ip4/127.0.0.1/tcp/30334/p2p/12D3KooWKvNLq5fFMcQvdZHejhUvRQcSxDpbWFBo1mXh4kGR949r"
- "--no-hardware-benchmarks"
- "--rpc-cors '*'"
node_p2p_port: "30333"
node_prometheus_port: "9615"
node_rpc_port: "9933"
node_rpc_ws_port: "9944"
- name: Include node bob
ansible.builtin.include_role:
name: node
vars:
node_app_name: rococo-bob
node_app_name: bob
node_data_root_path: /opt/{{ node_app_name }}
# 12D3KooWKvNLq5fFMcQvdZHejhUvRQcSxDpbWFBo1mXh4kGR949r
node_p2p_private_key: "042cd72c647f27c6da663f15665b59f707bce7de4b771b098361ff756cde168e"
node_custom_options:
- --bob
- "--bob"
- "--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWHhB5LqXji1moEvbzCEq7HzJuMvqi5E3BkoceUcQFPX2f"
- "--no-hardware-benchmarks"
- "--rpc-cors '*'"
node_p2p_port: "30334"
node_prometheus_port: "9616"
node_rpc_port: "9934"
node_rpc_ws_port: "9945"
8 changes: 4 additions & 4 deletions roles/ws_health_exporter/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
ansible.builtin.debug:
var: ansible_facts.services[item+'.service']
loop:
- rococo-alice
- rococo-bob
- alice
- bob

- name: check service
ansible.builtin.assert:
that: ansible_facts.services[item+'.service'].state == 'running'
loop:
- rococo-alice
- rococo-bob
- alice
- bob

- name: check ws health exporter
ansible.builtin.uri:
Expand Down

0 comments on commit a4918be

Please sign in to comment.