-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guido Iaquinti
committed
Nov 18, 2021
1 parent
7fdca55
commit 0d591cf
Showing
2 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
@@ -7,8 +16,8 @@ name: e2e - DigitalOcean (1-click) | |
# | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# branches: | ||
# - main | ||
|
||
jobs: | ||
do-install: | ||
|
@@ -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 }} \ | ||
|
@@ -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: | ||
|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters