Skip to content

Commit 88c30d7

Browse files
authored
Chore: Migrate from Drone to Github Actions and fix e2e tests (#371)
- update Prometheus and Grafana packages
1 parent 4806090 commit 88c30d7

14 files changed

+632
-1121
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

.github/workflows/e2e.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

.github/workflows/publish.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Plugins - CD
2+
run-name: Deploy ${{ inputs.branch }} to ${{ inputs.environment }} by @${{ github.actor }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: Branch to publish from. Can be used to deploy PRs to dev
9+
default: main
10+
environment:
11+
description: Environment to publish to
12+
required: true
13+
type: choice
14+
options:
15+
- "dev"
16+
- "ops"
17+
- "prod"
18+
docs-only:
19+
description: Only publish docs, do not publish the plugin
20+
default: false
21+
type: boolean
22+
23+
permissions: {}
24+
25+
jobs:
26+
cd:
27+
name: CD
28+
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@main # zizmor: ignore[unpinned-uses]
29+
permissions:
30+
contents: write
31+
id-token: write
32+
attestations: write
33+
with:
34+
branch: ${{ github.event.inputs.branch }}
35+
environment: ${{ github.event.inputs.environment }}
36+
docs-only: ${{ fromJSON(github.event.inputs.docs-only) }}
37+
scopes: universal

.github/workflows/push.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Plugins - CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions: {}
10+
11+
jobs:
12+
ci:
13+
name: CI
14+
uses: grafana/plugin-ci-workflows/.github/workflows/ci.yml@main
15+
permissions:
16+
contents: read
17+
id-token: write
18+
with:
19+
plugin-version-suffix: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
20+
upload-playwright-artifacts: true

.github/workflows/release.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
context: ./.config
2525
args:
2626
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
27-
grafana_version: ${GRAFANA_VERSION:-11.5.0}
27+
grafana_version: ${GRAFANA_VERSION:-11.5.1}
2828
ports:
2929
- 3000:3000/tcp
3030
- 2345:2345/tcp # delve

e2e/annotation-editor.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ test.describe('Prometheus annotation query editor', () => {
1111
}) => {
1212
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });
1313

14-
await page.getByTestId('data-testid Select a data source').click();
15-
16-
await page.getByTestId('data-testid Select a data source').fill(ds.name);
17-
18-
await page.getByRole('button', { name: `${ds.name}` }).click();
19-
14+
await annotationEditPage.datasource.set(ds.name);
15+
2016
await expect(annotationEditPage
2117
.getByGrafanaSelector(selectors.components.DataSource.Prometheus.queryEditor.code.queryField)).toBeVisible();
2218
});

e2e/configuration.spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,32 @@ test.describe('Configuration tests', () => {
100100
*/
101101

102102
test('"Save & test" should fail when configuration is invalid', async ({
103+
readProvisionedDataSource,
104+
gotoDataSourceConfigPage,
105+
page,
106+
}) => {
107+
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({
108+
fileName: 'datasources.yml',
109+
});
110+
const configPage = await gotoDataSourceConfigPage(ds.uid);
111+
await page.getByLabel('Edit Access Key ID').click();
112+
await page.getByLabel('Access Key ID').fill('');
113+
await expect(configPage.saveAndTest()).not.toBeOK();
114+
await expect(configPage).toHaveAlert('error', {
115+
hasText: /.*there was an error returned querying the prometheus api/i,
116+
});
117+
});
118+
119+
test('"Save & test" should fail when url is empty', async ({
103120
createDataSourceConfigPage,
104121
readProvisionedDataSource,
105122
}) => {
106123
const ds = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({
107124
fileName: 'datasources.yml',
108125
});
109126
const configPage = await createDataSourceConfigPage({ type: ds.type });
110-
await expect(configPage.saveAndTest()).not.toBeOK();
111-
await expect(configPage).toHaveAlert('error', { hasText: 'empty url' });
127+
await configPage.getByGrafanaSelector(selectors.pages.DataSource.saveAndTest).click();
128+
await expect(configPage).toHaveAlert('error', { hasText: /invalid URL/i });
112129
});
113130

114131
test('it should allow a user to add the version when the Prom type is selected', async ({

0 commit comments

Comments
 (0)