Skip to content

Commit 80317ca

Browse files
geroplona-agent
andauthored
[preview] Fix preview environment workflows (#21237)
* [preview] Add container to GC delete job The delete job was missing the container specification, causing 'leeway: command not found' errors. Use the same dev-environment container as the stale job. Co-authored-by: Ona <no-reply@ona.com> * [preview] Convert Docker actions to composite actions Convert preview-create, deploy-gitpod, and deploy-monitoring-satellite from Docker-based actions to composite actions. This fixes GCP OIDC authentication failures caused by credential file permission issues when Docker actions mount the workspace. Docker actions run in isolated containers where the credentials file path from the host doesn't match the container's filesystem, and file permissions prevent access. Composite actions run in the same context as the job, avoiding these issues. Changes: - Convert 3 Docker actions to composite actions - Add container spec to infrastructure/install/monitoring jobs in: - build.yml - branch-build.yml - ide-integration-tests.yml - workspace-integration-tests.yml - preview-env-check-regressions.yml - Remove unused inputs (infrastructure_provider, image_repo_base, previewctl_hash) from action calls Co-authored-by: Ona <no-reply@ona.com> * [preview] Add container to delete jobs Add missing container specification to delete jobs in: - ide-integration-tests.yml - workspace-integration-tests.yml - preview-env-check-regressions.yml The delete-preview action is a composite action that requires leeway, which is only available in the dev-environment container. Co-authored-by: Ona <no-reply@ona.com> * [dev] Align leeway config between CI and workspace/environment --------- Co-authored-by: Ona <no-reply@ona.com>
1 parent 496a5e7 commit 80317ca

20 files changed

Lines changed: 194 additions & 176 deletions

.github/actions/deploy-gitpod/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: "Deploy Gitpod"
2+
description: "Deploys Gitpod to an existing preview environment"
3+
inputs:
4+
name:
5+
description: "The name of the preview environment to deploy Gitpod to"
6+
required: false
7+
version:
8+
description: "The version of Gitpod to install"
9+
required: true
10+
with_dedicated_emu:
11+
description: "Dedicated Config"
12+
required: false
13+
analytics:
14+
description: "With analytics"
15+
required: false
16+
workspace_feature_flags:
17+
description: "Workspace feature flags"
18+
required: false
19+
image_repo_base:
20+
description: "The base repository for image"
21+
required: false
22+
outputs:
23+
report:
24+
description: "Preview environment report (base64 encoded)"
25+
value: ${{ steps.deploy.outputs.report }}
26+
runs:
27+
using: "composite"
28+
steps:
29+
- name: Install previewctl
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
leeway run dev/preview/previewctl:install
34+
35+
- name: Deploy Gitpod
36+
id: deploy
37+
shell: bash
38+
env:
39+
INPUT_NAME: ${{ inputs.name }}
40+
INPUT_VERSION: ${{ inputs.version }}
41+
INPUT_WITH_DEDICATED_EMU: ${{ inputs.with_dedicated_emu }}
42+
INPUT_ANALYTICS: ${{ inputs.analytics }}
43+
INPUT_WORKSPACE_FEATURE_FLAGS: ${{ inputs.workspace_feature_flags }}
44+
INPUT_IMAGE_REPO_BASE: ${{ inputs.image_repo_base }}
45+
run: |
46+
set -euo pipefail
47+
48+
export VERSION="${INPUT_VERSION}"
49+
export IMAGE_REPO_BASE="${INPUT_IMAGE_REPO_BASE}"
50+
51+
echo "Downloading installer for ${VERSION}"
52+
oci-tool fetch file -o /tmp/installer --platform=linux-amd64 "${IMAGE_REPO_BASE}/installer:${VERSION}" app/installer
53+
chmod +x /tmp/installer
54+
export PATH="/tmp:$PATH"
55+
56+
echo "Download versions.yaml"
57+
oci-tool fetch file -o /tmp/versions.yaml --platform=linux-amd64 "${IMAGE_REPO_BASE}/versions:${VERSION}" versions.yaml
58+
59+
PREVIEW_NAME="$(previewctl get-name --branch "${INPUT_NAME}")"
60+
export PREVIEW_NAME
61+
62+
for var in WITH_DEDICATED_EMU ANALYTICS WORKSPACE_FEATURE_FLAGS; do
63+
input_var="INPUT_${var}"
64+
if [[ -n "${!input_var:-}" ]]; then
65+
export "GITPOD_${var}"="${!input_var}"
66+
fi
67+
done
68+
69+
previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 10m
70+
leeway run dev/preview:deploy-gitpod
71+
previewctl report --branch "${PREVIEW_NAME}" >> "${GITHUB_STEP_SUMMARY}"
72+
73+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
74+
report=$(previewctl report --branch "${PREVIEW_NAME}" | base64)
75+
{
76+
echo "report<<$EOF"
77+
echo "$report"
78+
echo "$EOF"
79+
} >> "$GITHUB_OUTPUT"

.github/actions/deploy-gitpod/entrypoint.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/actions/deploy-gitpod/metadata.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/actions/deploy-monitoring-satellite/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Deploy monitoring satellite"
2+
description: "Deploys monitoring satellite to an existing preview environment"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Install previewctl
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
leeway run dev/preview/previewctl:install
11+
12+
- name: Deploy monitoring satellite
13+
shell: bash
14+
run: |
15+
set -euo pipefail
16+
17+
echo "previewctl install-context"
18+
previewctl install-context --log-level debug --timeout 10m
19+
20+
echo "leeway run dev/preview:deploy-monitoring-satellite"
21+
leeway run dev/preview:deploy-monitoring-satellite
22+
23+
{
24+
echo '<p>Monitoring satellite has been installed in your preview environment.</p>'
25+
echo '<ul>'
26+
echo '<li><b>📚 Documentation</b> - See our <a href="https://www.notion.so/gitpod/f2938b2bcb0c4c8c99afe1d2b872380e" target="_blank">internal documentation</a> on how to use it.</li>'
27+
echo '</ul>'
28+
} >> "${GITHUB_STEP_SUMMARY}"

.github/actions/deploy-monitoring-satellite/entrypoint.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/actions/deploy-monitoring-satellite/metadata.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/actions/preview-create/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Create preview environment"
2+
description: "Creates the infrastructure for a preview environment"
3+
inputs:
4+
name:
5+
description: "The name of the preview environment to deploy Gitpod to"
6+
required: false
7+
large_vm:
8+
description: "Whether to use a larger VM for the env"
9+
required: false
10+
default: "false"
11+
preemptible:
12+
description: "Whether to use preemptible VMs for the env"
13+
required: false
14+
default: "true"
15+
recreate_vm:
16+
description: "Whether to recreate the VM"
17+
required: false
18+
default: "false"
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Install previewctl
23+
shell: bash
24+
run: |
25+
set -euo pipefail
26+
leeway run dev/preview/previewctl:install
27+
28+
- name: Create preview environment
29+
shell: bash
30+
env:
31+
INPUT_NAME: ${{ inputs.name }}
32+
INPUT_LARGE_VM: ${{ inputs.large_vm }}
33+
INPUT_PREEMPTIBLE: ${{ inputs.preemptible }}
34+
run: |
35+
set -euo pipefail
36+
37+
TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
38+
export TF_VAR_preview_name
39+
export TF_VAR_with_large_vm="${INPUT_LARGE_VM}"
40+
export TF_VAR_gce_use_spot="${INPUT_PREEMPTIBLE}"
41+
export TF_INPUT=0
42+
export TF_IN_AUTOMATION=true
43+
44+
leeway run dev/preview:create-preview

0 commit comments

Comments
 (0)