Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido Iaquinti committed Nov 18, 2021
1 parent 7fdca55 commit 0d591cf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
name: e2e - DigitalOcean (1-click)
#
# This is an e2e test to deploy PostHog on DigitalOcean using DigitalOcean's 1-click app install.
#
# TODO:
# - run k8s spec test
# - run action only when necessary
# - test the "Securing your 1-click install" https://posthog.com/docs/self-host/deploy/digital-ocean#securing-your-1-click-install
#
name: e2e - DigitalOcean "1-click" (install)

#
# Unfortunately we can test this scenario only after merging to 'main' as we don't have
# control over the branch used by the DigitalOcean's marketplace 1-click install.
Expand All @@ -7,8 +16,8 @@ name: e2e - DigitalOcean (1-click)
#
on:
push:
branches:
- main
# branches:
# - main

jobs:
do-install:
Expand All @@ -31,7 +40,7 @@ jobs:
echo "::set-output name=k8s_cluster_name::${TEST_NAME}"
- name: Deploy a new k8s cluster
id: k8s_creation
id: k8s_cluster_creation
run: |
doctl k8s clusters create \
${{ steps.vars.outputs.k8s_cluster_name }} \
Expand All @@ -56,17 +65,25 @@ jobs:
#
# ref: https://github.com/jupyterhub/action-k8s-await-workloads/issues/38
#
- name: Workaround - wait until the 'posthog' pods are ready
- name: Workaround - wait for all the k8s resources to be ready
timeout-minutes: 15
run: |
echo "Waiting for pods to be ready..."
while ! kubectl wait --for=condition=Ready pods --timeout=60s --all -n posthog > /dev/null 2>&1
do
echo " sleeping 10 seconds"
sleep 10
echo " pods are not yet ready"
done
echo "All pods are now ready!"
echo "Waiting for the DigitalOcean Load Balancer to be ready..."
load_balancer_external_ip=""
while [ -z "$load_balancer_external_ip" ];
do
load_balancer_external_ip=$(kubectl get ingress -n posthog posthog -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
[ -z "$load_balancer_external_ip" ] && echo " sleeping 10 seconds" && sleep 10
done
echo "The DigitalOcean Load Balancer is now ready!"
- name: Wait until all the resources are fully deployed in k8s
uses: jupyterhub/action-k8s-await-workloads@main
with:
Expand All @@ -77,10 +94,20 @@ jobs:
- name: Setup PostHog for the ingestion test
run: ./ci/setup_ingestion_test.sh

# - run ingestion test
# - run k8s spec test
- name: Set PostHog endpoints to use for the ingestion test
run: |
# Get the Load Balancer IP address
load_balancer_external_ip=$(kubectl get ingress -n posthog posthog -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
echo "POSTHOG_API_ENDPOINT=https://${load_balancer_external_ip}" | tee -a "$GITHUB_ENV"
echo "POSTHOG_EVENT_ENDPOINT=https://${load_balancer_external_ip}" | tee -a "$GITHUB_ENV"
- name: Run ingestion test using k6
uses: k6io/[email protected]
with:
filename: ci/k6-ingestion-test.js

- name: Delete the k8s cluster and all associated resources (LB, volumes, ...)
if: always()
if: ${{ always() && steps.k8s_cluster_creation.outcome == 'success' }}
run: |
doctl k8s cluster delete --dangerous --force ${{ steps.vars.outputs.k8s_cluster_name }}
16 changes: 9 additions & 7 deletions .github/workflows/test-digital-ocean-install.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# TODO: run k8s spec test

#
# This is an e2e test to deploy PostHog on DigitalOcean using Helm.
#
# TODO:
# - run k8s spec test
# - run action only when necessary
#
name: e2e - DigitalOcean (install)

on: push
Expand Down Expand Up @@ -70,8 +74,7 @@ jobs:
echo "Waiting for pods to be ready..."
while ! kubectl wait --for=condition=Ready pods --timeout=60s --all -n posthog > /dev/null 2>&1
do
echo " sleeping 10 seconds"
sleep 10
echo " pods are not yet ready"
done
echo "All pods are now ready!"
Expand Down Expand Up @@ -110,8 +113,7 @@ jobs:
echo "Wait for the Let's Encrypt certificate to be issued and deployed..."
while ! kubectl wait --for=condition=Ready --timeout=60s certificaterequest --all -n posthog > /dev/null 2>&1
do
echo " sleeping 10 seconds"
sleep 10
echo " certificate hasn't been yet issued and deployed"
done
echo "The certificate has been issued and it has been deployed!"
Expand Down

0 comments on commit 0d591cf

Please sign in to comment.