Skip to content

Commit

Permalink
Merge branch 'main' into alfredo-d-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk authored May 24, 2023
2 parents 90b28d1 + 533a1f4 commit a38f4d6
Show file tree
Hide file tree
Showing 412 changed files with 19,688 additions and 7,550 deletions.
18 changes: 8 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Build and Release

steps:
- name: Build Plugin
image: node:14.17.0-stretch
image: node:18.16.0-buster
commands:
- apt-get update
- apt-get --assume-yes install jq
Expand All @@ -16,7 +16,7 @@ steps:
- ls ./

- name: Sign and Package Plugin
image: node:14.17.0-stretch
image: node:18.16.0-buster
environment:
GRAFANA_API_KEY:
from_secret: gcom_plugin_publisher_api_key
Expand Down Expand Up @@ -62,7 +62,7 @@ steps:
- refs/tags/v*.*.*

- name: Lint Backend
image: python:3.9
image: python:3.11.3
environment:
DJANGO_SETTINGS_MODULE: settings.ci-test
commands:
Expand All @@ -72,7 +72,7 @@ steps:
- pre-commit run flake8 --all-files

- name: Unit Test Backend
image: python:3.9
image: python:3.11.3
environment:
RABBITMQ_URI: amqp://rabbitmq:rabbitmq@rabbit_test:5672
DJANGO_SETTINGS_MODULE: settings.ci-test
Expand Down Expand Up @@ -150,7 +150,7 @@ services:
RABBITMQ_DEFAULT_PASS: rabbitmq

- name: mysql_test
image: mysql:5.7.25
image: mysql:8.0.32
environment:
MYSQL_DATABASE: oncall_local_dev
MYSQL_ROOT_PASSWORD: local_dev_pwd
Expand All @@ -174,7 +174,7 @@ name: OSS plugin release

steps:
- name: build plugin
image: node:14.17.0-stretch
image: node:18.16.0-buster
commands:
- apt-get update
- apt-get --assume-yes install jq
Expand All @@ -185,7 +185,7 @@ steps:
- ls ./

- name: sign and package plugin
image: node:14.17.0-stretch
image: node:18.16.0-buster
environment:
GRAFANA_API_KEY:
from_secret: gcom_plugin_publisher_api_key
Expand Down Expand Up @@ -418,6 +418,4 @@ kind: secret
name: drone_token
---
kind: signature
hmac: cacc05e8af3506b2e63ef878eb145eaf567045d04bb0bc24c1ef777959e496ee

...
hmac: 3ef960dd2f2a121d795f7fe0b5447f7695bf6cd8f6fe552cd4dbab15d0acc9ee
101 changes: 64 additions & 37 deletions .github/workflows/linting-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
# following 2 steps - need to install the frontend dependencies for the eslint/prettier/stylelint steps
- uses: actions/setup-node@v3
with:
node-version: 14.17.0
node-version: 18.16.0
cache: "yarn"
cache-dependency-path: grafana-plugin/yarn.lock
- name: Use cached frontend dependencies
Expand All @@ -54,7 +54,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.17.0
node-version: 18.16.0
cache: "yarn"
cache-dependency-path: grafana-plugin/yarn.lock
- name: Use cached frontend dependencies
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
ports:
- 5672:5672
mysql_test:
image: mysql:5.7.25
image: mysql:8.0.32
env:
MYSQL_DATABASE: oncall_local_dev
MYSQL_ROOT_PASSWORD: local_dev_pwd
Expand All @@ -111,7 +111,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
- name: Lint migrations
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
ports:
- 5672:5672
mysql_test:
image: mysql:5.7.25
image: mysql:8.0.32
env:
MYSQL_DATABASE: oncall_local_dev
MYSQL_ROOT_PASSWORD: local_dev_pwd
Expand All @@ -151,7 +151,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
- name: Unit Test Backend
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
- name: Unit Test Backend
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
- name: Unit Test Backend
Expand All @@ -252,7 +252,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: tools/pagerduty-migrator/requirements.txt
- name: Unit Test PD Migrator
Expand All @@ -262,29 +262,46 @@ jobs:
pytest -x
end-to-end-tests:
# TODO: reenable this job once https://github.com/grafana/oncall/issues/1692 is fixed
if: ${{ false }}
runs-on: ubuntu-latest
# default "ubuntu-latest" runners only provide 2 CPU cores + 7GB of RAM. this seems to lead to HTTP 504s from
# the oncall backend, and hence, flaky tests. Let's use CI runners w/ more resources to avoid this (plus
# this will allow us to run more backend containers and parralelize the tests)
runs-on: ubuntu-latest-8-cores
name: "End to end tests - Grafana: ${{ matrix.grafana-image-tag }}"
strategy:
matrix:
grafana-image-tag:
- 9.2.6
# OnCall doesn't work on the following versions of Grafana
# - 8.5.22
# - 9.0.0
# - 9.1.0

# 9.2.0 is the earliest version where things work
- 9.2.13
- 9.3.14
- 9.4.10
- 9.5.2
- main
- latest
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1
with:
comment_on_pr: false
proc_trace_chart_show: false
proc_trace_table_show: false

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
config: ./helm/kind.yml

