Skip to content

Commit

Permalink
dashboards backup (#13186)
Browse files Browse the repository at this point in the history
I streamlined the workflow for backing up dashboards and avoided
unnecessary fiddling of users with erigon repo branch.
  • Loading branch information
michelemodolo authored Dec 19, 2024
1 parent c6bf543 commit ee9d3fc
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions .github/workflows/backups-dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
RED: '\033[0;31m'
YELLOW: '\033[0;33m'
NOCOLOUR: '\033[0m'
ERIGON_BRANCH: main

on:
workflow_dispatch:
Expand All @@ -19,11 +20,6 @@ on:
type: string
default: main
description: 'The branch to pull the backup script from (default: main)'
ERIGON_BRANCH:
required: false
type: string
default: main
description: 'The branch to pull the erigon repo from (default: main)'

jobs:
#
Expand All @@ -32,22 +28,8 @@ jobs:
preparation:
runs-on: ubuntu-latest
environment: dashboards_backups
steps:
- name: CLONE THE ERIGON REPO from ${{ inputs.ERIGON_BRANCH }} branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.ERIGON_BRANCH }}
fetch-depth: 1
path: ${{ github.workspace }}/erigon

- name: Upload Erigon repository
uses: actions/upload-artifact@v3
with:
name: erigon-repo
path: ${{ github.workspace }}/erigon
retention-days: 1

- name: PULL THE LATEST VERSION OF BACKUP SCRIPT from ${{ inputs.TEMPLATE_BRANCH}} branch
steps:
- name: Pull backup script from ${{ inputs.TEMPLATE_BRANCH}} branch
run: |
set +x
curl -L -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3.raw" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/erigontech/scripts/contents/dashboards/dashboard-backup.sh?ref=${{ inputs.TEMPLATE_BRANCH}} -o /tmp/dashboard-backup
Expand All @@ -72,19 +54,20 @@ jobs:
DASHBOARDS_AUTH_TOKEN: ${{ secrets.DASHBOARDS_AUTH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DASHBOARDS_GIT_CONFIG: ${{ secrets.DASHBOARDS_GIT_CONFIG }}
steps:
- name: SET-UP GIT CONFIG
run: |
echo ${{ secrets.DASHBOARDS_GIT_CONFIG }} | base64 -d > $HOME/.gitconfig
- name: Download Erigon repository
uses: actions/download-artifact@v3
steps:
- name: Clone erigon from ${{ env.ERIGON_BRANCH }} branch
uses: actions/checkout@v4
with:
name: erigon-repo
path: ${{ github.workspace }}/erigon
ref: ${{ env.ERIGON_BRANCH }}
fetch-depth: 1
path: ${{ github.workspace }}/erigon

- name: Move Erigon repository to $HOME # as the backup script expects it to be there
- name: Move repository to $HOME # as the backup script expects it to be there
run: mv ${{ github.workspace }}/erigon $HOME/

- name: Set-up git
run: |
echo ${{ secrets.DASHBOARDS_GIT_CONFIG }} | base64 -d > $HOME/.gitconfig
- name: Download dashboard-backup
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -112,7 +95,6 @@ jobs:
with:
name: |
dashboard-backup
erigon-repo
- name: Bye ${{ github.actor }}
if: always()
Expand Down

0 comments on commit ee9d3fc

Please sign in to comment.