Octopus.Script exported 2015-08-31 by jmalczak belongs to ‘HTTP’ category.
Invoke HTTP Get request using provided url. Doesn’t throw exception when request fails.
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
Url
url
Web request Url
Script body
Steps based on this template will execute the following PowerShell script.
# Running outside octopus
param(
[string]$url,
[switch]$whatIf
)
$ErrorActionPreference = "Stop"
function Get-Param($Name, [switch]$Required, $Default) {
$result = $null
if ($OctopusParameters -ne $null) {
$result = $OctopusParameters[$Name]
}
if ($result -eq $null) {
$variable = Get-Variable $Name -EA SilentlyContinue
if ($variable -ne $null) {
$result = $variable.Value
}
}
if ($result -eq $null -or $result -eq "") {
if ($Required) {
throw "Missing parameter value $Name"
} else {
$result = $Default
}
}
return $result
}
& {
param(
[string]$url
)
Write-Host "Invoke Url: $url"
try {
Invoke-WebRequest -Uri $url -Method Get -UseBasicParsing
} catch {
Write-Host "There was a problem invoking Url"
}
} `
(Get-Param 'url' -Required)
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "bb2a8fef-1407-405b-9251-a259c1868bad",
"Name": "HTTP - Invoke URL",
"Description": "Invoke HTTP Get request using provided url. Doesn't throw exception when request fails.",
"Version": 2,
"ExportedAt": "2015-08-31T12:25:19.923+00:00",
"ActionType": "Octopus.Script",
"Author": "jmalczak",
"Parameters": [
{
"Name": "url",
"Label": "Url",
"HelpText": "Web request Url",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"Properties": {
"Octopus.Action.Script.ScriptBody": "# Running outside octopus\nparam(\n [string]$url,\n [switch]$whatIf\n) \n\n$ErrorActionPreference = \"Stop\" \n\nfunction Get-Param($Name, [switch]$Required, $Default) {\n $result = $null\n\n if ($OctopusParameters -ne $null) {\n $result = $OctopusParameters[$Name]\n }\n\n if ($result -eq $null) {\n $variable = Get-Variable $Name -EA SilentlyContinue \n if ($variable -ne $null) {\n $result = $variable.Value\n }\n }\n\n if ($result -eq $null -or $result -eq \"\") {\n if ($Required) {\n throw \"Missing parameter value $Name\"\n } else {\n $result = $Default\n }\n }\n\n return $result\n}\n\n& {\n param(\n [string]$url\n ) \n\n Write-Host \"Invoke Url: $url\"\n\n try {\n \n Invoke-WebRequest -Uri $url -Method Get -UseBasicParsing\n\n } catch {\n Write-Host \"There was a problem invoking Url\" \n }\n\n } `\n (Get-Param 'url' -Required)",
"Octopus.Action.Script.Syntax": "PowerShell"
},
"Category": "HTTP",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/http-invoke-url.json",
"Website": "/step-templates/bb2a8fef-1407-405b-9251-a259c1868bad",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB1dJREFUeNrsnc8uO18Yh1ERoRKJ+CYkLNljzwVwAXoBdQHs6V7t6wLaC+AC2GPPykJIxM6fECm/T3qS8zumM9PTabUz+jyr0Z7OTOc8877vnDlTw9/f30MA3WYYsQCxALEAsTgKgFiAWIBYAIgFiAWIBYBYgFiAWACIBYgFiAWAWIBYgFgAiAWIBYgFgFiAWIBYAIgFiAWIBYBYgFiAWACIBYgFiNXM19fX+/s7x25AGB8fHxkZafdTowm2JBfr9TpHfEBIltNGOHDwGyAWIBYgFiAWAGIBYgFiASAWIBYgFgBiAWIBYgEgFiAWIBYAYgFiAWIBIBYgFiAWAGIBYgFiASAWIBYgFkByRnu/ybe3N457hhgeHs7n8+kV6+vr6+npSVZNT0/ncjk6LCt8fHwkECvJD6/V6/V2o46suru7m52d/ffvH12VLWSIglZKxXp8fFSgmpmZoZ8GRKxeFO+fn58Kp1jFVWH3xVK44lgjFgBiAWIBYgEgFiAWIBYAYgFiAWIBIBYgFiAWAGJBahjNyo5eXl7a5aWlpampKTpPHBwc3N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nOzA7qRD7Eygyhg+lRDZJV8W3NaIiRD7EyJtbz83PUu3rLncPTcjQ1NNX6PB7Y3xkNgy5WuzkiZpaV26ZcLke9G5gAGPUsvGcmjSqePOVDrF5QrVZ9njH0mTN4enoa+ssIetG9OVgsFkMv1qTOmkNgoo7P44E+8vWMQXwS2p1ooEBSKBT0ihaKDczrgc4rlUom6ugaPmZulgRS725vb5s7PNfX17VazZ1hIS30bic1XAqfTUWsyFRo8pQ7ZLDUwA1mpk1UeDNqDjUm6hwdHYW2UUEdNdunZchM87OppML/pdnf3w+tUQIprPk/i6qDQ4t0NY6f+aR3lXaT3RJu99nUvhdYWYpYZip6aJ4KYOetx6DyWc3U03beUrNDZkZypVJxB4e0ZsWk5h3QK8qVMkAfCUQ1KaVs27KzA7vtziBt99nUNIjVi/+wqsb6SL/mb/we7tx59ye77AN9cqUrg0k+02C0RRNKu7VRS7L/sDqINdZvYyYZd3GFPmtL2+RHBkgBsQCxALEAEAsQCwYZhhuSs7W1Ze8OpfaXlfsFA6TQgmQDpKRCoMYCxALEAkAsQCxALIBsilWv1znWiNVlxsfHYx7mBMRKuo2RkcnJydvbWw734NCLWzqGx8dHbWtxcXFsbIzjniGS3dLpnVji9fVVOfH9/R23MsTExMTCwkKqxYKMipXL5RhugEEabgDEAkAsQCxALADEAsQCxAJALEAsQCwAxALEAsQCQCxALEAsAMQCxALEAkAsQCxALADEAsSCv0qSR+wBEAsQCxALALEAsQCxABALEAsQCwCxALEAsQAQCxALEAsAsQCxALEAEAsQCxALALEAsQCxABALEAsQCwCxALEAsQAQCxALMsV/AgwA3l1/9Yi7khIAAAAASUVORK5CYII=",
"$Meta": {
"Type": "ActionTemplate"
}
}
Page updated on Monday, August 31, 2015