-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zeitgeist Client Update Automation (#944)
* Add client-auto-update.yml (#924) * Add scripts/ansible/client-auto-update-playbook.yml (#924) * Include step to update image version of existing network spec in OnFinality (#924) * Include logic if non-existent (#924) * Change backup Zeitgeist_parachain binary Co-authored-by: Harald Heckmann <[email protected]> * Trigger workflow based on tags (#924) Co-authored-by: Harald Heckmann <[email protected]> * Trigger workflow based on tags (#924) Co-authored-by: Harald Heckmann <[email protected]> * Add workflow steps to update Zeitgeist and battery_station image (#924) Co-authored-by: Harald Heckmann <[email protected]> * Modify client-auto-update-playbook.yml (#924) * Update v0.3.4 to v0.3.9 --------- Co-authored-by: Harald Heckmann <[email protected]>
- Loading branch information
1 parent
ea97e10
commit dedb812
Showing
3 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Deploy | ||
on: | ||
# Triggers this Action on push or pull request events on the "main" branch and when manually requested from the "Actions" tab | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- '^v[0-9]+.[0-9]+.[0-9]+$' | ||
|
||
jobs: | ||
auto-update-client: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout repository | ||
id: vars | ||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Run Ansible playbook | ||
env: | ||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | ||
uses: dawidd6/[email protected] | ||
with: | ||
playbook: scripts/ansible/client-auto-update.yml | ||
directory: ./ | ||
key: ${{ secrets.ANSIBLE_SSH_PRIVATE_KEY }} | ||
inventory: ${{ secrets.ANSIBLE_INVENTORY }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
- hosts: zeitgeist | ||
gather_facts: no | ||
become: true | ||
environment: | ||
RELEASE_VERSION: "{{ lookup('env', 'RELEASE_VERSION') }}" | ||
|
||
tasks: | ||
- name: Get Zeitgeist services | ||
no_log: true | ||
shell: ls -a /etc/systemd/system/zeitgeist* | xargs -n 1 basename | ||
register: zeitgeist_files | ||
|
||
- name: Stop Zeitgeist services | ||
no_log: true | ||
systemd: | ||
name: "{{ item }}" | ||
state: stopped | ||
with_items: "{{ zeitgeist_files.stdout_lines }}" | ||
|
||
- name: Check if Mount Dir Exists | ||
no_log: true | ||
stat: | ||
path: /mnt/ | ||
register: mnt | ||
|
||
- name: Remove Previous Zeitgeist Client in Mount Dir | ||
no_log: true | ||
shell: | | ||
cd /mnt/*/services/zeitgeist/bin | ||
rm zeitgeist | ||
when: mnt.stat.exists and mnt.stat.isdir | ||
|
||
- name: Remove Previous Zeitgeist Client | ||
no_log: true | ||
shell: | | ||
cd /services/zeitgeist/bin | ||
rm zeitgeist | ||
when: not mnt.stat.exists and mnt.stat.isdir | ||
|
||
- name: Download Zeitgeist Client to Mount Dir | ||
no_log: true | ||
shell: | | ||
cd /mnt/*/services/zeitgeist/bin | ||
if [[ -v RELEASE_VERSION ]]; then | ||
wget -O zeitgeist https://github.com/zeitgeistpm/zeitgeist/releases/download/$RELEASE_VERSION/zeitgeist_parachain | ||
else | ||
wget -O zeitgeist https://github.com/zeitgeistpm/zeitgeist/releases/download/v0.3.9/zeitgeist_parachain | ||
fi | ||
chmod 0755 zeitgeist | ||
chown zeitgeist:zeitgeist zeitgeist | ||
when: mnt.stat.exists and mnt.stat.isdir | ||
|
||
- name: Download Zeitgeist Client | ||
no_log: true | ||
shell: | | ||
cd /services/zeitgeist/bin | ||
if [[ -v RELEASE_VERSION ]]; then | ||
wget -O zeitgeist https://github.com/zeitgeistpm/zeitgeist/releases/download/$RELEASE_VERSION/zeitgeist_parachain | ||
else | ||
wget -O zeitgeist https://github.com/zeitgeistpm/zeitgeist/releases/download/v0.3.9/zeitgeist_parachain | ||
fi | ||
chmod 0755 zeitgeist | ||
chown zeitgeist:zeitgeist zeitgeist | ||
when: not mnt.stat.exists and mnt.stat.isdir | ||
|
||
- name: Start Zeitgeist Services | ||
no_log: true | ||
systemd: | ||
name: "{{ item }}" | ||
state: started | ||
with_items: "{{ zeitgeist_files.stdout_lines }}" |