Testery - Report Deployment

Octopus.Script exported 2020-10-29 by bobjwalker belongs to ‘Testery’ category.

Reports a deployment to Testery, enabling you to do post-deployment validation and testing. See https://testery.io for more info.

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

Testery Git Reference

TesteryGitReference =

The git hash of the commit for the version of the tests to be run.

Testery Token

TesteryToken =

Your Testery API token (found in Testery -> Settings -> Integrations -> Show API Token)

Testery Project Name

TesteryProjectName =

The name of the test project in the Testery platform.

Testery Environment

TesteryEnvironment =

The name of the environment defined in Testery where you want the tests to run. It may be useful to set this to Octopus.Deployment.Tenant.Name.

Testery Build Id

TesteryBuildId =

The build ID from your CI/CD. If you have uploaded any test artifacts from your CI/CD, this build id should match the build id used when uploading artifacts.

Testery Fail On Failure

TesteryFailOnFailure =

When checked, the Octopus deployment will fail if any of the test runs associated with the deployment fail. When unchecked, the Octopus deployment will continue even if there are test failures.

Testery Wait For Results

TesteryWaitForResults =

When checked, Octopus Deploy will wait for the any test runs associated with the deployment to complete before proceeding. This is useful for making sure deployments don’t run on environments/tenants with an active test run.

Script body

Steps based on this template will execute the following PowerShell script.

try {$pipCmd = get-command pip} catch {}
if (!($pipCmd)) {
	Fail-Step "This step template requires Python 3.6 or greater and pip to be installed. Python is available at https://www.python.org/downloads/"
}

pip -q install testery --upgrade

write-output "Fail on failure: ${TesteryFailOnFailure}"


if (${TesteryFailOnFailure}) {
  write-output "Fail on failure option selected."
  $failOnFailureSwitch="--fail-on-failure"
} else {
  write-output "Fail on failure option not selected."
  $failOnFailureSwitch=""
}

if (${TesteryWaitForResults}) {
  $waitForResultsSwitch="--wait-for-results"
} else {
  $waitForResultsSwitch=""
}

echo "Reporting deployment info to Testery..."
testery create-deploy --commit "${TesteryGitReference}" --token "${TesteryToken}" --project "${TesteryProjectName}" --environment "${TesteryEnvironment}" --build-id "${TesteryBuildId}" "${failOnFailureSwitch}" "${waitForResultsSwitch}"

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "9c85f96e-09d3-4814-948a-aef8708740b5",
  "Name": "Testery - Report Deployment",
  "Description": "Reports a deployment to Testery, enabling you to do post-deployment validation and testing. See https://testery.io for more info.",
  "Version": 4,
  "ExportedAt": "2020-10-29T16:37:27.511Z",
  "ActionType": "Octopus.Script",
  "Author": "bobjwalker",
  "Packages": [],
  "Parameters": [
    {
      "Id": "f96b7529-7ced-4265-8176-972ec30b9bba",
      "Name": "TesteryGitReference",
      "Label": "Testery Git Reference",
      "HelpText": "The git hash of the commit for the version of the tests to be run.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "f01f917a-b2c8-4038-be1c-b2355639f57e",
      "Name": "TesteryToken",
      "Label": "Testery Token",
      "HelpText": "Your Testery API token (found in Testery -> Settings -> Integrations -> Show API Token)",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "Sensitive"
      }
    },
    {
      "Id": "4873b6f2-694a-463f-928a-9845b044bc8b",
      "Name": "TesteryProjectName",
      "Label": "Testery Project Name",
      "HelpText": "The name of the test project in the Testery platform.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "811352ba-a3e4-4092-99c2-b48499b9a880",
      "Name": "TesteryEnvironment",
      "Label": "Testery Environment",
      "HelpText": "The name of the environment defined in Testery where you want the tests to run. It may be useful to set this to Octopus.Deployment.Tenant.Name.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "7a6aa01f-13a1-4fa7-a681-7f0acda63932",
      "Name": "TesteryBuildId",
      "Label": "Testery Build Id",
      "HelpText": "The build ID from your CI/CD. If you have uploaded any test artifacts from your CI/CD, this build id should match the build id used when uploading artifacts.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "09ed4f34-d381-4f85-8869-c52264694b7c",
      "Name": "TesteryFailOnFailure",
      "Label": "Testery Fail On Failure",
      "HelpText": "When checked, the Octopus deployment will fail if any of the test runs associated with the deployment fail. When unchecked, the Octopus deployment will continue even if there are test failures.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "Checkbox"
      }
    },
    {
      "Id": "2266652a-258d-447f-aebf-14e9575d6b9d",
      "Name": "TesteryWaitForResults",
      "Label": "Testery Wait For Results",
      "HelpText": "When checked, Octopus Deploy will wait for the any test runs associated with the deployment to complete before proceeding. This is useful for making sure deployments don't run on environments/tenants with an active test run.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "Checkbox"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.RunOnServer": "true",
    "Octopus.Action.Script.ScriptSource": "Inline",
    "Octopus.Action.Script.Syntax": "PowerShell",
    "Octopus.Action.Script.ScriptBody": "try {$pipCmd = get-command pip} catch {}\nif (!($pipCmd)) {\n\tFail-Step \"This step template requires Python 3.6 or greater and pip to be installed. Python is available at https://www.python.org/downloads/\"\n}\n\npip -q install testery --upgrade\n\nwrite-output \"Fail on failure: ${TesteryFailOnFailure}\"\n\n\nif (${TesteryFailOnFailure}) {\n  write-output \"Fail on failure option selected.\"\n  $failOnFailureSwitch=\"--fail-on-failure\"\n} else {\n  write-output \"Fail on failure option not selected.\"\n  $failOnFailureSwitch=\"\"\n}\n\nif (${TesteryWaitForResults}) {\n  $waitForResultsSwitch=\"--wait-for-results\"\n} else {\n  $waitForResultsSwitch=\"\"\n}\n\necho \"Reporting deployment info to Testery...\"\ntestery create-deploy --commit \"${TesteryGitReference}\" --token \"${TesteryToken}\" --project \"${TesteryProjectName}\" --environment \"${TesteryEnvironment}\" --build-id \"${TesteryBuildId}\" \"${failOnFailureSwitch}\" \"${waitForResultsSwitch}\"\n"
  },
  "Category": "Testery",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/testery-report-deployment.json",
  "Website": "/step-templates/9c85f96e-09d3-4814-948a-aef8708740b5",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAALcAAACqCAYAAADvJt7aAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAbYSURBVHhe7Z3BkSNFEEV3sQATwAM8AM5c1gRM4MAdrpwAD8ADjtyAG0fwYPFgsQDqh6ZjZxTZ6q6u6urMrPcifoxiY9QhzT691WpmWq9gat6UfXm7CJCLt2X/PX1EckiDZJbYz4fkkIKl2taQHMJiVdsakkM4HlXbGpJDCPZW2xqSg2tqq20NycEdLdW2huTghh7VtqbjflYGcAm9q23t9zIkh+GcVW1rSA7DGFFta0gOp/Jh2chqW0NyOIVvyyzhrhiSQzdU7XdllmhXDsmhGU/VtobkcAiv1baG5FCF92pbQ3LYJFK1rSE5rBKx2taQHF4QvdrWDkn++uljFD4p018erPNF2de3i+n4o0z/Kkn2dOhOWY9s9n4tP4KqOlrH9LZdJf/g6SPk4J+yn24XU/Np2W9lDyVH7lzon+yZeCg5cudhlmpbSHLkTsxs1X7Ov2U/3C6+B7lzMHO1hcTWy58vQO4cUG0D5I4P1TaqLZA7PlR7BeSODdVeqbZA7thQ7Qcgd1yo9oNqC+SOC9XeALljQrU3qi2QOyZUewfIHQ+qvaPaArnjQbV3gtyxoNo7qy2QOxZUuwLkjgPVrqi2QO44UO1KkDsGVLuy2gK5YzBztfXArq62QG7/zF5tPbCrqy2Q2z+zV/vwAxu5fUO1G4h2OjWdn0K/xj8L35X9ers4BJ2u7vvbxcvRA/uj20U4i6tO4Xb1mzRdveZ3JuZpiV94rt0IcvuE59odQG6fUO0OILc/qHYnkNsfVLsTyO0LvXMA1YZhjHwp8P40vNbnZJ1e+uwK5faDqq0H0qykrfZXZZvvcXIRo8pt3X/r8zKue7W9oG+xLndSInmTfITca8W2Pjfjmr8b6RX9B+r+znqSfITca/fV+txsm6La1jxIfrbca9UW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Usd/pqi6jlvkcVelP2eZm+2wbrUO3g6FUA/YfJqlbtspV7imqLLOW+R2JLcEr+EqqdkJaSZyr3NNUWr58+zoIkl6w1p4i78ifmvnn62ANVW68wQXJ6PiePsqmqDfNIrm94waRkl5xqQ0rJqTa8IJPkVBtMoktOtWGTqJJTbdhNJMmpNhwiguRUG5rwKjnVhm54k5xqQ3c8SE614VSulJxqwxBGS061YTijJKfacBmSXO/KbInZOqoNLtAvDejXvSxJj45qgyt6SU61wS2tklNtcM8Ryak2hKJGcqoNIdmSnGpDeNYkp9qQhueSU21IiSSn2gAAAAAAAAAAAACvXv0P3aW8VNTlYhYAAAAASUVORK5CYII=",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Thursday, October 29, 2020