Skip to content

Commit 96f0bcc

Browse files
committed
Remove previewctl from image, install as init task instead
1 parent 162215b commit 96f0bcc

File tree

8 files changed

+40
-17
lines changed

8 files changed

+40
-17
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/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/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`,

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)