Skip to content

Commit

Permalink
use previewctl:install
Browse files Browse the repository at this point in the history
  • Loading branch information
iQQBot committed Apr 25, 2024
1 parent dd48b69 commit 63e5032
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .github/actions/delete-preview/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export PATH="$PATH:$HOME/bin"

mkdir $HOME/bin

leeway run dev/preview/previewctl:download
gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS" --activate --quiet
leeway run dev/preview/previewctl:install

export TF_INPUT=0
export TF_IN_AUTOMATION=true
Expand Down
3 changes: 0 additions & 3 deletions .github/actions/delete-preview/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ inputs:
name:
description: "The name of the preview environment"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
runs:
using: "docker"
image: "Dockerfile"
3 changes: 2 additions & 1 deletion .github/actions/deploy-gitpod/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ chmod +x $HOME/bin/installer
echo "Download versions.yaml"
oci-tool fetch file -o /tmp/versions.yaml --platform=linux-amd64 "${IMAGE_REPO_BASE}/versions:${VERSION}" versions.yaml

leeway run dev/preview/previewctl:download
gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS" --activate --quiet
leeway run dev/preview/previewctl:install

PREVIEW_NAME="$(previewctl get-name --branch "${INPUT_NAME}")"
export PREVIEW_NAME
Expand Down
3 changes: 0 additions & 3 deletions .github/actions/deploy-gitpod/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ inputs:
version:
description: "The version of Gitpod to install"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
with_dedicated_emu:
description: "Dedicated Config"
required: false
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/deploy-monitoring-satellite/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export PATH="$PATH:$HOME/bin"

mkdir $HOME/bin

leeway run dev/preview/previewctl:download
gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS" --activate --quiet
leeway run dev/preview/previewctl:install

echo "previewctl install-context"
previewctl install-context --log-level debug --timeout 10m
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/preview-create/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export PATH="$PATH:$HOME/bin"

mkdir $HOME/bin

leeway run dev/preview/previewctl:download
gcloud auth login --cred-file="$GOOGLE_APPLICATION_CREDENTIALS" --activate --quiet
leeway run dev/preview/previewctl:install

TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
export TF_VAR_preview_name
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/preview-create/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ inputs:
description: "Whether to use preemptible VMs for the env"
required: true
default: true
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
recreate_vm:
description: "Whether to recreate the VM"
required: false
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ jobs:
runs-on: ${{ needs.create-runner.outputs.label }}
container:
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:pd-test-new-preview-gha.24525
outputs:
previewctl_hash: ${{ steps.build.outputs.previewctl_hash }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
Expand All @@ -120,11 +118,7 @@ jobs:
env:
LEEWAY_REMOTE_CACHE_BUCKET: ${{needs.configuration.outputs.leeway_cache_bucket}}
run: |
version="${{needs.configuration.outputs.version}}"
imageRepoBase="${{needs.configuration.outputs.image_repo_base}}/build"
leeway build dev/preview/previewctl:docker -Dversion=$version -DimageRepoBase=$imageRepoBase
echo "previewctl_hash=$(leeway describe dev/preview/previewctl:docker -Dversion=$version -DimageRepoBase=$imageRepoBase -t '{{ .Metadata.Version }}')" >> $GITHUB_OUTPUT
leeway build dev/preview/previewctl:cli --cache remote
infrastructure:
needs: [ configuration, build-previewctl, create-runner ]
if: |
Expand Down
27 changes: 0 additions & 27 deletions dev/preview/previewctl/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,3 @@ scripts:
description: Build and install previewctl into the current environment
script:
leeway build dev/preview/previewctl:install -Dno-cache=$RANDOM --dont-test --cache=remote-pull
- name: download
description:
script: |
IMAGE_REPO_BASE=eu.gcr.io/gitpod-core-dev/build
if [[ -z "$INPUT_PREVIEWCTL_HASH" ]]; then
# If a specific hash isn't provided we'll use the latest image of main
PREVIEWCTL_VERSION=$(\
gcloud container images list-tags $IMAGE_REPO_BASE/previewctl \
--filter="tags:main-gha.*" \
--limit=1 \
--format=json \
| jq --raw-output '.[0].tags[0]' \
)
PREVIEWCTL_IMAGE="$IMAGE_REPO_BASE/previewctl:$PREVIEWCTL_VERSION"
else
if [[ -n "$INPUT_IMAGE_REPO_BASE" ]]; then
IMAGE_REPO_BASE=$INPUT_IMAGE_REPO_BASE
fi
PREVIEWCTL_IMAGE="$IMAGE_REPO_BASE/previewctl:hash-$INPUT_PREVIEWCTL_HASH"
fi
echo $PREVIEWCTL_IMAGE
echo "Downloading previewctl for $PREVIEWCTL_IMAGE"
oci-tool fetch file -o $HOME/bin/previewctl --platform=linux-amd64 "$PREVIEWCTL_IMAGE" app/previewctl
chmod +x $HOME/bin/previewctl
2 changes: 1 addition & 1 deletion dev/preview/workflow/preview/configure-workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ ! -f "${PREVIEW_ENV_DEV_SA_KEY_PATH}" ]; then
echo "${PREVIEW_ENV_DEV_CRED}" >"${PREVIEW_ENV_DEV_SA_KEY_PATH}"
fi

gcloud auth login --cred-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
gcloud auth login --cred-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}" --activate --quiet

if [[ -n "${INSTALL_CONTEXT:-}" ]]; then
log_info "Starting watch-loop to configure access to your preview environment"
Expand Down

0 comments on commit 63e5032

Please sign in to comment.