diff --git a/.gitpod.yml b/.gitpod.yml index 7a5e69bcf399d0..20eface069fe3f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 +image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workspaceLocation: gitpod/gitpod-ws.code-workspace checkoutLocation: gitpod ports: @@ -34,14 +34,12 @@ ports: - port: 8022 onOpen: ignore tasks: - - name: Install Preview Environment kube-context + - name: Preview environment configuration + init: | + leeway run dev/preview/previewctl:install command: | + previewctl get-credentials previewctl install-context --watch - exit - - name: Add Harvester kubeconfig - command: | - ./dev/preview/util/download-and-merge-harvester-kubeconfig.sh - exit 0 - name: Installer dependencies init: | (cd install/installer && make deps) diff --git a/.werft/aks-installer-tests.yaml b/.werft/aks-installer-tests.yaml index e3f7bbee5e3d24..c06f462b0dd57f 100644 --- a/.werft/aks-installer-tests.yaml +++ b/.werft/aks-installer-tests.yaml @@ -65,7 +65,7 @@ pod: secretName: self-hosted-github-oauth containers: - name: nightly-test - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: Always volumeMounts: diff --git a/.werft/build.yaml b/.werft/build.yaml index 71c9de69e77084..ff9bf5c3b75bf3 100644 --- a/.werft/build.yaml +++ b/.werft/build.yaml @@ -70,7 +70,7 @@ pod: - name: MYSQL_TCP_PORT value: 23306 - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent resources: diff --git a/.werft/cleanup-installer-tests.yaml b/.werft/cleanup-installer-tests.yaml index 964c9267b193d4..b3f87269a8987f 100644 --- a/.werft/cleanup-installer-tests.yaml +++ b/.werft/cleanup-installer-tests.yaml @@ -25,7 +25,7 @@ pod: secretName: aks-credentials containers: - name: nightly-test - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: Always volumeMounts: diff --git a/.werft/debug.yaml b/.werft/debug.yaml index a048fb86e46613..b12867b35ab0e1 100644 --- a/.werft/debug.yaml +++ b/.werft/debug.yaml @@ -54,7 +54,7 @@ pod: - name: MYSQL_TCP_PORT value: 23306 - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent volumeMounts: diff --git a/.werft/eks-installer-tests.yaml b/.werft/eks-installer-tests.yaml index c2f0c5da856aeb..5ab1e6f8850edd 100644 --- a/.werft/eks-installer-tests.yaml +++ b/.werft/eks-installer-tests.yaml @@ -65,7 +65,7 @@ pod: secretName: self-hosted-github-oauth containers: - name: nightly-test - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: Always volumeMounts: diff --git a/.werft/gke-installer-tests.yaml b/.werft/gke-installer-tests.yaml index 75d79e00fbd40d..a8f4bda843d9a7 100644 --- a/.werft/gke-installer-tests.yaml +++ b/.werft/gke-installer-tests.yaml @@ -65,7 +65,7 @@ pod: secretName: self-hosted-github-oauth containers: - name: nightly-test - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: Always volumeMounts: diff --git a/.werft/ide-integration-tests-startup.yaml b/.werft/ide-integration-tests-startup.yaml index ba205e4c6a3cad..40a5de89dd3e69 100644 --- a/.werft/ide-integration-tests-startup.yaml +++ b/.werft/ide-integration-tests-startup.yaml @@ -17,7 +17,7 @@ pod: secretName: github-token-gitpod-bot containers: - name: gcloud - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent env: diff --git a/.werft/jobs/build/prepare.ts b/.werft/jobs/build/prepare.ts index 9dbb6a331a7858..16258e4cb1c7cd 100644 --- a/.werft/jobs/build/prepare.ts +++ b/.werft/jobs/build/prepare.ts @@ -24,6 +24,7 @@ export async function prepare(werft: Werft, config: JobConfig) { werft.log(prepareSlices.CONFIGURE_CORE_DEV, prepareSlices.CONFIGURE_CORE_DEV); activateCoreDevServiceAccount(); configureDocker(); + installPreviewCTL(); configureStaticClustersAccess(); configureGlobalKubernetesContext(); werft.done(prepareSlices.CONFIGURE_CORE_DEV); @@ -68,6 +69,10 @@ function configureGlobalKubernetesContext() { } } +function installPreviewCTL() { + exec(`leeway run dev/preview/previewctl:install`, {slice: "Install previewctl", dontCheckRc: false}) +} + function configureStaticClustersAccess() { const rcCoreDev = exec( `KUBECONFIG=${CORE_DEV_KUBECONFIG_PATH} gcloud container clusters get-credentials core-dev --zone europe-west1-b --project gitpod-core-dev`, diff --git a/.werft/k3s-installer-tests.yaml b/.werft/k3s-installer-tests.yaml index 368b0372eae4f0..09ff7efbce45ef 100644 --- a/.werft/k3s-installer-tests.yaml +++ b/.werft/k3s-installer-tests.yaml @@ -65,7 +65,7 @@ pod: secretName: self-hosted-github-oauth containers: - name: nightly-test - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: Always volumeMounts: diff --git a/.werft/platform-delete-preview-environment.ts b/.werft/platform-delete-preview-environment.ts index 1e9a1eba2d5eec..581703d0479974 100644 --- a/.werft/platform-delete-preview-environment.ts +++ b/.werft/platform-delete-preview-environment.ts @@ -94,6 +94,7 @@ async function deletePreviewEnvironment() { } function configureGlobalKubernetesContext() { + exec(`leeway run dev/preview/previewctl:install`, {slice: "Install previewctl", dontCheckRc: false}) const rc = exec(`KUBECONFIG=${GLOBAL_KUBECONFIG_PATH} previewctl get-credentials --gcp-service-account=${GCLOUD_SERVICE_ACCOUNT_PATH}`, { slice: SLICES.CONFIGURE_K8S }).code; if (rc != 0) { diff --git a/.werft/platform-delete-preview-environment.yaml b/.werft/platform-delete-preview-environment.yaml index 5b8a966964b76f..7f569d4bcec4b9 100644 --- a/.werft/platform-delete-preview-environment.yaml +++ b/.werft/platform-delete-preview-environment.yaml @@ -25,7 +25,7 @@ pod: secretName: harvester-vm-ssh-keys containers: - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent volumeMounts: diff --git a/.werft/platform-delete-preview-environments-cron.yaml b/.werft/platform-delete-preview-environments-cron.yaml index 29373d3d91231f..51518aa1da72af 100644 --- a/.werft/platform-delete-preview-environments-cron.yaml +++ b/.werft/platform-delete-preview-environments-cron.yaml @@ -29,7 +29,7 @@ pod: secretName: github-token-gitpod-bot containers: - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent volumeMounts: diff --git a/.werft/platform-trigger-artificial-job.yaml b/.werft/platform-trigger-artificial-job.yaml index 7f169636ecd189..5dcbe36276195b 100644 --- a/.werft/platform-trigger-artificial-job.yaml +++ b/.werft/platform-trigger-artificial-job.yaml @@ -24,7 +24,7 @@ pod: secretName: github-token-gitpod-bot containers: - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent volumeMounts: diff --git a/.werft/platform-trigger-werft-cleanup.yaml b/.werft/platform-trigger-werft-cleanup.yaml index 471b76c2faf4a1..e10831d6afdc27 100644 --- a/.werft/platform-trigger-werft-cleanup.yaml +++ b/.werft/platform-trigger-werft-cleanup.yaml @@ -22,7 +22,7 @@ pod: secretName: gcp-sa-gitpod-dev-deployer containers: - name: build - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent volumeMounts: diff --git a/.werft/workspace-run-integration-tests.yaml b/.werft/workspace-run-integration-tests.yaml index bc7136adb057cc..ee223d3dc257db 100644 --- a/.werft/workspace-run-integration-tests.yaml +++ b/.werft/workspace-run-integration-tests.yaml @@ -22,7 +22,7 @@ pod: secretName: github-token-gitpod-bot containers: - name: gcloud - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12 workingDir: /workspace imagePullPolicy: IfNotPresent env: diff --git a/dev/BUILD.yaml b/dev/BUILD.yaml index 8231c81eda4e27..5ed1b0578fbf80 100644 --- a/dev/BUILD.yaml +++ b/dev/BUILD.yaml @@ -10,14 +10,12 @@ packages: - dev/blowtorch:app - dev/gpctl:app - dev/loadgen:app - - dev/preview/previewctl:cli - dev/gp-gcloud:app - name: dev-utils type: docker deps: - dev/gpctl:app - dev/kubecdl:app - - dev/preview/previewctl:cli - dev/gp-gcloud:app argdeps: - imageRepoBase diff --git a/dev/image/BUILD.yaml b/dev/image/BUILD.yaml index 65017fc01d210d..70d9f8aa3bf894 100644 --- a/dev/image/BUILD.yaml +++ b/dev/image/BUILD.yaml @@ -4,7 +4,6 @@ packages: deps: - dev/gpctl:app - dev/kubecdl:app - - dev/preview/previewctl:cli argdeps: - imageRepoBase srcs: diff --git a/dev/image/Dockerfile b/dev/image/Dockerfile index 6bf5151a0a93fe..9804cfb4b816e6 100644 --- a/dev/image/Dockerfile +++ b/dev/image/Dockerfile @@ -4,7 +4,7 @@ FROM gitpod/workspace-full:2022-11-09-13-54-49 -ENV TRIGGER_REBUILD 24 +ENV TRIGGER_REBUILD 25 USER root @@ -257,8 +257,9 @@ RUN brew install tmux tmuxinator # Copy our own tools ENV NEW_KUBECDL=1 -COPY dev-kubecdl--app/kubecdl dev-gpctl--app/gpctl dev-preview-previewctl--cli/previewctl /usr/bin/ +COPY dev-kubecdl--app/kubecdl dev-gpctl--app/gpctl /usr/bin/ # Configure our tools' autocompletion -RUN bash -c "echo . \<\(gpctl completion bash\) >> ~/.bashrc" && \ - bash -c "echo . \<\(previewctl completion bash\) >> ~/.bashrc" +RUN bash -c "echo . \<\(gpctl completion bash\) >> ~/.bashrc" + +ENV PATH=$PATH:/workspace/bin diff --git a/dev/leeway.Dockerfile b/dev/leeway.Dockerfile index cad4ec8c1117d1..d7cbc1bbf8553c 100644 --- a/dev/leeway.Dockerfile +++ b/dev/leeway.Dockerfile @@ -4,4 +4,4 @@ FROM scratch -COPY dev-gpctl--app/gpctl dev-kubecdl--app/kubecdl dev-preview-previewctl--cli/previewctl dev-gp-gcloud--app/gp-gcloud /app/ +COPY dev-gpctl--app/gpctl dev-kubecdl--app/kubecdl dev-gp-gcloud--app/gp-gcloud /app/ diff --git a/dev/preview/previewctl/BUILD.yaml b/dev/preview/previewctl/BUILD.yaml index f9b0860a3e6aeb..29a85cb696b161 100644 --- a/dev/preview/previewctl/BUILD.yaml +++ b/dev/preview/previewctl/BUILD.yaml @@ -9,4 +9,26 @@ packages: - CGO_ENABLED=0 config: packaging: app - dontTest: false +scripts: + - name: install + description: Build and install previewctl into the current environment + deps: + - :cli + script: | + set -euo pipefail + + source="$(which previewctl)" + destination="/workspace/bin/previewctl" + + mkdir -p /workspace/bin + + echo "Installing $source into $destination" + cp "$source" "$destination" + + if ! $(grep 'previewctl completion bash' ~/.bashrc > /dev/null) + then + echo "Adding bash completions to ~/.bashrc" + echo '. <(previewctl completion bash)' >> ~/.bashrc + else + echo "Bash completions already installed. Skipping." + fi