Skip to content

Commit 28ba48f

Browse files
mads-hartmannroboquat
authored andcommitted
Remove previewctl from image, install as init task instead
1 parent d14c82a commit 28ba48f

21 files changed

+53
-29
lines changed

.gitpod.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
1+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
22
workspaceLocation: gitpod/gitpod-ws.code-workspace
33
checkoutLocation: gitpod
44
ports:
@@ -34,14 +34,12 @@ ports:
3434
- port: 8022
3535
onOpen: ignore
3636
tasks:
37-
- name: Install Preview Environment kube-context
37+
- name: Preview environment configuration
38+
init: |
39+
leeway run dev/preview/previewctl:install
3840
command: |
41+
previewctl get-credentials
3942
previewctl install-context --watch
40-
exit
41-
- name: Add Harvester kubeconfig
42-
command: |
43-
./dev/preview/util/download-and-merge-harvester-kubeconfig.sh
44-
exit 0
4543
- name: Installer dependencies
4644
init: |
4745
(cd install/installer && make deps)

.werft/aks-installer-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pod:
6565
secretName: self-hosted-github-oauth
6666
containers:
6767
- name: nightly-test
68-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
68+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
6969
workingDir: /workspace
7070
imagePullPolicy: Always
7171
volumeMounts:

.werft/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pod:
7070
- name: MYSQL_TCP_PORT
7171
value: 23306
7272
- name: build
73-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
73+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
7474
workingDir: /workspace
7575
imagePullPolicy: IfNotPresent
7676
resources:

.werft/cleanup-installer-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pod:
2525
secretName: aks-credentials
2626
containers:
2727
- name: nightly-test
28-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
28+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2929
workingDir: /workspace
3030
imagePullPolicy: Always
3131
volumeMounts:

.werft/debug.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pod:
5454
- name: MYSQL_TCP_PORT
5555
value: 23306
5656
- name: build
57-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
57+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
5858
workingDir: /workspace
5959
imagePullPolicy: IfNotPresent
6060
volumeMounts:

.werft/eks-installer-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pod:
6565
secretName: self-hosted-github-oauth
6666
containers:
6767
- name: nightly-test
68-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
68+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
6969
workingDir: /workspace
7070
imagePullPolicy: Always
7171
volumeMounts:

.werft/gke-installer-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pod:
6565
secretName: self-hosted-github-oauth
6666
containers:
6767
- name: nightly-test
68-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
68+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
6969
workingDir: /workspace
7070
imagePullPolicy: Always
7171
volumeMounts:

.werft/ide-integration-tests-startup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pod:
1717
secretName: github-token-gitpod-bot
1818
containers:
1919
- name: gcloud
20-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
20+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2121
workingDir: /workspace
2222
imagePullPolicy: IfNotPresent
2323
env:

.werft/jobs/build/prepare.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export async function prepare(werft: Werft, config: JobConfig) {
2424
werft.log(prepareSlices.CONFIGURE_CORE_DEV, prepareSlices.CONFIGURE_CORE_DEV);
2525
activateCoreDevServiceAccount();
2626
configureDocker();
27+
installPreviewCTL();
2728
configureStaticClustersAccess();
2829
configureGlobalKubernetesContext();
2930
werft.done(prepareSlices.CONFIGURE_CORE_DEV);
@@ -68,6 +69,10 @@ function configureGlobalKubernetesContext() {
6869
}
6970
}
7071

