Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into feat/private-probes-in-use-proble…
Browse files Browse the repository at this point in the history
…s-handling
  • Loading branch information
w1kman committed Oct 15, 2024
2 parents d584621 + a40b5e6 commit 2fe04b2
Show file tree
Hide file tree
Showing 20 changed files with 298 additions and 48 deletions.
21 changes: 5 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ steps:
image: node:18
commands:
- ./scripts/install-ci-deps-apt.sh
- make install lint test build sign package gh-release
- make install lint test build sign package
environment:
GCP_KEY:
from_secret: gcp_key
Expand All @@ -229,7 +229,7 @@ steps:
"repo_owner": "grafana",
"repo_name": "deployment_tools",
"destination_branch": "master",
"pull_request_branch_prefix": "ci/synthetic-monitoring-plugin",
"pull_request_branch_prefix": "auto-merge/synthetic-monitoring-plugin",
"pull_request_enabled": true,
"pull_request_existing_strategy": "ignore",
"pull_request_message": "Triggered by ${DRONE_COMMIT_LINK}. NOTE: prod does not refer directly to an environment it refers to stacks associated with the prod 'wave'. See [here](https://github.com/grafana/deployment_tools/blob/master/ksonnet/environments/hosted-grafana/waves/provisioned-plugins/README.md#waves) for more info.",
Expand All @@ -254,24 +254,13 @@ steps:
github_app_private_key:
from_secret: updater-app-private-key

image_pull_secrets:
- dockerconfigjson
---
kind: pipeline
type: docker
name: publish-gcom

trigger:
event:
- tag

steps:
- name: publish plugin to grafana.com (release)
image: curlimages/curl:7.73.0
image: ubuntu:latest
environment:
GRAFANA_API_KEY:
from_secret: signing_token
commands:
- ./scripts/install-ci-deps-apt.sh
- ls -al ./scripts
- ./scripts/publish-gcom.sh

Expand Down Expand Up @@ -336,6 +325,6 @@ kind: secret
name: gcp_key
---
kind: signature
hmac: ede448d84d902df6e886dc356506c374c626a3d66fad501699c1f1b239dddf49
hmac: 5ea4dd99d229f1949320b0a44266432f838ca13721ae2a48713b0e73060baece

...
3 changes: 3 additions & 0 deletions .github/release-please/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.16.4"
}
19 changes: 19 additions & 0 deletions .github/release-please/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"packages": {
".": {
"release-type": "node",
"bump-minor-pre-major": true,
"include-component-in-tag": false,
"changelog-sections": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Fixes" },
{ "type": "docs", "section": "Documentation" },
{ "type": "chore", "section": "Miscellaneous Chores" },
{ "type": "refactor", "section": "Code Refactoring" },
{ "type": "release", "section": "Release"}
]
}
},
"draft-pull-request": true,
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
49 changes: 49 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release Please

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Retrieve release app credentials
id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
repo_secrets: |
GITHUB_APP_ID=github-app:app-id
GITHUB_APP_INSTALLATION_ID=github-app:app-installation-id
GITHUB_APP_PRIVATE_KEY=github-app:private-key
- name: Get repository name
env:
REPOSITORY: ${{ github.repository }}
id: info
run: echo "repository_name=${REPOSITORY#*/}" >> "$GITHUB_OUTPUT"

- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@3378cda945da322a8db4b193e19d46352ebe2de5 # v1
with:
app-id: ${{ env.GITHUB_APP_ID }}
private-key: ${{ env.GITHUB_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ steps.info.outputs.repository_name }}

