Skip to content

Commit

Permalink
Merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mderynck committed Jun 7, 2024
2 parents e9664f4 + f07e220 commit 6e49e3c
Show file tree
Hide file tree
Showing 83 changed files with 1,371 additions and 976 deletions.
414 changes: 0 additions & 414 deletions .drone.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/actions/build-sign-and-package-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build, sign, and package plugin
description: Build, sign, and package plugin
inputs:
plugin_version_number:
description: "The version number of the plugin"
required: true
grafana_access_policy_token:
description: "The Grafana access policy token used to sign the plugin"
required: true
working_directory:
description: "The working directory of the plugin"
required: true
is_enterprise:
description: "Whether the plugin is an enterprise build or not"
required: false
default: "false"
outputs:
artifact_filename:
description: "The filename of the plugin artifact"
value: ${{ steps.artifact-filename.outputs.filename }}
runs:
using: "composite"
steps:
- name: Determine artifact filename
shell: bash
id: artifact-filename
# yamllint disable rule:line-length
run: |
echo filename="grafana-oncall${{ inputs.is_enterprise == 'true' && '-ee' || '' }}-app-${{ inputs.plugin_version_number }}.zip" >> $GITHUB_OUTPUT
- name: Build, sign, and package plugin
shell: bash
working-directory: ${{ inputs.working_directory }}
env:
GRAFANA_ACCESS_POLICY_TOKEN: ${{ inputs.grafana_access_policy_token }}
run: |
jq --arg v "${{ inputs.plugin_version_number }}" '.version=$v' package.json > package.new && mv package.new package.json && jq '.version' package.json;
yarn build
yarn sign
if [ ! -f dist/MANIFEST.txt ]; then echo "Sign failed, MANIFEST.txt not created, aborting." && exit 1; fi
mv dist grafana-oncall-app
zip -r grafana-oncall-app.zip ./grafana-oncall-app
cp grafana-oncall-app.zip ${{ steps.artifact-filename.outputs.filename }}
# yamllint enable rule:line-length
2 changes: 1 addition & 1 deletion .github/actions/install-frontend-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
cache-dependency-path: ${{ steps.yarn-lock-location.outputs.yarn-lock-location }}
- name: Use cached frontend dependencies
id: cache-frontend-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ inputs.working-directory }}/grafana-plugin/node_modules
# yamllint disable rule:line-length
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/set-engine-version-in-settings/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Set engine version in settings file
description: Set engine version in settings file
inputs:
working_directory:
description: The working directory
required: true
engine_version_number:
description: The engine version number
required: true
settings_file_path:
description: The path to the settings file to set VERSION in
required: true
runs:
using: "composite"
steps:
- name: Set engine version in settings file
shell: bash
working-directory: ${{ inputs.working_directory }}
# yamllint disable rule:line-length
run: |
sed "0,/VERSION.*/ s/VERSION.*/VERSION = \"${{ inputs.engine_version_number }}\"/g" ${{ inputs.settings_file_path }} > ./settings.temp && mv settings.temp ${{ inputs.settings_file_path }}
cat ${{ inputs.settings_file_path }} | grep VERSION | head -1
# yamllint enable rule:line-length
2 changes: 1 addition & 1 deletion .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
steps:
- name: Setup Python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5.1.0
with:
python-version: "3.11.4"
cache: "pip"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build engine Docker image and publish to Dockerhub

on:
workflow_call:
inputs:
engine_version:
required: false
type: string
docker_image_tags:
required: true
type: string

