Compare commits
49 commits
s3-backup
...
oasis-setu
Author | SHA1 | Date | |
---|---|---|---|
656f3b4fc4 | |||
684bd4c5e6 | |||
fc069b3d84 | |||
973a0c1630 | |||
f862dba1f2 | |||
8723efbe94 | |||
936984d107 | |||
30c126de33 | |||
642ca1ff5f | |||
112f948741 | |||
5173e5f7a8 | |||
b860d1e284 | |||
a15d16e4d2 | |||
486de9afd3 | |||
b31e229b84 | |||
4b035f4b8e | |||
70c79a1171 | |||
38622e122e | |||
c065e05588 | |||
5a3ef3be18 | |||
171bbfaf69 | |||
ccc1c48951 | |||
b0538f2232 | |||
15fc42183f | |||
16a0461d97 | |||
0b1c4cb212 | |||
4ed43f40be | |||
f3a4f82368 | |||
![]() |
0c0670a908 | ||
![]() |
902de144dc | ||
636bb98d2f | |||
e8f5a00cef | |||
08b815286f | |||
7cbaae0be3 | |||
6f64a8a9ff | |||
cb90f85f92 | |||
c021ec21ba | |||
6b1260fa4b | |||
3d7e62eb30 | |||
a4697b2655 | |||
![]() |
fec0d92bbe | ||
![]() |
b59a89cf52 | ||
![]() |
e7920efd42 | ||
![]() |
a704cbfd10 | ||
![]() |
dbf8182e81 | ||
![]() |
72a9c62af4 | ||
f80938e7fa | |||
![]() |
1e632a3f91 | ||
56324c2d05 |
1 changed files with 70 additions and 39 deletions
105
action.yml
105
action.yml
|
@ -1,46 +1,77 @@
|
||||||
name: "S3 Backup Action"
|
name: 'Oasis Config Action'
|
||||||
description: "Backup to S3 Bucket"
|
description: 'Configure env for deploying apps using Oasis'
|
||||||
inputs:
|
inputs:
|
||||||
infisical-token:
|
kubeconfig:
|
||||||
description: Infisical token for backup envars
|
description: 'A base64 encoded string of the kubeconfig to use. Required!'
|
||||||
required: true
|
required: true
|
||||||
infisical-project:
|
forgejo-token:
|
||||||
description: Infisical Project
|
description: 'Forgejo token for downloading repositories'
|
||||||
required: true
|
|
||||||
s3-backup-path:
|
|
||||||
description: "Workspace to setup Oasis"
|
|
||||||
required: false
|
required: false
|
||||||
default: backups/forgejo-repositories/${{ gitea.repository }}
|
default: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN }} # Action can't read env, so we need to reset it later
|
||||||
|
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:
|
||||||
# Checkout Repository
|
# Set additional Envars
|
||||||
- name: Checkout Repository
|
- name: Setting Short Commit Sha
|
||||||
|
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:
|
||||||
path: repo
|
repository: "elysium/oasis"
|
||||||
# Load Backup Envars
|
path: ${{ inputs.oasis-workspace }}
|
||||||
- name: Setup Backup Envars
|
token: ${{ env.DEVOPS_FORGEJO_ELYSIUM_ORG_READ_TOKEN }}
|
||||||
uses: https://forgejo.dunemask.dev/elysium/elysium-actions@infisical-env
|
ref: ${{ inputs.oasis-branch }}
|
||||||
with:
|
- name: Download Garden
|
||||||
infisical-token: ${{ inputs.infisical-token }}
|
shell: bash
|
||||||
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:
|
||||||
STORAGE_SERVICE_URL: ${{ env.BACKUP_S3_ENDPOINT }}
|
GARDEN_BIN_VERSION: ${{ inputs.garden-version }}
|
||||||
ACCESS_KEY_ID: ${{ env.BACKUP_S3_KEY_ID }}
|
GARDEN_DIR: ${{ runner.temp }}/garden
|
||||||
SECRET_ACCESS_KEY: ${{ env.BACKUP_S3_KEY }}
|
run: |
|
||||||
MIRROR_TARGET: ${{ inputs.s3-backup-path }}
|
# Install Garden
|
||||||
MIRROR_SOURCE: repo
|
mkdir -p "$GARDEN_DIR"
|
||||||
with:
|
cd "$GARDEN_DIR"
|
||||||
args: --overwrite --remove
|
if ! [ -d "$GARDEN_BIN_VERSION" ]; then
|
||||||
|
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