|
| 1 | +{ |
| 2 | + "Id": "b8e9e58d-f37f-48a5-a946-6da1a40742fa", |
| 3 | + "Name": "Testery - Create Environment", |
| 4 | + "Description": "Create an environment in your Testery account", |
| 5 | + "ActionType": "Octopus.Script", |
| 6 | + "Version": 1, |
| 7 | + "CommunityActionTemplateId": null, |
| 8 | + "Packages": [], |
| 9 | + "GitDependencies": [], |
| 10 | + "Properties": { |
| 11 | + "Octopus.Action.Script.ScriptSource": "Inline", |
| 12 | + "Octopus.Action.Script.Syntax": "Bash", |
| 13 | + "Octopus.Action.Script.ScriptBody": "set -e\n\nTOKEN=$(get_octopusvariable \"TesteryToken\")\nPIPELINE_STAGE=$(get_octopusvariable \"TesteryPipelineStage?\")\nVARIABLES=$(get_octopusvariable \"TesteryVariables?\")\nNAME=$(get_octopusvariable \"TesteryName\")\nKEY=$(get_octopusvariable \"TesteryKey\")\nMAX_PARALLEL=$(get_octopusvariable \"TesteryMaximumParallelTestRuns\")\nFAIL_IF_EXIST=$(get_octopusvariable \"TesteryExistsExitCode\")\nif [ \"$FAIL_IF_EXIST\" = \"True\" ] ; then\n EXIST_EXIT=1\nelse\n EXIST_EXIT=0\nfi\nVAR_ARGS=()\nif [[ -n \"$VARIABLES\" ]]; then\n mapfile -t VAR_LINES <<< \"$VARIABLES\"\n for line in \"${VAR_LINES[@]}\"; do\n [[ -z \"$line\" ]] && continue\n VAR_ARGS+=(\"--variable\" \"$line\")\n done\nfi\n\nAPI_URL=\"https://api.testery.io/api/environments\"\nHTTP_RESPONSE=$(curl -s -w \"\\n%{http_code}\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -H \"Content-Type: application/json\" \\\n \"$API_URL\")\n\nHTTP_BODY=$(echo \"$HTTP_RESPONSE\" | sed '$d')\nHTTP_STATUS=$(echo \"$HTTP_RESPONSE\" | tail -n1)\n\n# Check if the request was successful\nif [ \"$HTTP_STATUS\" -ne 200 ]; then\n echo \"Error querying API:\"\n echo \"Status Code: $HTTP_STATUS\"\n echo \"Response: $HTTP_BODY\"\n exit 1\nfi\n\nexport PATH=\"$HOME/.local/bin:$PATH\"\n\n# Check if an environment with the key exists using jq\nENVIRONMENT_EXISTS=$(echo \"$HTTP_BODY\" | jq -r --arg KEY \"$KEY\" '.[] | select(.key == $KEY) | .key')\n\nif [ -n \"$ENVIRONMENT_EXISTS\" ]; then\n echo \"Environment with key already exists.\"\n exit $EXIST_EXIT\nelse\n pip install --user testery --upgrade\n\n testery create-environment --token $TOKEN \\\n --name $NAME \\\n --key $KEY \\\n --maximum-parallel-test-runs $MAX_PARALLEL \\\n ${PIPELINE_STAGE:+ --pipeline-stage \"$PIPELINE_STAGE\"} \\\n ${VAR_ARGS:+ \"${VAR_ARGS[@]}\"}\nfi\n" |
| 14 | + }, |
| 15 | + "Parameters": [ |
| 16 | + { |
| 17 | + "Id": "24613821-17c6-4648-b262-66d42c302e0f", |
| 18 | + "Name": "TesteryToken", |
| 19 | + "Label": "Token", |
| 20 | + "HelpText": "API token for your account. Found under Settings > Integrations", |
| 21 | + "DefaultValue": "", |
| 22 | + "DisplaySettings": { |
| 23 | + "Octopus.ControlType": "Sensitive" |
| 24 | + } |
| 25 | + }, |
| 26 | + { |
| 27 | + "Id": "54552cae-ed27-4b1a-a2df-85fd0a6b9018", |
| 28 | + "Name": "TesteryName", |
| 29 | + "Label": "Name", |
| 30 | + "HelpText": "The display name for the environment", |
| 31 | + "DefaultValue": "", |
| 32 | + "DisplaySettings": { |
| 33 | + "Octopus.ControlType": "SingleLineText" |
| 34 | + } |
| 35 | + }, |
| 36 | + { |
| 37 | + "Id": "1ba0af3c-9af0-46cd-896e-c42d0844fb25", |
| 38 | + "Name": "TesteryKey", |
| 39 | + "Label": "Key", |
| 40 | + "HelpText": "The unique identifier for the environment", |
| 41 | + "DefaultValue": "", |
| 42 | + "DisplaySettings": { |
| 43 | + "Octopus.ControlType": "SingleLineText" |
| 44 | + } |
| 45 | + }, |
| 46 | + { |
| 47 | + "Id": "051c9281-2cd6-404c-980d-05d1b608bbd2", |
| 48 | + "Name": "TesteryMaximumParallelTestRuns", |
| 49 | + "Label": "Maximum Parallel Test Run", |
| 50 | + "HelpText": "The maximum number of test runs that can run in parallel on this environment.\nDefault is 0 (no limit).", |
| 51 | + "DefaultValue": "0", |
| 52 | + "DisplaySettings": { |
| 53 | + "Octopus.ControlType": "SingleLineText" |
| 54 | + } |
| 55 | + }, |
| 56 | + { |
| 57 | + "Id": "9cef03c4-ab66-498a-89f7-22552be12568", |
| 58 | + "Name": "TesteryPipelineStage?", |
| 59 | + "Label": "Pipeline Stage?", |
| 60 | + "HelpText": "The name of a pipeline stage to associate this environment to.", |
| 61 | + "DefaultValue": "", |
| 62 | + "DisplaySettings": { |
| 63 | + "Octopus.ControlType": "SingleLineText" |
| 64 | + } |
| 65 | + }, |
| 66 | + { |
| 67 | + "Id": "78d55e55-d4d8-432e-a4f1-09c7fbe62576", |
| 68 | + "Name": "TesteryVariables?", |
| 69 | + "Label": "Variables?", |
| 70 | + "HelpText": "Add variable to the environment. Specified as \"KEY=VALUE\". To encrypt value, pass in \"secure:KEY=VALUE\", Multiple variables can be provided. Put each variable on a separate line.\n\nExample:\n```\nFOO=BAR\nsecure:HELLO=WORLD\n```", |
| 71 | + "DefaultValue": "", |
| 72 | + "DisplaySettings": { |
| 73 | + "Octopus.ControlType": "MultiLineText" |
| 74 | + } |
| 75 | + }, |
| 76 | + { |
| 77 | + "Id": "a49dddf4-5af9-44ae-b682-9ab11e41d506", |
| 78 | + "Name": "TesteryExistsExitCode", |
| 79 | + "Label": "Fail if already exists?", |
| 80 | + "HelpText": "Mark if you want the step to fail if the environment already exists", |
| 81 | + "DefaultValue": "", |
| 82 | + "DisplaySettings": { |
| 83 | + "Octopus.ControlType": "Checkbox" |
| 84 | + } |
| 85 | + } |
| 86 | + ], |
| 87 | + "StepPackageId": "Octopus.Script", |
| 88 | + "$Meta": { |
| 89 | + "ExportedAt": "2026-02-13T21:32:11.229Z", |
| 90 | + "OctopusVersion": "2026.1.7285", |
| 91 | + "Type": "ActionTemplate" |
| 92 | + }, |
| 93 | + "LastModifiedBy": "wgunn-testery", |
| 94 | + "Category": "testery" |
| 95 | +} |
0 commit comments