Skip to content

Commit

Permalink
feat(cosmos.testnet_services): command prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
auricom committed Dec 4, 2024
1 parent e35014d commit bfa9ff3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ansible-tag-collections.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Tag Ansible Collection

on:
push:
paths:
- ansible_collections/*/galaxy.yml
branches:
- main

permissions:
contents: write

jobs:
create-tag:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get modified collections info
id: collection
run: |
# Get list of modified galaxy.yml files in this commit
modified_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep 'ansible_collections/.*/galaxy\.yml' || true)
if [ -n "$modified_files" ]; then
while IFS= read -r file; do
if [ -f "$file" ]; then
collection_name=$(echo "$file" | cut -d'/' -f2)
version=$(grep "^version:" "$file" | cut -d' ' -f2)
echo "name=$collection_name" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "Found modified collection: $collection_name version $version"
break
fi
done <<< "$modified_files"
else
echo "No galaxy.yml files modified in this commit"
exit 0
fi
- name: Create tag
if: steps.collection.outputs.name != ''
run: |
tag_name="${{ steps.collection.outputs.name }}-${{ steps.collection.outputs.version }}"
if ! git tag | grep -q "^${tag_name}$"; then
git tag $tag_name
git push origin $tag_name
echo "Created and pushed tag: $tag_name"
else
echo "Tag $tag_name already exists, skipping"
fi
4 changes: 2 additions & 2 deletions ansible_collections/cosmos/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: binarybuilders
name: cosmos

# The version of the collection. Must be compatible with semantic versioning
version: 1.0.0
version: 1.1.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand All @@ -22,7 +22,7 @@ authors:

### OPTIONAL but strongly recommended
# A short summary description of the collection
description: roles to configure servers
description: roles for cosmos workloads

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- name: Check pingpub wallet keys | {{ item.chain }}
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node keys show pingpub --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node keys show pingpub --home /config"
workdir: /app
register: check_wallet
changed_when: false
Expand All @@ -27,14 +27,14 @@
when: check_wallet.rc != 0
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node keys add pingpub --recover --source=/config/pingpub_mnemonic.txt --home=/config
command: "{{ testnet_services_command_prefix | default('') }}./node keys add pingpub --recover --source=/config/pingpub_mnemonic.txt --home=/config"
workdir: /app

- name: Check pingpub wallet keys | {{ item.chain }}
when: check_wallet.rc != 0
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node keys show pingpub --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node keys show pingpub --home /config"
workdir: /app
register: check_wallet2

Expand All @@ -46,7 +46,7 @@
- name: Check funds on pingpub wallet | {{ item.chain }}
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node query bank balances pingpub --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node query bank balances pingpub --home /config"
workdir: /app
changed_when: false
register: balances
Expand All @@ -67,7 +67,7 @@
- name: Get pingpub keys | {{ item.chain }}
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node keys show pingpub --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node keys show pingpub --home /config"
workdir: /app
register: pingpub_key
changed_when: false
Expand All @@ -76,6 +76,6 @@
when: (stake_amount | int) < 50000000
containers.podman.podman_container_exec:
name: "{{ item.chain }}-node"
command: ./node tx bank send {{ item.address }} {{ (pingpub_key.stdout | from_yaml)[0].address }} 50000000stake --from faucet --yes --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node tx bank send {{ item.address }} {{ (pingpub_key.stdout | from_yaml)[0].address }} 50000000stake --from faucet --yes --home /config"
workdir: /app
changed_when: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Get faucet keys | {{ item }}
containers.podman.podman_container_exec:
name: "{{ item }}-node"
command: ./node keys show faucet --home /config
command: "{{ testnet_services_command_prefix | default('') }}./node keys show faucet --home /config"
workdir: /app
register: faucet_key
loop: "{{ testnet_services_testnets }}"
Expand Down

0 comments on commit bfa9ff3

Please sign in to comment.