mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* [dev-image] upgrade terraform and gcloud * update leeway version and use new cache bucket * update image tag * use oidc * fix bob * Add code web extension as package * gcr token refresh * fluentbit use service account * Add xterm web ide as package * add ide configmap patch * fix ide first page 502 * remove secret manager * fix monitoring * fix integration and delete preview * cleanup * use previewctl:install * change folder * cleanup * change leeway cache bucket for main branch * cleanup * fix * hot-deploy
50 lines
1.1 KiB
Bash
Executable File
50 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Provides SSH access to the VM where your preview environment is installed.
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
PRIVATE_KEY=$HOME/.ssh/vm_ed25519
|
|
PUBLIC_KEY=$HOME/.ssh/vm_ed25519.pub
|
|
PORT=2222
|
|
USER="ubuntu"
|
|
COMMAND=""
|
|
BRANCH=""
|
|
|
|
while getopts c:p:u:b:v: flag
|
|
do
|
|
case "${flag}" in
|
|
c) COMMAND="${OPTARG}";;
|
|
p) PORT="${OPTARG}";;
|
|
u) USER="${OPTARG}";;
|
|
v) VM_NAME="${OPTARG}";;
|
|
b) BRANCH="${OPTARG}";;
|
|
*) ;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "${VM_NAME:-}" ]; then
|
|
if [[ "${BRANCH}" == "" ]]; then
|
|
VM_NAME="$(previewctl get name)"
|
|
else
|
|
VM_NAME="$(previewctl get name --branch "$BRANCH")"
|
|
fi
|
|
fi
|
|
|
|
function set-up-ssh {
|
|
if [[ (! -f $PRIVATE_KEY) || (! -f $PUBLIC_KEY) ]]; then
|
|
echo Generate ssh-keys
|
|
ssh-keygen -t ed25519 -q -N "" -f "$PRIVATE_KEY"
|
|
fi
|
|
}
|
|
|
|
set-up-ssh
|
|
zone=$(gcloud compute instances list --project gitpod-dev-preview --format="value(zone)" preview-"$VM_NAME")
|
|
gcloud compute ssh "$USER@preview-$VM_NAME" \
|
|
--project gitpod-dev-preview \
|
|
--ssh-key-file "$PRIVATE_KEY" \
|
|
--ssh-flag="-p $PORT" \
|
|
--zone="$zone" \
|
|
-- "$COMMAND"
|