Skip to content
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

Fix integration test execution #18290

Closed
wants to merge 14 commits into from
Closed
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
9 changes: 0 additions & 9 deletions .github/actions/delete-preview/Dockerfile

This file was deleted.

27 changes: 27 additions & 0 deletions .github/actions/delete-preview/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Delete preview environment

inputs:
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
name:
description: "The name of the preview environment"
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- name: Deletes a preview environment
shell: bash
run: |
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

export TF_INPUT=0
export TF_IN_AUTOMATION=true
TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
export TF_VAR_preview_name

leeway run dev/preview:delete-preview
25 changes: 0 additions & 25 deletions .github/actions/delete-preview/entrypoint.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/actions/delete-preview/metadata.yml

This file was deleted.

7 changes: 1 addition & 6 deletions .github/actions/deploy-gitpod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-new-dev-image-gha.13182

USER root
ENV OCI_TOOL_VERSION="0.2.0"
RUN curl -fsSL https://github.com/csweichel/oci-tool/releases/download/v${OCI_TOOL_VERSION}/oci-tool_${OCI_TOOL_VERSION}_linux_amd64.tar.gz | tar xz -C /usr/local/bin && chmod +x /usr/local/bin/oci-tool
USER gitpod
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-token-gha.13623

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
12 changes: 3 additions & 9 deletions .github/actions/deploy-gitpod/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@

set -euo pipefail

export HOME=/home/gitpod
export PREVIEW_ENV_DEV_SA_KEY_PATH="$HOME/.config/gcloud/preview-environment-dev-sa.json"
# shellcheck disable=SC2155
export LEEWAY_WORKSPACE_ROOT="$(pwd)"
export VERSION="${INPUT_VERSION}"
export PATH="$PATH:$HOME/bin"

mkdir $HOME/bin
mkdir "$HOME/bin"

echo "Downloading installer for ${VERSION}"
oci-tool fetch file -o $HOME/bin/installer --platform=linux-amd64 "eu.gcr.io/gitpod-core-dev/build/installer:${VERSION}" app/installer
chmod +x $HOME/bin/installer
oci-tool fetch file -o "$HOME/bin/installer" --platform=linux-amd64 "eu.gcr.io/gitpod-core-dev/build/installer:${VERSION}" app/installer
chmod +x "$HOME/bin/installer"

echo "Download versions.yaml"
oci-tool fetch file -o /tmp/versions.yaml --platform=linux-amd64 "eu.gcr.io/gitpod-core-dev/build/versions:${VERSION}" versions.yaml

echo "${INPUT_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

leeway run dev/preview/previewctl:download

echo "Setting up access to core-dev and harvester"
previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

Expand Down
46 changes: 20 additions & 26 deletions .github/actions/deploy-gitpod/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
name: "Deploy Gitpod"
description: "Deploys Gitpod to an existing preview environment"
inputs:
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
name:
description: "The name of the preview environment to deploy Gitpod to"
required: false
version:
description: "The version of Gitpod to install"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
with_dedicated_emu:
description: "Dedicated Config"
required: false
with_ee_licencse:
description: "Use EE license"
required: false
analytics:
description: "With analytics"
required: false
workspace_feature_flags:
description: "Workspace feature flags"
required: false
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
name:
description: "The name of the preview environment to deploy Gitpod to"
required: false
version:
description: "The version of Gitpod to install"
required: true
with_dedicated_emu:
description: "Dedicated Config"
required: false
analytics:
description: "With analytics"
required: false
workspace_feature_flags:
description: "Workspace feature flags"
required: false
runs:
using: "docker"
image: "Dockerfile"
using: "docker"
image: "Dockerfile"
7 changes: 1 addition & 6 deletions .github/actions/deploy-monitoring-satellite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-new-dev-image-gha.13182

