Compare commits
22 commits
oasis-setu
...
s3-backup
Author | SHA1 | Date | |
---|---|---|---|
bf54b80924 | |||
b8805d941b | |||
f3acd807bf | |||
181c35fac5 | |||
f4f89dad0d | |||
f0038b6b69 | |||
962ca38ff9 | |||
ba73b418a8 | |||
30096f817f | |||
bb8787fded | |||
1e3c32b3e7 | |||
75bd9ebc6d | |||
8fd38af4f8 | |||
8646f62cbe | |||
41d4305f3a | |||
2dc6d1bbd1 | |||
02ebb4634f | |||
4d55f5c1e7 | |||
7b513727bb | |||
26eff76d90 | |||
881621c35c | |||
![]() |
3dbcf39ece |
1 changed files with 39 additions and 70 deletions
105
action.yml
105
action.yml
|
@ -1,77 +1,46 @@
|
||||||
name: 'Oasis Config Action'
|
name: "S3 Backup Action"
|
||||||
description: 'Configure env for deploying apps using Oasis'
|
description: "Backup to S3 Bucket"
|
||||||
inputs:
|
inputs:
|
||||||
kubeconfig:
|
infisical-token:
|
||||||
description: 'A base64 encoded string of the kubeconfig to use. Required!'
|
description: Infisical token for backup envars
|
||||||
required: true
|
required: true
|
||||||
forgejo-token:
|
infisical-project:
|
||||||
description: 'Forgejo token for downloading repositories'
|
description: Infisical Project
|
||||||
|
required: true
|
||||||
|
s3-backup-path:
|
||||||
|
description: "Workspace to setup Oasis"
|
||||||
required: false
|
required: false
|
||||||
default: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN }} # Action can't read env, so we need to reset it later
|
default: backups/forgejo-repositories/${{ gitea.repository }}
|
||||||
garden-version:
|
|
||||||
description: 'Version of Garden to deploy'
|
|
||||||
required: false
|
|
||||||
default: 0.13.29
|
|
||||||
oasis-branch:
|
|
||||||
description: 'Branch of Oasis to use'
|
|
||||||
required: false
|
|
||||||
default: master
|
|
||||||
oasis-workspace:
|
|
||||||
descipriont: 'Workspace to setup Oasis'
|
|
||||||
required: false
|
|
||||||
default: ${{ gitea.workspace }}/oasis
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
# Set additional Envars
|
# Checkout Repository
|
||||||
- name: Setting Short Commit Sha
|
- name: Checkout Repository
|
||||||
run: echo SHORT_COMMIT_SHA=$(echo $GITHUB_SHA | cut -c 1-6) >> $GITHUB_ENV
|
|
||||||
- name: Setup Enviornment Variables
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo CI_NAMESPACE=ci-$SHORT_COMMIT_SHA >> $GITHUB_ENV
|
|
||||||
echo DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN=${{ inputs.forgejo-token }} >> $GITHUB_ENV
|
|
||||||
echo "Checking out Oasis"
|
|
||||||
# Checkout Oasis
|
|
||||||
- name: Checkout Oasis
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: "elysium/oasis"
|
path: repo
|
||||||
path: ${{ inputs.oasis-workspace }}
|
# Load Backup Envars
|
||||||
token: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN }}
|
- name: Setup Backup Envars
|
||||||
ref: ${{ inputs.oasis-branch }}
|
uses: https://forgejo.dunemask.dev/elysium/elysium-actions@infisical-env
|
||||||
- name: Download Garden
|
with:
|
||||||
shell: bash
|
infisical-token: ${{ inputs.infisical-token }}
|
||||||
|
project-id: ${{ inputs.infisical-project }}
|
||||||
|
secret-envs: edge
|
||||||
|
secret-paths: /devops/forgejo-backups
|
||||||
|
# Fix Envar Format
|
||||||
|
- name: Fix Env Format
|
||||||
|
run: |
|
||||||
|
echo BACKUP_S3_ENDPOINT=${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_S3_ENDPOINT }} >> $GITHUB_ENV
|
||||||
|
echo BACKUP_S3_KEY_ID=${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_S3_KEY_ID }} >> $GITHUB_ENV
|
||||||
|
echo BACKUP_S3_KEY=${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_S3_KEY }} >> $GITHUB_ENV
|
||||||
|
# Backup Repository
|
||||||
|
- name: S3 Backup
|
||||||
|
uses: https://github.com/peter-evans/s3-backup@v1
|
||||||
env:
|
env:
|
||||||
GARDEN_BIN_VERSION: ${{ inputs.garden-version }}
|
STORAGE_SERVICE_URL: ${{ env.BACKUP_S3_ENDPOINT }}
|
||||||
GARDEN_DIR: ${{ runner.temp }}/garden
|
ACCESS_KEY_ID: ${{ env.BACKUP_S3_KEY_ID }}
|
||||||
run: |
|
SECRET_ACCESS_KEY: ${{ env.BACKUP_S3_KEY }}
|
||||||
# Install Garden
|
MIRROR_TARGET: ${{ inputs.s3-backup-path }}
|
||||||
mkdir -p "$GARDEN_DIR"
|
MIRROR_SOURCE: repo
|
||||||
cd "$GARDEN_DIR"
|
with:
|
||||||
if ! [ -d "$GARDEN_BIN_VERSION" ]; then
|
args: --overwrite --remove
|
||||||
echo "Downloading ${GARDEN_BIN_VERSION}..."
|
|
||||||
if [[ "$GARDEN_BIN_VERSION" = "latest" ]]; then
|
|
||||||
tag_param=""
|
|
||||||
else
|
|
||||||
tag_param="$GARDEN_BIN_VERSION"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
curl -sL https://get.garden.io/install.sh | bash -s -- $tag_param
|
|
||||||
echo PATH=$PATH:$HOME/.garden/bin >> $GITHUB_ENV
|
|
||||||
git config --global --add safe.directory $HOME/.garden/bin/static
|
|
||||||
echo "Finished intalling Garden!"
|
|
||||||
# Configure K&S
|
|
||||||
- name: Configure K8S
|
|
||||||
run: |
|
|
||||||
echo "Setup kubeconfig"
|
|
||||||
mkdir -p ~/.kube &&
|
|
||||||
echo ${{ inputs.kubeconfig }} | base64 -d > ~/.kube/config &&
|
|
||||||
chmod 700 ~/.kube/config
|
|
||||||
echo "Finished setting up kubeconfig"
|
|
||||||
- name: Export Envars
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
# Export environment variables
|
|
||||||
echo OASIS_WORKSPACE=${{ inputs.oasis-workspace }} >> $GITHUB_ENV
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue