Octopus.Script exported 2021-09-06 by elmahio belongs to ‘ELMAH’ category.
Step template for uploading a source map and a minified JavaScript file to elmah.io.
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
API Key
ElmahIoSourceMap_ApiKey
Required: Input your elmah.io API key located on the organization settings page.
Log ID
ElmahIoSourceMap_LogId
Required: The ID of the log which should contain the minified JavaScript and source map.
Path
ElmahIoSourceMap_Path
Required: An URL to the online minified JavaScript file. The URL can be absolute or relative but will always be converted to a relative path (no protocol, domain, and query parameters). elmah.io uses this path to lookup any lines in a JS stack trace that will need de-minification.
Source Map
ElmahIoSourceMap_SourceMap
Required: A path to the source map file. Only files with an extension of .map and content type of application/json will be accepted.
Minified JavaScript
ElmahIoSourceMap_MinifiedJavaScript
Required: A path to the minified JavaScript file. Only files with an extension of .js and content type of text/javascript will be accepted.
Script body
Steps based on this template will execute the following PowerShell script.
$apiKey = $OctopusParameters['ElmahIoSourceMap_ApiKey']
$logId = $OctopusParameters['ElmahIoSourceMap_LogId']
$path = $OctopusParameters['ElmahIoSourceMap_Path']
$sourceMap = $OctopusParameters['ElmahIoSourceMap_SourceMap']
$minifiedJavaScript = $OctopusParameters['ElmahIoSourceMap_MinifiedJavaScript']
$boundary = [System.Guid]::NewGuid().ToString()
$mapFile = [System.IO.File]::ReadAllBytes($sourceMap)
$mapContent = [System.Text.Encoding]::UTF8.GetString($mapFile)
$mapFileName = Split-Path $sourceMap -leaf
$jsFile = [System.IO.File]::ReadAllBytes($minifiedJavaScript)
$jsContent = [System.Text.Encoding]::UTF8.GetString($jsFile)
$jsFileName = Split-Path $minifiedJavaScript -leaf
$LF = "`r`n"
$bodyLines = (
"--$boundary",
"Content-Disposition: form-data; name=`"Path`"$LF",
$path,
"--$boundary",
"Content-Disposition: form-data; name=`"SourceMap`"; filename=`"$mapFileName`"",
"Content-Type: application/json$LF",
$mapContent,
"--$boundary",
"Content-Disposition: form-data; name=`"MinifiedJavaScript`"; filename=`"$jsFileName`"",
"Content-Type: text/javascript$LF",
$jsContent,
"--$boundary--$LF"
) -join $LF
Invoke-RestMethod "https://api.elmah.io/v3/sourcemaps/${logId}?api_key=${apiKey}" -Method POST -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $bodyLines
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": "0EAF2914-E291-4CCF-833C-25EA769BF82B",
"Name": "elmah.io - Upload Source Map",
"Description": "Step template for uploading a source map and a minified JavaScript file to elmah.io.",
"Version": 2,
"ExportedAt": "2021-09-06T08:51:54.463Z",
"ActionType": "Octopus.Script",
"Author": "elmahio",
"Parameters": [
{
"Id": "01c70303-6af5-4b44-992d-e2b104fdd433",
"Name": "ElmahIoSourceMap_ApiKey",
"Label": "API Key",
"HelpText": "Required: Input your elmah.io API key located on the organization settings page.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "Sensitive"
}
},
{
"Id": "b7963b69-c261-4008-a1ac-65133eead721",
"Name": "ElmahIoSourceMap_LogId",
"Label": "Log ID",
"HelpText": "Required: The ID of the log which should contain the minified JavaScript and source map.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "4a72b7bd-5a74-4038-b4e4-8dfd0f7231e7",
"Name": "ElmahIoSourceMap_Path",
"Label": "Path",
"HelpText": "Required: An URL to the online minified JavaScript file. The URL can be absolute or relative but will always be converted to a relative path (no protocol, domain, and query parameters). elmah.io uses this path to lookup any lines in a JS stack trace that will need de-minification.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "d774ab07-f626-4d2d-baa7-62a06fed7ff6",
"Name": "ElmahIoSourceMap_SourceMap",
"Label": "Source Map",
"HelpText": "Required: A path to the source map file. Only files with an extension of .map and content type of application/json will be accepted.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Id": "c2ca2875-21dc-4633-ab38-fa5e84f34f74",
"Name": "ElmahIoSourceMap_MinifiedJavaScript",
"Label": "Minified JavaScript",
"HelpText": "Required: A path to the minified JavaScript file. Only files with an extension of .js and content type of text/javascript will be accepted.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"Properties": {
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
"Octopus.Action.RunOnServer": "false",
"Octopus.Action.Script.ScriptBody": "$apiKey = $OctopusParameters['ElmahIoSourceMap_ApiKey']\n$logId = $OctopusParameters['ElmahIoSourceMap_LogId']\n$path = $OctopusParameters['ElmahIoSourceMap_Path']\n$sourceMap = $OctopusParameters['ElmahIoSourceMap_SourceMap']\n$minifiedJavaScript = $OctopusParameters['ElmahIoSourceMap_MinifiedJavaScript']\n$boundary = [System.Guid]::NewGuid().ToString()\n\n$mapFile = [System.IO.File]::ReadAllBytes($sourceMap)\n$mapContent = [System.Text.Encoding]::UTF8.GetString($mapFile)\n$mapFileName = Split-Path $sourceMap -leaf\n$jsFile = [System.IO.File]::ReadAllBytes($minifiedJavaScript)\n$jsContent = [System.Text.Encoding]::UTF8.GetString($jsFile)\n$jsFileName = Split-Path $minifiedJavaScript -leaf\n\n$LF = \"`r`n\"\n$bodyLines = (\n \"--$boundary\",\n \"Content-Disposition: form-data; name=`\"Path`\"$LF\",\n $path,\n \"--$boundary\",\n \"Content-Disposition: form-data; name=`\"SourceMap`\"; filename=`\"$mapFileName`\"\",\n \"Content-Type: application/json$LF\",\n $mapContent,\n \"--$boundary\",\n \"Content-Disposition: form-data; name=`\"MinifiedJavaScript`\"; filename=`\"$jsFileName`\"\",\n \"Content-Type: text/javascript$LF\",\n $jsContent,\n \"--$boundary--$LF\"\n) -join $LF\n\nInvoke-RestMethod \"https://api.elmah.io/v3/sourcemaps/${logId}?api_key=${apiKey}\" -Method POST -ContentType \"multipart/form-data; boundary=`\"$boundary`\"\" -Body $bodyLines",
"Octopus.Action.Script.ScriptFileName": null,
"Octopus.Action.Package.FeedId": null,
"Octopus.Action.Package.PackageId": null
},
"Category": "ELMAH",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/elmahio-upload-source-map.json",
"Website": "/step-templates/0EAF2914-E291-4CCF-833C-25EA769BF82B",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRF////B6mdqOHd1PDuNrmvfNHLV8S9Gq+k3DhZ2AAABP5JREFUeNrsXNl2qzAMrLX5///4kqUNBDCWLIOTq3noS3JKBm0jWfDzEwgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBD4NuAEuP3BD+bALEQ53ZGJhOHz2CD8MlgiC3wUDaG0C+JPsQsUWDzd7BPMAjkdY3wqIKkOWYZ2sFoadyo8cIwnFUY1SlV0LBPYkJHCSY8R3UuSCfwN9hiRiZnHYEwkpa9gwil9BRNo45HyIFkYcyORRPj5AfKs8V/CI6UBnAs9eKSM32GQpXMBsMjZHT748PgzCfK8v5TzyJATkYdJUPJFstLLIBNwssZ1VYb8iMhuPTqhAWuvhbM7ny9sJbnyJ+acxy79FZ5F/Bj9guRxS/9xl77oykFGZXLkWauE05Dk+ELP2kickIcUMYZLv8++MiDQ1SYBi6JFWn2pLol3NAmb7iCsY5gvNgnbUr8sdEk9EbpGwUNNB8OqVgCvSFolj6a3e1yblC8hIjUuCTrl2StIkAx3by5VSNljyjBEkGWmHp/1sl5BdyOSNSFyI7H5u+oFGF1BZNef3rkqRMu1FkFg2jziUUZ6TwV8GCOI2yRmwxGNHu5FpOgUePMn2mm0jE1/nynEgWalTRKrOZWqQelREFcn0Rm2Y6FAQju9yD3kYt7qoZDz3poD7+1rKVyrQ2HnvThcTwpTpuLcUy4Mka2KLn/JNr/nJ3QaVdIp5WNeN/LLnxxHfO6T050rz4aBU6gUgs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