72+
function installPreviewCTL() {
73+
exec(`leeway run dev/preview/previewctl:install`, {slice: "Install previewctl", dontCheckRc: false})
74+
}
75+
7176
function configureStaticClustersAccess() {
7277
const rcCoreDev = exec(
7378
`KUBECONFIG=${CORE_DEV_KUBECONFIG_PATH} gcloud container clusters get-credentials core-dev --zone europe-west1-b --project gitpod-core-dev`,

.werft/k3s-installer-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pod:
6565
secretName: self-hosted-github-oauth
6666
containers:
6767
- name: nightly-test
68-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
68+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
6969
workingDir: /workspace
7070
imagePullPolicy: Always
7171
volumeMounts:

.werft/platform-delete-preview-environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async function deletePreviewEnvironment() {
9494
}
9595

9696
function configureGlobalKubernetesContext() {
97+
exec(`leeway run dev/preview/previewctl:install`, {slice: "Install previewctl", dontCheckRc: false})
9798
const rc = exec(`KUBECONFIG=${GLOBAL_KUBECONFIG_PATH} previewctl get-credentials --gcp-service-account=${GCLOUD_SERVICE_ACCOUNT_PATH}`, { slice: SLICES.CONFIGURE_K8S }).code;
9899

99100
if (rc != 0) {

.werft/platform-delete-preview-environment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pod:
2525
secretName: harvester-vm-ssh-keys
2626
containers:
2727
- name: build
28-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
28+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2929
workingDir: /workspace
3030
imagePullPolicy: IfNotPresent
3131
volumeMounts:

.werft/platform-delete-preview-environments-cron.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pod:
2929
secretName: github-token-gitpod-bot
3030
containers:
3131
- name: build
32-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
32+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
3333
workingDir: /workspace
3434
imagePullPolicy: IfNotPresent
3535
volumeMounts:

.werft/platform-trigger-artificial-job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pod:
2424
secretName: github-token-gitpod-bot
2525
containers:
2626
- name: build
27-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
27+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2828
workingDir: /workspace
2929
imagePullPolicy: IfNotPresent
3030
volumeMounts:

.werft/platform-trigger-werft-cleanup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pod:
2222
secretName: gcp-sa-gitpod-dev-deployer
2323
containers:
2424
- name: build
25-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
25+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2626
workingDir: /workspace
2727
imagePullPolicy: IfNotPresent
2828
volumeMounts:

.werft/workspace-run-integration-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pod:
2222
secretName: github-token-gitpod-bot
2323
containers:
2424
- name: gcloud
25-
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-leeway-v0.5.2.0
25+
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:mads-dont-include-previewctl-in-image.12
2626
workingDir: /workspace
2727
imagePullPolicy: IfNotPresent
2828
env:

dev/BUILD.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ packages:
1010
- dev/blowtorch:app
1111
- dev/gpctl:app
1212
- dev/loadgen:app
13-
- dev/preview/previewctl:cli
1413
- dev/gp-gcloud:app
1514
- name: dev-utils
1615
type: docker
1716
deps:
1817
- dev/gpctl:app
1918
- dev/kubecdl:app
20-
- dev/preview/previewctl:cli
2119
- dev/gp-gcloud:app
2220
argdeps:
2321
- imageRepoBase

dev/image/BUILD.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ packages:
44
deps:
55
- dev/gpctl:app
66
- dev/kubecdl:app
7-
- dev/preview/previewctl:cli
87
argdeps:
98
- imageRepoBase
109
srcs:

dev/image/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
ENV TRIGGER_REBUILD 24
7+
ENV TRIGGER_REBUILD 25
88

99
USER root
1010

@@ -257,8 +257,9 @@ RUN brew install tmux tmuxinator
257257

258258
# Copy our own tools
259259
ENV NEW_KUBECDL=1
260-
COPY dev-kubecdl--app/kubecdl dev-gpctl--app/gpctl dev-preview-previewctl--cli/previewctl /usr/bin/
260+
COPY dev-kubecdl--app/kubecdl dev-gpctl--app/gpctl /usr/bin/
261261

262262
# Configure our tools' autocompletion
263-
RUN bash -c "echo . \<\(gpctl completion bash\) >> ~/.bashrc" && \
264-
bash -c "echo . \<\(previewctl completion bash\) >> ~/.bashrc"
263+
RUN bash -c "echo . \<\(gpctl completion bash\) >> ~/.bashrc"
264+
265+
ENV PATH=$PATH:/workspace/bin

dev/leeway.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
FROM scratch
66

7-
COPY dev-gpctl--app/gpctl dev-kubecdl--app/kubecdl dev-preview-previewctl--cli/previewctl dev-gp-gcloud--app/gp-gcloud /app/
7+
COPY dev-gpctl--app/gpctl dev-kubecdl--app/kubecdl dev-gp-gcloud--app/gp-gcloud /app/

dev/preview/previewctl/BUILD.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,26 @@ packages:
99
- CGO_ENABLED=0
1010
config:
1111
packaging: app
12-
dontTest: false
12+
scripts:
13+
- name: install
14+
description: Build and install previewctl into the current environment
15+
deps:
16+
- :cli
17+
script: |
18+
set -euo pipefail
19+
20+
source="$(which previewctl)"
21+
destination="/workspace/bin/previewctl"
22+
23+
mkdir -p /workspace/bin
24+
25+
echo "Installing $source into $destination"
26+
cp "$source" "$destination"
27+
28+
if ! $(grep 'previewctl completion bash' ~/.bashrc > /dev/null)
29+
then
30+
echo "Adding bash completions to ~/.bashrc"
31+
echo '. <(previewctl completion bash)' >> ~/.bashrc
32+
else
33+
echo "Bash completions already installed. Skipping."
34+
fi

0 commit comments

Comments
 (0)