USER root
ENV OCI_TOOL_VERSION="0.2.0"
RUN curl -fsSL https://github.com/csweichel/oci-tool/releases/download/v${OCI_TOOL_VERSION}/oci-tool_${OCI_TOOL_VERSION}_linux_amd64.tar.gz | tar xz -C /usr/local/bin && chmod +x /usr/local/bin/oci-tool
USER gitpod
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-token-gha.13623

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
8 changes: 1 addition & 7 deletions .github/actions/deploy-monitoring-satellite/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@

set -euo pipefail

export HOME=/home/gitpod
export PREVIEW_ENV_DEV_SA_KEY_PATH="$HOME/.config/gcloud/preview-environment-dev-sa.json"
# shellcheck disable=SC2155
export LEEWAY_WORKSPACE_ROOT="$(pwd)"
export PATH="$PATH:$HOME/bin"

mkdir $HOME/bin
mkdir "$HOME/bin"

echo "${INPUT_SA_KEY}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

leeway run dev/preview/previewctl:download

echo "previewctl get-credentials"
previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"

Expand Down
14 changes: 6 additions & 8 deletions .github/actions/deploy-monitoring-satellite/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: "Deploy monitoring satellite"
description: "Deploys monitoring satellite to an existing preview environment"
inputs:
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true

runs:
using: "docker"
image: "Dockerfile"
using: "docker"
image: "Dockerfile"
7 changes: 1 addition & 6 deletions .github/actions/preview-create/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-new-dev-image-gha.13182

USER root
ENV OCI_TOOL_VERSION="0.2.0"
RUN curl -fsSL https://github.com/csweichel/oci-tool/releases/download/v${OCI_TOOL_VERSION}/oci-tool_${OCI_TOOL_VERSION}_linux_amd64.tar.gz | tar xz -C /usr/local/bin && chmod +x /usr/local/bin/oci-tool
USER gitpod
FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:aledbf-token-gha.13623

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
31 changes: 13 additions & 18 deletions .github/actions/preview-create/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
#!/usr/bin/env bash
# shellcheck disable=SC2155

set -euo pipefail
set -x

export HOME=/home/gitpod
export PREVIEW_ENV_DEV_SA_KEY_PATH="$HOME/.config/gcloud/preview-environment-dev-sa.json"
# shellcheck disable=SC2155
export LEEWAY_WORKSPACE_ROOT="$(pwd)"
export PATH="$PATH:$HOME/bin"
mkdir -p "$HOME/.kube"
export KUBECONFIG="$HOME/.kube/config"

mkdir $HOME/bin
CREDENTIALS_FILE=$(mktemp)
echo "${INPUT_SA_KEY}" >> "${CREDENTIALS_FILE}"
export PREVIEW_ENV_DEV_SA_KEY_PATH="${CREDENTIALS_FILE}"

echo "${INPUT_SA_KEY}" >"${PREVIEW_ENV_DEV_SA_KEY_PATH}"
gcloud auth activate-service-account --key-file "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
gcloud auth activate-service-account --key-file "${CREDENTIALS_FILE}"

leeway run dev/preview/previewctl:download
previewctl get-credentials --gcp-service-account "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
previewctl get-credentials --gcp-service-account "${CREDENTIALS_FILE}"
previewctl install-context --gcp-service-account "${CREDENTIALS_FILE}" --timeout 10m

replace="module.preview_gce[0].google_compute_instance.default"
if [[ "${INPUT_INFRASTRUCTURE_PROVIDER}" = "harvester " ]]; then
replace="module.preview_harvester[0].harvester_virtualmachine.harvester"
fi

if [[ "${INPUT_RECREATE_VM:-x}" == "true" ]]; then
export TF_CLI_ARGS_plan="-replace=${replace}"
export TF_CLI_ARGS_plan="-replace=${replace}"
fi

TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
export TF_VAR_preview_name
export TF_VAR_infra_provider="${INPUT_INFRASTRUCTURE_PROVIDER}"
export TF_VAR_with_large_vm="${INPUT_LARGE_VM}"
export TF_VAR_preview_name="$(previewctl get-name --branch "${INPUT_NAME}")"
export TF_INPUT=0
export TF_IN_AUTOMATION=true

