Remove backup for now
This commit is contained in:
Родитель
853aa91458
Коммит
738b85fe47
|
@ -1,112 +0,0 @@
|
|||
name: Backup
|
||||
run-name: ${{ github.actor }} run backup and upload to ghes-data
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
hostname:
|
||||
description: 'Hostname'
|
||||
required: true
|
||||
type: string
|
||||
ref:
|
||||
description: 'Ref'
|
||||
required: false
|
||||
type: string
|
||||
default: 'master'
|
||||
workflow_call:
|
||||
inputs:
|
||||
size:
|
||||
description: 'Size of the dataset to restore'
|
||||
required: false
|
||||
type: string
|
||||
default: 'small'
|
||||
hostname:
|
||||
description: 'Hostname of the server'
|
||||
required: true
|
||||
type: string
|
||||
ref:
|
||||
description: 'Branch ref to use'
|
||||
required: false
|
||||
type: string
|
||||
default: 'master'
|
||||
version:
|
||||
description: 'GHES Version of dataset'
|
||||
required: false
|
||||
type: string
|
||||
default: "3.8.0"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: github/backup-utils-private
|
||||
ref: ${{ inputs.ref }}
|
||||
token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}"
|
||||
- run: docker build . --file Dockerfile --tag backup-utils
|
||||
- run: docker save backup-utils -o backup-utils.tar
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: backup-utils
|
||||
path: backup-utils.tar
|
||||
backup-utils-backup:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.BACKUP_SSH_KEY }}
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: backup-utils
|
||||
- name: Load docker container
|
||||
run: docker load -i backup-utils.tar
|
||||
- uses: actions/checkout@v3
|
||||
- name: Create backup directory
|
||||
run: mkdir $HOME/ghe-backup-data
|
||||
- name: set up ssh SSH_KEY
|
||||
run: echo -e "${SSH_KEY}\n" > $HOME/backup
|
||||
- name: set up ssh key permissions
|
||||
run: chmod 0600 $HOME/backup
|
||||
- name: change version
|
||||
run: echo "3.8.0" > $HOME/version
|
||||
|
||||
- name: Perform backup
|
||||
run: |
|
||||
jq=$(command -v jq)
|
||||
export PATH=$PATH:$jq
|
||||
echo $PATH
|
||||
docker run -e "GHE_HOSTNAME=${{ inputs.hostname }}" \
|
||||
-e "GHE_DATA_DIR=/data" \
|
||||
-e "GHE_EXTRA_SSH_OPTS=-p 122 -i /ghe-ssh/id_rsa -o ServerAliveInterval=30 -o ServerAliveCountMax=12000 -o StrictHostKeyChecking=no" \
|
||||
-e "GHE_NUM_SNAPSHOTS=15" \
|
||||
-v "$HOME/ghe-backup-data:/data" \
|
||||
-v "$HOME/backup:/ghe-ssh/id_rsa" \
|
||||
-v "$HOME/version:/backup-utils/share/github-backup-utils/version" \
|
||||
--rm \
|
||||
backup-utils ghe-backup
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
path: ghes-data
|
||||
repository: github/ghes-data
|
||||
ref: main
|
||||
token: "${{ secrets.INTERNAL_ACTIONS_DX_BOT_ACCOUNT_TOKEN }}"
|
||||
lfs: 'true'
|
||||
|
||||
- name: Zip backup
|
||||
run: |
|
||||
ls -al $HOME/ghe-backup-data
|
||||
dirname=$(find $HOME/ghe-backup-data/ -type d -maxdepth 1 -mindepth 1)
|
||||
echo $dirname
|
||||
tar -czvf $dirname.tar.gz $dirname
|
||||
cp $dirname.tar.gz ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}}/$dirname.tar.gz
|
||||
|
||||
- name: Upload backup to ghes-data
|
||||
run: |
|
||||
cd ghes-data/data/backup/{{inputs.size}}/v{{inputs.version}}
|
||||
git add .
|
||||
git commit -am "Added new backup from automation"
|
||||
git push
|
||||
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче