Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meticulous debug] Improved Meticulous Tunnel instructions #514

Merged
merged 13 commits into from
Sep 20, 2024
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
if [ "$(git diff --ignore-space-at-eol --text out/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text out/
echo ""
echo "Run 'yarn build' locally and commit the changes. If this doesn't work then delete your `.parcel-cache` directory before running 'yarn build'."
echo ""
exit 1
fi

Expand Down
36 changes: 24 additions & 12 deletions out/cloud-compute.entrypoint.js

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions src/actions/cloud-compute/run-test-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ import { defer, METICULOUS_LOGGER_NAME } from "@alwaysmeticulous/common";
import { executeRemoteTestRun } from "@alwaysmeticulous/remote-replay-launcher";
import log from "loglevel";
import { throwIfCannotConnectToOrigin } from "../../common/check-connection";
import { METICULIOUS_APP_URL } from "../../common/constants";
import { tryTriggerTestsWorkflowOnBase } from "../../common/ensure-base-exists.utils";
import { shortCommitSha } from "../../common/environment.utils";
import { getBaseAndHeadCommitShas } from "../../common/get-base-and-head-commit-shas";
import { getCodeChangeEvent } from "../../common/get-code-change-event";
import { isDebugPullRequestRun } from "../../common/is-debug-pr-run";
import {
getPrefixedLogger,
initLogger,
shortSha,
} from "../../common/logger.utils";
import { getPrefixedLogger, shortSha } from "../../common/logger.utils";
import { getOctokitOrFail } from "../../common/octokit";
import { updateStatusComment } from "../../common/update-status-comment";
import { DEBUG_MODE_KEEP_TUNNEL_OPEN_DURATION } from "./consts";
Expand Down Expand Up @@ -159,8 +156,18 @@ export const runOneTestRun = async ({
event,
owner,
repo,
body: `🤖 Meticulous is running in debug mode. Secure tunnel to ${appUrl} created: ${url} user: \`${basicAuthUser}\` password: \`${basicAuthPassword}\`.\n\n
Tunnel will be live for up to ${DEBUG_MODE_KEEP_TUNNEL_OPEN_DURATION.toHuman()}. Cancel the workflow run to close the tunnel early.`,
body:
`🤖 Meticulous is running in debug mode. Secure tunnel to ${appUrl} created: ${url} user: \`${basicAuthUser}\` password: \`${basicAuthPassword}\`.\n\n` +
`Tunnel will be live for up to ${DEBUG_MODE_KEEP_TUNNEL_OPEN_DURATION.toHuman()}. Cancel the workflow run to close the tunnel early.\n\n` +
`Please open this tunnel in your browser (and enter the username and password when prompted) and check that you are serving your application correctly.\n\n` +
`If you wish to run Meticulous tests locally against this tunnel using the Meticulous CLI then you can use the environment variables \`METICULOUS_TUNNEL_USERNAME\` and \`METICULOUS_TUNNEL_PASSWORD\`. For example:\n\n` +
`\`\`\`bash\n` +
`METICULOUS_TUNNEL_USERNAME="${basicAuthUser}" METICULOUS_TUNNEL_PASSWORD="${basicAuthPassword}" npx @alwaysmeticulous/cli simulate \\\n` +
` --sessionId="<a session id to replay>" \\\n` +
` --appUrl="${url}" \\\n` +
` --apiToken="<your API token>"\n` +
`\`\`\`\n\n` +
`To find a test session to replay and to find your API token: visit the 'Selected Sessions' tab or 'All Sessions' tab on your [Meticulous project page](${METICULIOUS_APP_URL}), click on a session and select the 'Simulate' tab.`,
testSuiteId: `__meticulous_debug_${testRunId}__`,
shortHeadSha: shortCommitSha(headSha),
createIfDoesNotExist: true,
Expand Down
4 changes: 3 additions & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const DOCS_URL = "https://app.meticulous.ai/docs/github-actions-v2";
export const METICULIOUS_APP_URL = "https://app.meticulous.ai";

export const DOCS_URL = `${METICULIOUS_APP_URL}/docs/github-actions-v2`;

export const METICULOUS_DEBUGGING_PR_TAG = "[meticulous debug]";
Loading