jobs:
build-engine-docker-image-and-publish-to-dockerhub:
name: Build engine Docker image and publish to Dockerhub
runs-on: ubuntu-latest
# These permissions are needed to assume roles from Github's OIDC.
# https://github.com/grafana/shared-workflows/tree/main/actions/build-push-to-dockerhub
permissions:
contents: read
id-token: write
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set engine version number in settings file
if: inputs.engine_version
uses: ./.github/actions/set-engine-version-in-settings
with:
working_directory: .
engine_version_number: ${{ inputs.engine_version }}
settings_file_path: engine/settings/base.py
- name: Build engine Docker image and push to Dockerhub
uses: grafana/shared-workflows/actions/build-push-to-dockerhub@main
with:
context: engine/
push: true
platforms: linux/arm64/v8,linux/amd64
repository: grafana/oncall
tags: ${{ inputs.docker_image_tags }}
build-args: |
BUILDKIT_INLINE_CACHE=1
target: prod
cache-from: grafana/oncall:latest
8 changes: 4 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v1
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
proc_trace_chart_show: false
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Use cached plugin frontend build
id: cache-plugin-frontend
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: grafana-plugin/dist
key: ${{ runner.os }}-plugin-frontend-${{ hashFiles('grafana-plugin/src/**/*', 'grafana-plugin/yarn.lock') }}
Expand All @@ -96,7 +96,7 @@ jobs:
- name: Cache Playwright binaries/dependencies
id: playwright-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: "~/.cache/ms-playwright"
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ inputs.browsers }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm_release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
update-helm-chart-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Define app_version and helm version
id: tags
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue_commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: "grafana/grafana-github-actions"
path: ./actions
Expand Down
41 changes: 13 additions & 28 deletions .github/workflows/linting-and-tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
name: Linting and Tests

"on":
push:
branches:
- main
- dev
pull_request:
# You can use the merge_group event to trigger your GitHub Actions workflow when
# a pull request is added to a merge queue
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#triggering-merge-group-checks-with-github-actions
merge_group:
on:
workflow_call:

env:
DJANGO_SETTINGS_MODULE: settings.ci_test
DATABASE_HOST: localhost
RABBITMQ_URI: amqp://rabbitmq:rabbitmq@localhost:5672
SLACK_CLIENT_OAUTH_ID: 1

concurrency:
# Cancel any running workflow for the same branch when new commits are pushed.
# We group both by ref_name (available when CI is triggered by a push to a branch/tag)
# and head_ref (available when CI is triggered by a PR).
group: "${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true

jobs:
lint-entire-project:
name: "Lint entire project"
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
with:
Expand All @@ -44,7 +29,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install frontend dependencies
uses: ./.github/actions/install-frontend-dependencies
- name: Build, lint and test frontend
Expand All @@ -56,7 +41,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: "Check out code"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
- name: "Build website"
# -e HUGO_REFLINKSERRORLEVEL=ERROR prevents merging broken refs with the downside
# that no refs to external content can be used as these refs will not resolve in the
Expand Down Expand Up @@ -88,7 +73,7 @@ jobs:
- 3306:3306
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Lint migrations
Expand All @@ -104,8 +89,8 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v3
- uses: azure/setup-helm@v3
uses: actions/checkout@v4
- uses: azure/setup-helm@v4.2.0
with:
version: v3.8.0
- name: Install helm unittest plugin
Expand Down Expand Up @@ -148,7 +133,7 @@ jobs:
- 3306:3306
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Unit Test Backend
Expand Down Expand Up @@ -187,7 +172,7 @@ jobs:
--health-retries 5
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Unit Test Backend
Expand Down Expand Up @@ -217,7 +202,7 @@ jobs:
--health-retries 5
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Unit Test Backend
Expand All @@ -229,7 +214,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
with:
Expand All @@ -243,7 +228,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup-python
- name: mypy Static Type Checking
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/on-commits-to-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: On commits to dev

on:
push:
branches:
- dev

concurrency:
# Cancel any running workflow for the same branch when new commits are pushed.
# We group both by ref_name (available when CI is triggered by a push to a branch/tag)
# and head_ref (available when CI is triggered by a PR).
group: "${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true

jobs:
build-engine-docker-image-and-publish-to-dockerhub:
name: Build engine Docker image and publish to Dockerhub
uses: ./.github/workflows/build-engine-docker-image-and-publish-to-dockerhub.yml
with:
# https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input
docker_image_tags: |
type=raw,value=dev
20 changes: 20 additions & 0 deletions .github/workflows/on-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: On pull requests

on:
pull_request:
# You can use the merge_group event to trigger your GitHub Actions workflow when
# a pull request is added to a merge queue
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#triggering-merge-group-checks-with-github-actions
merge_group:

concurrency:
# Cancel any running workflow for the same branch when new commits are pushed.
# We group both by ref_name (available when CI is triggered by a push to a branch/tag)
# and head_ref (available when CI is triggered by a PR).
group: "${{ github.ref_name }}-${{ github.head_ref }}"
cancel-in-progress: true

jobs:
linting-and-tests:
name: Linting and tests
uses: ./.github/workflows/linting-and-tests.yml
Loading

0 comments on commit 6e49e3c

Please sign in to comment.