leeway run dev/preview:create-preview
42 changes: 18 additions & 24 deletions .github/actions/preview-create/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
name: "Create preview environment"
description: "Creates the infrastructure for a preview environment"
name: "Deploy monitoring satellite"
description: "Deploys monitoring satellite to an existing preview environment"
inputs:
name:
description: "The name of the preview environment to deploy Gitpod to"
required: false
infrastructure_provider:
description: "The infrastructure provider to use"
required: true
large_vm:
description: "Whether to use a larger VM for the env"
required: true
default: false
sa_key:
description: "The service account key to use when authenticating with GCP"
required: true
previewctl_hash:
description: "The Leeway hash of the dev/preview/previewctl:docker package to be used when downloading previewclt"
required: false
recreate_vm:
description: "Whether to recreate the VM"
required: false
default: "false"
name:
description: "The name of the preview environment to deploy Gitpod to"
required: false
recreate_vm:
description: "Whether to recreate the VM"
required: false
default: "false"
sa_key:
description: "GCP service account"
required: true
leeway_segment_key:
description: "leeway analytics key"
required: true

runs:
using: "docker"
image: "Dockerfile"
using: "docker"
image: "Dockerfile"
35 changes: 18 additions & 17 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@ runs:
shell: bash
run: |
gcloud auth activate-service-account --key-file ${{ steps.auth.outputs.credentials_file_path }}
- id: env-vars
name: configure env variables
gcloud auth configure-docker eu.gcr.io --quiet
- id: create-env-file
name: Create .env file
shell: bash
run: |
SA_KEY_FILE=$(mktemp)
echo "${{ inputs.sa_key }}" > "$SA_KEY_FILE"

trap 'rm -f ${SA_KEY_FILE}' EXIT
ENV_DIRECTORY=$(mktemp -d)

gcloud auth configure-docker eu.gcr.io --quiet
cp "${{ steps.auth.outputs.credentials_file_path }}" "$ENV_DIRECTORY"

PREVIEW_ENV_DEV_SA_KEY_PATH="$GITHUB_WORKSPACE/.config/gcloud/preview-environment-dev-sa.json"
echo "creating .env file"
cat <<EOF >$ENV_DIRECTORY/.env
LEEWAY_SEGMENT_KEY=${{ inputs.leeway_segment_key }}
LEEWAY_WORKSPACE_ROOT=$GITHUB_WORKSPACE
PREVIEW_ENV_DEV_SA_KEY_PATH=$ENV_DIRECTORY/$(basename ${{ steps.auth.outputs.credentials_file_path }})
EOF

{
echo "LEEWAY_SEGMENT_KEY=${{ inputs.leeway_segment_key }}"
echo "LEEWAY_WORKSPACE_ROOT=$GITHUB_WORKSPACE"
echo "PREVIEW_ENV_DEV_SA_KEY_PATH=${PREVIEW_ENV_DEV_SA_KEY_PATH}"
} >> "$GITHUB_ENV"

# Authenticate with GCP so we can use the Leeway cache
mkdir -p "$(dirname "$PREVIEW_ENV_DEV_SA_KEY_PATH")"
echo "${{ inputs.sa_key }}" > "${PREVIEW_ENV_DEV_SA_KEY_PATH}"
echo "ENV_DIRECTORY=$ENV_DIRECTORY" >> "$GITHUB_ENV"
- id: load-env-file
name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: ${{ env.ENV_DIRECTORY }}
load-mode: strict
3 changes: 0 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ gitpod:summary
- [ ] /werft with-local-preview
If enabled this will build `install/preview`
- [ ] /werft with-preview
- [ ] /werft with-large-vm
- [ ] /werft with-gce-vm
If enabled this will create the environment on GCE infra
- [ ] with-integration-tests=all
Valid options are `all`, `workspace`, `webapp`, `ide`, `jetbrains`, `vscode`, `ssh`
- [ ] with-monitoring
Expand Down
Loading
Loading