mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-25 09:43:28 +03:00
ops: converting deploy action to bash script
This commit is contained in:
parent
68996b49ae
commit
9e58f6a0cb
4
.github/actions/release/Dockerfile
vendored
4
.github/actions/release/Dockerfile
vendored
@ -1,4 +0,0 @@
|
||||
FROM tloncorp/janeway:v0.16.8-dev
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
EXPOSE 22/tcp
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
32
.github/actions/release/action.yml
vendored
32
.github/actions/release/action.yml
vendored
@ -1,32 +0,0 @@
|
||||
name: 'release'
|
||||
description: 'Release to a moon'
|
||||
inputs:
|
||||
app:
|
||||
description: "App to deploy"
|
||||
required: true
|
||||
ship:
|
||||
description: "Ship to deploy to"
|
||||
required: true
|
||||
credentials:
|
||||
description: "base64-encoded GCP Service Account credentials"
|
||||
required: true
|
||||
ssh-sec-key:
|
||||
description: "A base64-encoded SSH secret key for the container to use"
|
||||
required: true
|
||||
ssh-pub-key:
|
||||
description: "The corresponding base64-encoded SSH public key"
|
||||
required: true
|
||||
ref:
|
||||
description: "The github reference to checkout when deploying"
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.app }}
|
||||
- ${{ inputs.ship }}
|
||||
- ${{ inputs.credentials }}
|
||||
- ${{ inputs.ssh-sec-key }}
|
||||
- ${{ inputs.ssh-pub-key }}
|
||||
- ${{ inputs.ref }}
|
19
.github/actions/release/entrypoint.sh
vendored
19
.github/actions/release/entrypoint.sh
vendored
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "$3" | base64 -d > /service-account
|
||||
echo "$4" | base64 -d > /id_ssh
|
||||
echo "$5" | base64 -d > /id_ssh.pub
|
||||
|
||||
chmod 600 /service-account
|
||||
chmod 600 /id_ssh
|
||||
chmod 600 /id_ssh.pub
|
||||
|
||||
janeway \
|
||||
--ci \
|
||||
--verbose \
|
||||
--credentials /service-account \
|
||||
--ssh-key /id_ssh \
|
||||
release ota \
|
||||
"$1" "$2" \
|
||||
${6:+"--ref"} ${6:+"$6"} \
|
||||
| bash
|
36
.github/helpers/deploy.sh
vendored
Normal file
36
.github/helpers/deploy.sh
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# this script deploys a desk to a ship from a github repository
|
||||
# assumes gcloud credentials are loaded and gcloud installed.
|
||||
|
||||
repo=$1
|
||||
desk=$2
|
||||
ship=$3
|
||||
zone=$4
|
||||
folder=$ship/$desk
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
cmds=$(mktemp "${TMPDIR:-/tmp/}janeway.XXXXXXXXX")
|
||||
echo '
|
||||
source_repo=$(mktemp --dry-run /tmp/repo.janeway.XXXXXXXXX)
|
||||
git clone git@github.com:'$repo'.git $source_repo
|
||||
urbit_repo=$(mktemp --dry-run /tmp/repo.urbit.XXXXXXXXX)
|
||||
git clone git@github.com:urbit/urbit.git $urbit_repo
|
||||
cd $source_repo
|
||||
git checkout .
|
||||
cd /home/urb || return
|
||||
curl -s --data '"'"'{"source":{"dojo":"+hood/mount %'$desk'"},"sink":{"app":"hood"}}'"'"' http://localhost:12321
|
||||
rsync -avL --delete $source_repo/desk/ '$folder'
|
||||
rsync -avL $urbit_repo/pkg/base-dev/ '$folder'
|
||||
curl -s --data '"'"'{"source":{"dojo":"+hood/commit %'$desk'"},"sink":{"app":"hood"}}'"'"' http://localhost:12321
|
||||
rm -rf $source_repo
|
||||
rm -rf $urbit_repo
|
||||
' >> "$cmds"
|
||||
gcloud compute \
|
||||
--project mainnet \
|
||||
ssh \
|
||||
--ssh-flag="-T" \
|
||||
--zone $4 \
|
||||
urb@$ship < "$cmds" &> /dev/null
|
||||
echo "OTA performed for $desk on $ship"
|
10
.github/workflows/deploy.yml
vendored
10
.github/workflows/deploy.yml
vendored
@ -36,10 +36,6 @@ jobs:
|
||||
with:
|
||||
add: '-A'
|
||||
message: 'update glob: ${{ steps.glob.outputs.hash }} [skip actions]'
|
||||
- uses: ./.github/actions/release
|
||||
with:
|
||||
app: 'landscape'
|
||||
ship: 'devstream'
|
||||
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
|
||||
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
|
||||
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}
|
||||
- id: deploy
|
||||
run:
|
||||
./.github/helpers/deploy.sh tloncorp/landscape landscape wannec-dozzod-marzod us-west1-b
|
Loading…
Reference in New Issue
Block a user