Skip to content

Don't include previewctl in dev image #14795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion .werft/aks-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/cleanup-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/eks-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/gke-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/ide-integration-tests-startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions .werft/jobs/build/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion .werft/k3s-installer-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .werft/platform-delete-preview-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion .werft/platform-delete-preview-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/platform-delete-preview-environments-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/platform-trigger-artificial-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/platform-trigger-werft-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .werft/workspace-run-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions dev/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion dev/image/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ packages:
deps:
- dev/gpctl:app
- dev/kubecdl:app
- dev/preview/previewctl:cli
argdeps:
- imageRepoBase
srcs:
Expand Down
9 changes: 5 additions & 4 deletions dev/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

FROM gitpod/workspace-full:2022-11-09-13-54-49

ENV TRIGGER_REBUILD 24
ENV TRIGGER_REBUILD 25

USER root

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion dev/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
24 changes: 23 additions & 1 deletion dev/preview/previewctl/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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