- uses: actions/setup-node@v3
with:
node-version: 14.17.0
node-version: 18.16.0
cache: "yarn"
cache-dependency-path: grafana-plugin/yarn.lock

Expand Down Expand Up @@ -330,10 +347,12 @@ jobs:
- name: Load engine Docker image on the nodes of the cluster
run: kind load image-archive --name=chart-testing /tmp/oncall-engine.tar

# spin up 2 engine, 2 celery, and 2 grafana pods, this will allow us to parralelize the integration tests
# spin up 3 engine and 3 celery pods, this will allow us to parralelize the integration tests,
# and complete them much faster by using multiple test processes
# With just 1 engine/celery/grafana pod, the backend crawls to a halt when there is > 1 parallelized integration
# test process
# With just 1 engine/celery/grafana pod, the backend crawls to a halt when there is > 1 parallelized integration test process
# NOTE: it appears that using > 1 grafana container w/ SQLite as the database sometimes leads to failed
# grafana database migrations (this is documented in this GitHub issue
# https://github.com/bitnami/charts/issues/10905)
#
# by settings grafana.plugins to [] and configuring grafana.extraVolumeMounts we are using the locally built
# OnCall plugin rather than the latest published version
Expand All @@ -345,8 +364,8 @@ jobs:
--values ./helm/simple.yml \
--values ./helm/values-local-image.yml \
--set-json 'env=[{"name":"GRAFANA_CLOUD_NOTIFICATIONS_ENABLED","value":"False"}]' \
--set engine.replicaCount=1 \
--set celery.replicaCount=1 \
--set engine.replicaCount=3 \
--set celery.replicaCount=3 \
--set celery.worker_beat_enabled="False" \
--set oncall.twilio.accountSid="${{ secrets.TWILIO_ACCOUNT_SID }}" \
--set oncall.twilio.authToken="${{ secrets.TWILIO_AUTH_TOKEN }}" \
Expand Down Expand Up @@ -377,20 +396,29 @@ jobs:
path: "~/.cache/ms-playwright"
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-chromium-firefox-webkit

- name: Install Playwright binaries/dependencies
# For the next two steps, use the binary directly from node_modules/.bin as opposed to npx playwright
# due to this bug (https://github.com/microsoft/playwright/issues/13188)
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
# https://stackoverflow.com/questions/65900299/install-single-dependency-from-package-json-with-yarn
run: |
yarn add "@playwright/test@${{ env.PLAYWRIGHT_VERSION }}"
npx playwright install --with-deps chromium firefox webkit
working-directory: grafana-plugin
run: ./node_modules/.bin/playwright install --with-deps chromium firefox webkit

- name: Await k8s pods and other resources up
uses: jupyterhub/action-k8s-await-workloads@v1
with:
workloads: "" # all
namespace: "" # default
timeout: 300
max-restarts: -1
# use the cached browsers, but we still need to install the necessary system dependencies
# (system deps are installed in the cache-miss step above by the --with-deps flag)
- name: Install Playwright System Dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: grafana-plugin
run: ./node_modules/.bin/playwright install-deps chromium firefox webkit

# we could instead use the --wait flag for the helm install command above
# but there's no reason to block on that step
# instead we can let the k8s resources start up behind the scenes and do other
# setup tasks (ex. install playwright + its dependencies)
- name: Wait until k8s resources are ready
run: |
kubectl rollout status deployment/helm-testing-grafana --timeout=300s
kubectl rollout status deployment/helm-testing-oncall-engine --timeout=300s
kubectl rollout status deployment/helm-testing-oncall-celery --timeout=300s
- name: Run Integration Tests
env:
Expand All @@ -407,17 +435,16 @@ jobs:
GRAFANA_PASSWORD: oncall
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
working-directory: ./grafana-plugin
# -x = exit command after first failing test
run: yarn test:integration -x
run: yarn test:integration

# always spit out the engine and celery logs, AFTER the e2e tests have completed
# can be helpful for debugging failing/flaky tests
# spit out the engine, celery, and grafana logs, if the the e2e tests have failed
# can be helpful for debugging failing tests
# GitHub Action reference: https://github.com/jupyterhub/action-k8s-namespace-report
- name: Kubernetes namespace report
uses: jupyterhub/action-k8s-namespace-report@v1
if: failure()
with:
important-workloads: "deploy/helm-testing-oncall-engine deploy/helm-testing-oncall-celery"
important-workloads: "deploy/helm-testing-oncall-engine deploy/helm-testing-oncall-celery deploy/helm-testing-grafana"

- uses: actions/upload-artifact@v3
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9.12"
python-version: "3.11.3"
cache: "pip"
cache-dependency-path: engine/requirements.txt
- uses: actions/setup-node@v3
with:
node-version: 14.17.0
node-version: 18.16.0
cache: "yarn"
cache-dependency-path: grafana-plugin/yarn.lock
- uses: snyk/actions/setup@master
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ venv
.python-version

.vscode
*.http
.idea
.DS_Store
.env
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

Loading

0 comments on commit a38f4d6

Please sign in to comment.