When you deploy a new version of your application, you can notify us and we will initiate a test run for this deployment.
<aside> ⚠️ Please note that these are meant to be triggered by your main environment, per the contract with QA Wolf. If you need additional environment support, please reach out to our team. There are both technical and account implications for secondary environments that are not fully covered in this document.
</aside>
A QAE representative must configure a trigger associated with an environment for deploy success requests to initiate test runs. The DeployConfig
object below will require some parameters that match this Trigger configuration.
Contact a QA Wolf representative for assistance in this setup.d
Below is a sample script written in TypeScript:
<aside>
⚠️ Please refer to Choosing Fields Based on Your Setup to properly set up the DeployConfig
object.
</aside>
import { type DeployConfig, makeQaWolfSdk } from "@qawolf/ci-sdk";
// Edit this to your needs.
const deployConfig: DeployConfig = {
sha: undefined, // Recomended
branch: undefined, // Recommended
commitUrl: undefined, // Recommended
deploymentType: undefined, // "accounting"
deduplicationKey: undefined, // Not needed
deploymentUrl: undefined, // Not needed
hostingService: undefined, // Not needed
variables: undefined, // Not needed
};
const { attemptNotifyDeploy } = makeQaWolfSdk({
apiKey: "qawolf_xxxxx"
});
(async () => {
const result = await attemptNotifyDeploy(deployConfig);
if (result.outcome !== "success") {
// Fail the job.
process.exit(1);
}
const runId = result.runId;
// Store the runId as an output of the job to be used in a CI-greenlight job.
// This will depend on the CI platform you are using.
})();
Below is an example of an workflow:
<aside> ⚠️ Please refer to Notify On Deploy Action Documentation to see details about how implement the action. The action is available on the Marketplace.
</aside>
name: Deploy and Notify QA Wolf
# You can trigger this action using other events. Here is just an example.
on: pull_request
jobs:
# The deployment URL should be captured in this step, unless the
# URL is statically defined for the target environment.
deploy-preview-environmnent:
name: Your custom job to deploy a preview environment
uses: ./your-custom-action
wait-for-deployment:
name: Your custom job to wait for the deployed environment to be ready
uses: ./your-custom-action
notify:
needs: deploy-preview-environmnent
name: Trigger QA Wolf PR testing
runs-on: ubuntu-latest
steps:
- name: Notify QA Wolf of deployment
uses: qawolf/notify-deploy-action@v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
qawolf-api-key: "${{ secrets.QAWOLF_API_KEY }}"
# THIS IS JUST AN EXAMPLE.
# The below parameters given in the `with` clause may vary depending on your setup.
sha: "${{ github.event.pull_request.head.sha }}"
branch: "${{ github.event.pull_request.head.ref }}"
# If not static, this URL should be captured in the deployment step, and passed
# down over here.
deployment-url: ${{ needs.deploy-preview-environmnent.outputs.deployment-url || "<https://example.com>" }}
Below is a sample “curl” usage:
curl -X POST -H "Authorization: Bearer <ApiKey>" \\
-H "Content-Type: application/json" \\
"<https://app.qawolf.com/api/webhooks/deploy_success>" \\
-d '{"branch": "<BranchName>", "deployment_type": "staging", "commit_url": "<URL>", "sha": "de12adda500f2bc5a29dbd89f4fb1b0e1a31de81"}'
<aside> ℹ️ This command is for illustration purposes. We don’t recommend “curling” without inspecting the result as not all 200 responses imply a successful run trigger. We recommend using the SDK for that purpose as it does the interpretation work for you!
</aside>
You will find detailed documentation about this API usage here: Deploy Success Webhook.