- name: Release
id: release
uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
with:
token: ${{ steps.generate-token.outputs.token }}
target-branch: main
config-file: .github/release-please/release-please-config.json
manifest-file: .github/release-please/.release-please-manifest.json
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,56 @@
- almost there... skipping docs publish step ([d97521c](https://github.com/grafana/synthetic-monitoring-app/commit/d97521ce6038149f406bcce6406bc9242b11242e))
- gcom token secret ([1c2b5b8](https://github.com/grafana/synthetic-monitoring-app/commit/1c2b5b8473cc1cf719c0c678db1af60829f33ad1))

## [1.16.4](https://github.com/grafana/synthetic-monitoring-app/compare/v1.16.3...v1.16.4) (2024-10-09)


### Fixes

* Publish script ([#966](https://github.com/grafana/synthetic-monitoring-app/issues/966)) ([b3a678b](https://github.com/grafana/synthetic-monitoring-app/commit/b3a678bb70b8a1d8343a74fb34520b97f67c9ca5))

## [1.16.3](https://github.com/grafana/synthetic-monitoring-app/compare/v1.16.2...v1.16.3) (2024-10-09)


### Miscellaneous Chores

* Add git to publish step ([#962](https://github.com/grafana/synthetic-monitoring-app/issues/962)) ([cfafe1f](https://github.com/grafana/synthetic-monitoring-app/commit/cfafe1f363086de0b209109e16f671dc26e41119))
* Change publish step image ([#964](https://github.com/grafana/synthetic-monitoring-app/issues/964)) ([d25ea9f](https://github.com/grafana/synthetic-monitoring-app/commit/d25ea9f808e735dcfe012493f00db6bb9bd151bd))

## [1.16.2](https://github.com/grafana/synthetic-monitoring-app/compare/v1.16.1...v1.16.2) (2024-10-08)


### Miscellaneous Chores

* Fix publish version ([#960](https://github.com/grafana/synthetic-monitoring-app/issues/960)) ([145fb08](https://github.com/grafana/synthetic-monitoring-app/commit/145fb0842f9fce80d0f90b496166ec6c81dab8d8))

## [1.16.1](https://github.com/grafana/synthetic-monitoring-app/compare/v1.16.0...v1.16.1) (2024-10-08)


### Miscellaneous Chores

* Fix release CI/CD ([#958](https://github.com/grafana/synthetic-monitoring-app/issues/958)) ([91ec8f9](https://github.com/grafana/synthetic-monitoring-app/commit/91ec8f972016b368128e62e774810a70d6bb225b))

## [1.16.0](https://github.com/grafana/synthetic-monitoring-app/compare/v1.15.2...v1.16.0) (2024-10-07)


### Features

* extra validations for browser checks ([#942](https://github.com/grafana/synthetic-monitoring-app/issues/942)) ([1e3960d](https://github.com/grafana/synthetic-monitoring-app/commit/1e3960dcb3b8a6b983e1821f65356620f70cb38b))
* set default timeout for browser checks to 1 min ([#945](https://github.com/grafana/synthetic-monitoring-app/issues/945)) ([e2be2da](https://github.com/grafana/synthetic-monitoring-app/commit/e2be2da8d4ef44dda965ff348f8386fbffcc3938))


### Fixes

* remove dynamic and unused data-fs-element attributes ([#941](https://github.com/grafana/synthetic-monitoring-app/issues/941)) ([d1b11ae](https://github.com/grafana/synthetic-monitoring-app/commit/d1b11aeccaf158b4fc25dd54e8a6845e37b125de))


### Miscellaneous Chores

* change browser checks to public preview status ([#952](https://github.com/grafana/synthetic-monitoring-app/issues/952)) ([26d0c5b](https://github.com/grafana/synthetic-monitoring-app/commit/26d0c5b8889b70bb98e2b9e2725a563e9afda74b))
* Setup release-please ([#933](https://github.com/grafana/synthetic-monitoring-app/issues/933)) ([e7ebcd6](https://github.com/grafana/synthetic-monitoring-app/commit/e7ebcd6d13f82d639aef240053bed6efa124cb2c))
* Tune release process ([#947](https://github.com/grafana/synthetic-monitoring-app/issues/947)) ([1b3f2c0](https://github.com/grafana/synthetic-monitoring-app/commit/1b3f2c0a54d62eb2a88093c9917d382cda001964))
* update fillform example to use async check ([#949](https://github.com/grafana/synthetic-monitoring-app/issues/949)) ([91b00e5](https://github.com/grafana/synthetic-monitoring-app/commit/91b00e5c39726a1ba7312f01778193afdd84632b))

## [1.2.30] - 2021-08-27

- New start to changelog with updated build process
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synthetic-monitoring-app",
"version": "1.15.2",
"version": "1.16.4",
"description": "Grafana Synthetic Monitoring App",
"scripts": {
"build": "webpack -c webpack.config.ts --env production",
Expand Down Expand Up @@ -106,6 +106,7 @@
"eslint-plugin-simple-import-sort": "^10.0.0",
"ip-address": "^7.1.0",
"is-base64": "^1.1.0",
"js-base64": "^3.7.7",
"lodash": "4.17.21",
"ol": "8.2.0",
"prismjs": "1.29.0",
Expand Down
20 changes: 20 additions & 0 deletions scripts/drone-sign.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# This script regenerates the HMAC for the drone.yaml file

set -e

if test -z "$DRONE_TOKEN"
then
echo "Drone token not set. Usage:\nDRONE_TOKEN=<token> [DRONE_SERVER=<server>] $0"
exit 1
fi

if test -z "$DRONE_SERVER"
then
DRONE_SERVER=https://drone.grafana.net
fi

drone -s $DRONE_SERVER -t $DRONE_TOKEN sign grafana/synthetic-monitoring-app --save

exit 0
1 change: 1 addition & 0 deletions scripts/install-ci-deps-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ apt-get update >/dev/null && apt-get install -y \
make \
wget \
zip \
curl \
>/dev/null

wget -q https://github.com/cli/cli/releases/download/v${gh_version}/gh_${gh_version}_linux_amd64.deb
Expand Down
7 changes: 4 additions & 3 deletions scripts/publish-gcom.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash
#!/bin/bash
# This is used in Drone to generate the version string for automatic PR creation
set -eufo pipefail

VERSION="${DRONE_TAG#v}"
ROOT_DIR=$(git rev-parse --show-toplevel)
VERSION="$(grep version ${ROOT_DIR}/package.json | cut -d':' -f2 | tr -d "\"', \r")"

echo "${VERSION}"

curl -f -w "status=%{http_code}" -s -H "Authorization: Bearer ${GRAFANA_API_KEY}" \
-d "download[any][url]=https://storage.googleapis.com/synthetic-monitoring-app-prod/builds/${VERSION}/grafana-synthetic-monitoring-app-${VERSION}.zip" \
-d "download[any][md5]=$$(curl -sL https://storage.googleapis.com/synthetic-monitoring-app-prod/builds/${VERSION}/grafana-synthetic-monitoring-app-${VERSION}.zip | md5sum | cut -d' ' -f1)" \
-d url=https://github.com/grafana/synthetic-monitoring-app \
"https://grafana.com/api/plugins"
"https://grafana.com/api/plugins"
18 changes: 10 additions & 8 deletions src/components/BrowserExamplesMenu/snippets/fillform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { check } from 'k6';
import { browser } from 'k6/browser';
import { check } from 'https://jslib.k6.io/k6-utils/1.5.0/index.js';

export const options = {
scenarios: {
Expand Down Expand Up @@ -35,15 +35,17 @@ export default async function () {
// to resolve.
await Promise.all([page.waitForNavigation(), page.locator('input[type="submit"]').click()]);

const h2 = page.locator('h2');
const headerOK = (await h2.textContent()) == 'Welcome, admin!';
check(headerOK, { header: headerOK });
await check(page.locator('h2'), {
header: async (element) => {
return (await element.textContent()) == 'Welcome, admin!';
},
});

// Check whether we receive cookies from the logged site.
check(await context.cookies(), {
'session cookie is set': (cookies) => {
const sessionID = cookies.find((c) => c.name == 'sid');
return typeof sessionID !== 'undefined';
await check(context, {
'session cookie is set': async (ctx) => {
const cookies = await ctx.cookies();
return cookies.find((c) => c.name == 'sid') !== undefined;
},
});
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { decode } from 'js-base64';

import { BrowserCheck, CheckFormValuesBrowser, CheckType } from 'types';
import { getBaseFormValuesFromCheck } from 'components/CheckEditor/transformations/toFormValues.utils';

Expand All @@ -9,7 +11,7 @@ export function getBrowserCheckFormValues(check: BrowserCheck): CheckFormValuesB
checkType: CheckType.Browser,
settings: {
browser: {
script: atob(check.settings?.browser?.script),
script: decode(check.settings?.browser?.script),
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { decode } from 'js-base64';

import { CheckFormValuesScripted, CheckType, ScriptedCheck } from 'types';
import { getBaseFormValuesFromCheck } from 'components/CheckEditor/transformations/toFormValues.utils';

Expand All @@ -9,7 +11,7 @@ export function getScriptedCheckFormValues(check: ScriptedCheck): CheckFormValue
checkType: CheckType.Scripted,
settings: {
scripted: {
script: atob(check.settings?.scripted?.script),
script: decode(check.settings?.scripted?.script),
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { encode } from 'js-base64';

import { BrowserCheck, CheckFormValuesBrowser } from 'types';
import { getBasePayloadValuesFromForm } from 'components/CheckEditor/transformations/toPayload.utils';

Expand All @@ -8,7 +10,7 @@ export function getBrowserPayload(formValues: CheckFormValuesBrowser): BrowserCh
...base,
settings: {
browser: {
script: btoa(formValues.settings.browser.script),
script: encode(formValues.settings.browser.script),
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { encode } from 'js-base64';

import { CheckFormValuesScripted, ScriptedCheck } from 'types';
import { getBasePayloadValuesFromForm } from 'components/CheckEditor/transformations/toPayload.utils';

Expand All @@ -8,7 +10,7 @@ export function getScriptedPayload(formValues: CheckFormValuesScripted): Scripte
...base,
settings: {
scripted: {
script: btoa(formValues.settings.scripted.script),
script: encode(formValues.settings.scripted.script),
},
},
};
Expand Down
8 changes: 2 additions & 6 deletions src/hooks/useCheckTypeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export const CHECK_TYPE_OPTIONS = [
label: 'Scripted',
value: CheckType.Scripted,
description: 'Write a k6 script to run custom checks.',
status: {
value: CheckStatus.PUBLIC_PREVIEW,
description: `Scripted checks are in public preview. We're actively working on improving the experience and adding more features.`,
},
featureToggle: FeatureName.ScriptedChecks,
group: CheckTypeGroup.Scripted,
},
Expand All @@ -67,8 +63,8 @@ export const CHECK_TYPE_OPTIONS = [
value: CheckType.Browser,
description: 'Leverage k6 browser module to run checks in a browser.',
status: {
value: CheckStatus.PRIVATE_PREVIEW,
description: `Browser checks are in private preview. During the preview they are free to use: test executions will not be billed.`,
value: CheckStatus.PUBLIC_PREVIEW,
description: `Browser checks are in public preview. During the preview they are free to use: test executions will not be billed.`,
docsLink:
'https://grafana.com/docs/grafana-cloud/cost-management-and-billing/understand-your-invoice/synthetic-monitoring-invoice/',
},
Expand Down
Loading

0 comments on commit 2fe04b2

Please sign in to comment.