Skip to content

Commit

Permalink
Version update to v1.0.5, revision 7a53be9
Browse files Browse the repository at this point in the history
  • Loading branch information
QA Wolf bot committed Nov 19, 2024
1 parent 01d7075 commit b9aa132
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 76 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## v1.0.5

- Update README.md

## v1.0.3

- Update README.md to target @v1
- Update README.md to target v1

## v1.0.2

Expand Down
58 changes: 22 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ This is a GitHub Action for PR testing with QA Wolf. It is intended to be used i

**Required**. The QA Wolf API key. You can find your API key on the [QA Wolf settings page](https://app.qawolf.com/settings).

### `base-environments-mapping`

**Required**. A JSON-formatted array that defines the relationships between QA Wolf environments and Version Control System (VCS) branches. QA Wolf environment identifiers are called "environment aliases" and can be retrieved from the "General" tab on the environment settings page in QA Wolf. The recommended format for an environment alias is `<organization-name>/<repo-name>/<branch-name>`.

In this example, the mapping indicates that the "develop" QA Wolf environment corresponds to the "main" VCS branch:

```json
[{ "environmentAlias": "develop", "vcsBranch": "main" }]
```

### `head-environment-variables`

**Required**. JSON-formatted environment variables including deployment locations. Get help from a QA Wolf representative to determine which variables will be required here, as each customer has its own deployment layout.
Expand All @@ -36,6 +26,16 @@ In this example, the JSON object indicates that QA Wolf can reach your deployed

A positive number representing the maximum number of concurrent workflows that can be executed at once. It will default to the concurrency limit defined in the base environment. If you are unsure about this value, you can leave it empty.

### `base-environments-mapping`

A JSON-formatted array that defines the relationships between QA Wolf environments and Version Control System (VCS) branches. QA Wolf environment identifiers are called "environment aliases" and can be retrieved from the "General" tab on the environment settings page in QA Wolf. The recommended format for an environment alias is `<organization-name>/<repo-name>/<branch-name>`.

In this example, the mapping indicates that the "develop" QA Wolf environment corresponds to the "main" VCS branch:

```json
[{ "environmentAlias": "develop", "vcsBranch": "main" }]
```

## Secrets

### `GITHUB_TOKEN`
Expand Down Expand Up @@ -79,14 +79,10 @@ jobs:
with:
qawolf-api-key: "${{ secrets.QAWOLF_API_KEY }}"
# Requires the previous step to output JSON-formatted environment variables
head-environment-variables: ${{ needs.deploy-preview-environmnent.outputs.environment-variables }}
# A typical Gitflow mapping. This is very dependent on your branching
# and release models.
base-environments-mapping: |
[
{ "environmentAlias": "develop", "vcsBranch": "develop" },
{ "environmentAlias": "production", "vcsBranch": "main" }
]
head-environment-variables: |
{
"URL": "${{ needs.deploy-preview-environmnent.outputs.environment-variables.URL }}"
}
```
### Trigger action when a `pr-testing` label is applied
Expand Down Expand Up @@ -118,12 +114,10 @@ jobs:
uses: qawolf/pr-testing-request-new-run-after-deploy-action@v1
with:
qawolf-api-key: "${{ secrets.QAWOLF_API_KEY }}"
head-environment-variables: ${{ needs.deploy-preview-environmnent.outputs.environment-variables }}
base-environments-mapping: |
[
{ "environmentAlias": "develop", "vcsBranch": "develop" },
{ "environmentAlias": "production", "vcsBranch": "main" }
]
head-environment-variables: |
{
"URL": "${{ needs.deploy-preview-environmnent.outputs.environment-variables.URL }}"
}
```

### Trigger when a PR is ready for review
Expand Down Expand Up @@ -155,12 +149,10 @@ jobs:
uses: qawolf/pr-testing-request-new-run-after-deploy-action@v1
with:
qawolf-api-key: "${{ secrets.QAWOLF_API_KEY }}"
head-environment-variables: ${{ needs.deploy-preview-environmnent.outputs.environment-variables }}
base-environments-mapping: |
[
{ "environmentAlias": "develop", "vcsBranch": "develop" },
{ "environmentAlias": "production", "vcsBranch": "main" }
]
head-environment-variables: |
{
"URL": "${{ needs.deploy-preview-environmnent.outputs.environment-variables.URL }}"
}
```

### Trigger action on `deployment_status` events
Expand Down Expand Up @@ -188,12 +180,6 @@ jobs:
{
"URL": "${{ github.event.deployment_status.target_url }}"
}
# See above on how to create the base-environments-mapping
base-environments-mapping: |
[
{ "environmentAlias": "develop", "vcsBranch": "develop" },
{ "environmentAlias": "production", "vcsBranch": "main" }
]
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
80 changes: 43 additions & 37 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34174,7 +34174,7 @@ exports.jsonConcurrentLimitSchema = zod_1.z
if (str === "Infinity")
return 0;
const parsed = parseInt(str);
if (isNaN(parsed) || parsed < 0) {
if (Number.isNaN(parsed) || parsed < 0) {
ctx.addIssue({
code: "custom",
message: "input is not a valid number",
Expand Down Expand Up @@ -36197,18 +36197,25 @@ async function fetchCiGreenlightStatus({ apiKey, serviceBase }, { runId, }, { fe

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.postDeploySuccess = postDeploySuccess;
async function postDeploySuccess({ apiKey, serviceBase }, { branch, commitUrl, deduplicationKey, deploymentType, deploymentUrl, hostingService, sha, variables, }, { fetch: localFetch }) {
async function postDeploySuccess({ apiKey, serviceBase }, deployConfig, { fetch: localFetch }) {
try {
const response = await localFetch(new URL("/api/webhooks/deploy_success", serviceBase), {
body: JSON.stringify({
branch,
commit_url: commitUrl,
deduplication_key: deduplicationKey,
deployment_type: deploymentType,
deployment_url: deploymentUrl,
hosting_service: hostingService,
sha,
variables,
branch: deployConfig.branch,
commit_url: deployConfig.commitUrl,
deduplication_key: deployConfig.deduplicationKey,
deployment_type: deployConfig.deploymentType,
deployment_url: deployConfig.deploymentUrl,
hosting_service: deployConfig.hostingService,
merge_request_number: deployConfig.hostingService === "GitLab"
? deployConfig.mergeRequestNumber
: undefined,
pull_request_number: deployConfig.hostingService === "GitHub"
? deployConfig.pullRequestNumber
: undefined,
repository: deployConfig.repository,
sha: deployConfig.sha,
variables: deployConfig.variables,
}),
headers: {
Authorization: `Bearer ${apiKey}`,
Expand Down Expand Up @@ -36987,8 +36994,7 @@ exports.deleteEnvironmentAction = deleteEnvironmentAction;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findOrCreateEnvironment = findOrCreateEnvironment;
const constants_1 = __nccwpck_require__(9894);
// Migration debt, clean up when convenient
// eslint-disable-next-line @qawolf/restrict-names
// eslint-disable-next-line @qawolf/restrict-names -- Migration debt, clean up when convenient
async function findOrCreateEnvironment(deps, apiConfig, { baseEnvironmentId, branch, pr, qaWolfTeamId, }) {
const retrievalResponse = await deps.fetch(constants_1.qawolfGraphQLEndpoint, {
body: JSON.stringify({
Expand Down Expand Up @@ -37146,8 +37152,7 @@ async function findOrCreateEnvironment(deps, apiConfig, { baseEnvironmentId, bra
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findOrCreateTrigger = findOrCreateTrigger;
const constants_1 = __nccwpck_require__(9894);
// Migration debt, clean up when convenient
// eslint-disable-next-line @qawolf/restrict-names
// eslint-disable-next-line @qawolf/restrict-names -- Migration debt, clean up when convenient
async function findOrCreateTrigger(deps, apiConfig, args) {
const { branch, environmentId, pr, qaWolfTeamId, repositoryId, tags } = args;
const triggerName = `Deployments of ${pr ? `PR #${pr.number} - ${pr.title}` : `branch ${branch}`}`;
Expand Down Expand Up @@ -37474,7 +37479,7 @@ const safeDefaults = {
runInProgressInterval: 30 * 1000,
runUnderReviewInterval: 60 * 1000,
};
async function pollCiGreenlightStatus(deps, apiConfig, { onRunStageChanged: onRunStageChanged = () => void 0, runId, ...pollConfig }) {
async function pollCiGreenlightStatus(deps, apiConfig, { onRunStageChanged: onRunStageChanged = () => undefined, runId, ...pollConfig }) {
let retries = 0;
const { log } = deps;
const { abortOnSuperseded = safeDefaults.abortOnSuperseded, maxRetries = safeDefaults.maxRetries, pollTimeout = safeDefaults.pollTimeout, retryInterval = safeDefaults.retryInterval, runInProgressInterval = safeDefaults.runInProgressInterval, runUnderReviewInterval = safeDefaults.runUnderReviewInterval, } = pollConfig;
Expand Down Expand Up @@ -37691,14 +37696,20 @@ exports.domainFailureToAbortResult = domainFailureToAbortResult;
const utils_1 = __nccwpck_require__(4793);
function domainFailureToAbortResult({ log, methodName, result, }) {
switch (result.failureCode) {
case "run-creation-failed":
log.error(`❌ [${methodName}] Run creation failed: ${result.failureDetails}. Aborting.`);
case "base-environment-not-found":
log.error(`❌ [${methodName}] Base environment not found. Aborting.`);
return {
abortReason: result.failureCode,
outcome: "aborted",
};
case "base-environment-not-found":
log.error(`❌ [${methodName}] Base environment not found. Aborting.`);
case "base-trigger-not-found":
log.error(`❌ [${methodName}] Base trigger not found. A QA Wolf representative should set this up for you. Aborting.`);
return {
abortReason: result.failureCode,
outcome: "aborted",
};
case "head-environment-not-found":
log.error(`❌ [${methodName}] Head environment not found. Aborting.`);
return {
abortReason: result.failureCode,
outcome: "aborted",
Expand All @@ -37721,14 +37732,8 @@ function domainFailureToAbortResult({ log, methodName, result, }) {
abortReason: result.failureCode,
outcome: "aborted",
};
case "base-trigger-not-found":
log.error(`❌ [${methodName}] Base trigger not found. A QA Wolf representative should set this up for you. Aborting.`);
return {
abortReason: result.failureCode,
outcome: "aborted",
};
case "head-environment-not-found":
log.error(`❌ [${methodName}] Head environment not found. Aborting.`);
case "run-creation-failed":
log.error(`❌ [${methodName}] Run creation failed: ${result.failureDetails}. Aborting.`);
return {
abortReason: result.failureCode,
outcome: "aborted",
Expand All @@ -37752,21 +37757,21 @@ exports.graphQLErrorToAbortResult = graphQLErrorToAbortResult;
const utils_1 = __nccwpck_require__(4793);
function graphQLErrorToAbortResult({ graphQLPayload, log, methodName, }) {
switch (graphQLPayload.errorCode) {
case "bad-input":
log.error(`❌ [${methodName}] Bad GraphQL input. This is a bug. Aborting.`);
return { abortReason: "invalid-input", outcome: "aborted" };
case "forbidden":
log.error(`❌ [${methodName}] Forbidden. Aborting.`);
return { abortReason: "forbidden", outcome: "aborted" };
case "unauthenticated":
log.error(`❌ [${methodName}] Unauthenticated. Aborting.`);
return { abortReason: "unauthenticated", outcome: "aborted" };
case "network-error":
log.error(`❌ [${methodName}] Network error. Aborting.`);
return { abortReason: "network-error", outcome: "aborted" };
case "internal":
case "unknown":
return { abortReason: "server-error", outcome: "aborted" };
case "bad-input":
log.error(`❌ [${methodName}] Bad GraphQL input. This is a bug. Aborting.`);
return { abortReason: "invalid-input", outcome: "aborted" };
case "network-error":
log.error(`❌ [${methodName}] Network error. Aborting.`);
return { abortReason: "network-error", outcome: "aborted" };
case "unauthenticated":
log.error(`❌ [${methodName}] Unauthenticated. Aborting.`);
return { abortReason: "unauthenticated", outcome: "aborted" };
default:
(0, utils_1.assertType)(graphQLPayload.errorCode);
throw Error("Unreachable code detected. This is a bug.");
Expand Down Expand Up @@ -37829,7 +37834,8 @@ async function runNotifyVCSBranchBuildDeployedOnce(deps, apiConfig, input) {
if (typeof concurrencyLimit === "number") {
if (concurrencyLimit === Infinity)
finalConcurrencyLimit = 0;
else if (isNaN(concurrencyLimit) || !Number.isInteger(concurrencyLimit)) {
else if (Number.isNaN(concurrencyLimit) ||
!Number.isInteger(concurrencyLimit)) {
log.error(`❌ [notifyVCSBranchBuildDeployed] Invalid concurrency limit '${concurrencyLimit}'. Must be a positive integer.`);
return {
abortReason: "invalid-input",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qawolf/pr-testing-request-new-run-after-deploy-action",
"version": "v1.0.4",
"version": "v1.0.5",
"type": "commonjs",
"main": "dist/index.js",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const jsonConcurrentLimitSchema = z
if (str === "") return undefined;
if (str === "Infinity") return 0;
const parsed = parseInt(str);
if (isNaN(parsed) || parsed < 0) {
if (Number.isNaN(parsed) || parsed < 0) {
ctx.addIssue({
code: "custom",
message: "input is not a valid number",
Expand Down

0 comments on commit b9aa132

Please sign in to comment.