-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Your Name
committed
Aug 6, 2024
1 parent
1444428
commit 4e724e1
Showing
557 changed files
with
139,001 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
step-templates/Azure-Backup-TableStorage-to-Blob.json.human
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"Id": "38791635-a3fc-4b26-bcd7-b65f0f6de5d2", | ||
"Name": "Azure - Backup Table Storage to Blob", | ||
"Description": "This script allow to backup the specified azure table storage into the specified blob.", | ||
"ActionType": "Octopus.Script", | ||
"Version": 6, | ||
"Properties": { | ||
"Octopus.Action.Script.Syntax": "PowerShell", | ||
"Octopus.Action.Script.ScriptSource": "Inline", | ||
"Octopus.Action.Script.ScriptBody": "if($IsEnabled -eq \"True\")\r | ||
{\r | ||
Write-Output \"Starting Backup the Azure table 'https://$sourceStorageAccountName.table.core.windows.net/$sourceTableName' to the Blob 'https://$destinationStorageAccountName.blob.core.windows.net/$sourceStorageAccountName-$sourceTableName'\"\r | ||
\r | ||
& \"${Env:ProgramFiles(x86)}\\Microsoft SDKs\\Azure\\AzCopy\\azCopy.exe\" `\r | ||
/Source:https://$sourceStorageAccountName.table.core.windows.net/$sourceTableName/ `\r | ||
/Dest:https://$destinationStorageAccountName.blob.core.windows.net/$sourceStorageAccountName-$sourceTableName/ `\r | ||
/SourceKey:$sourceStorageAccountKey `\r | ||
/Destkey:$destinationStorageAccountKey `\r | ||
/y\r | ||
\r | ||
Write-Output \"Backup Completed\"\r | ||
}\r | ||
else\r | ||
{\r | ||
Write-Output \"This Step is disabled\"\r | ||
}", | ||
"Octopus.Action.Script.ScriptFileName": null, | ||
"Octopus.Action.Package.NuGetFeedId": null, | ||
"Octopus.Action.Package.NuGetPackageId": null | ||
}, | ||
"Parameters": [ | ||
{ | ||
"Name": "sourceStorageAccountName", | ||
"Label": "Source Storage Account Name", | ||
"HelpText": "Name of the source storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "sourceStorageAccountKey", | ||
"Label": "Source Storage Account Key", | ||
"HelpText": "Key of the source storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "Sensitive" | ||
} | ||
}, | ||
{ | ||
"Name": "sourceTableName", | ||
"Label": "Source Table Name", | ||
"HelpText": "Name of the Source Azure Table", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "destinationStorageAccountName", | ||
"Label": "Destination Storage Account Name", | ||
"HelpText": "Name of the destination storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "destinationStorageAccountKey", | ||
"Label": "Destination Storage Account Key", | ||
"HelpText": "Key of the destination storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "Sensitive" | ||
} | ||
}, | ||
{ | ||
"Name": "IsEnabled", | ||
"Label": "IsEnabled", | ||
"HelpText": null, | ||
"DefaultValue": "True", | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "Select", | ||
"Octopus.SelectOptions": "True | ||
False" | ||
} | ||
} | ||
], | ||
"LastModifiedBy": "phuot", | ||
"$Meta": { | ||
"ExportedAt": "2016-11-30T16:22:50.113Z", | ||
"OctopusVersion": "3.3.22", | ||
"Type": "ActionTemplate" | ||
}, | ||
"Category": "azure" | ||
} |
141 changes: 141 additions & 0 deletions
141
step-templates/Azure-Container-Copy-to-another-Container.json.human
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
{ | ||
"Id": "bf955a12-57ee-41b0-af58-672ca48ea07d", | ||
"Name": "Azure - Copy Storage Account Containers", | ||
"Description": "Copy blobs between specified containers across two different storage accounts", | ||
"ActionType": "Octopus.Script", | ||
"Version": 1, | ||
"Properties": { | ||
"Octopus.Action.Script.Syntax": "PowerShell", | ||
"Octopus.Action.Script.ScriptSource": "Inline", | ||
"Octopus.Action.Script.ScriptBody": "# Define the source storage account and context | ||
$SourceStorageAccountName = $OctopusParameters['SourceStorageAccountName']; | ||
$SourceStorageAccountKey = $OctopusParameters['SourceStorageAccountKey']; | ||
$SourceContainerName = $OctopusParameters['SourceContainerName']; | ||
$SourceContext = New-AzureStorageContext -StorageAccountName $SourceStorageAccountName -StorageAccountKey $SourceStorageAccountKey | ||
$SourceBlobPrefix = $OctopusParameters['SourceBlobPrefix']; | ||
|
||
# Define the destination storage account and context | ||
$DestinationStorageAccountName = $OctopusParameters['DestinationStorageAccountName']; | ||
$DestinationStorageAccountKey = $OctopusParameters['DestinationStorageAccountKey']; | ||
$DestinationContainerName = $OctopusParameters['DestinationContainerName']; | ||
$DestinationContext = New-AzureStorageContext -StorageAccountName $DestinationStorageAccountName -StorageAccountKey $DestinationStorageAccountKey | ||
$DestinationBlobPrefix = $OctopusParameters['DestinationBlobPrefix']; | ||
|
||
# Check if container exists, otherwise create it | ||
$isContainerExist = Get-AzureStorageContainer -Context $DestinationContext | Where-Object { $_.Name -eq $DestinationContainerName } | ||
if($isContainerExist -eq $null) | ||
{ | ||
New-AzureStorageContainer -Name $DestinationContainerName -Context $DestinationContext | ||
} | ||
|
||
# Get a reference to blobs in the source container | ||
$blobs = $null | ||
if ($SourceBlobPrefix -eq $null) { | ||
$blobs = Get-AzureStorageBlob -Container $SourceContainerName -Context $SourceContext | ||
} | ||
else { | ||
$blobs = Get-AzureStorageBlob -Container $SourceContainerName -Context $SourceContext -Prefix $SourceBlobPrefix | ||
} | ||
|
||
# Copy blobs from one container to another | ||
if ($DestinationBlobPrefix -eq $null) { | ||
\t$blobs | Start-AzureStorageBlobCopy -DestContainer $DestinationContainerName -DestContext $DestinationContext | ||
} | ||
else { | ||
\t$uri = $SourceContext.BlobEndPoint + $SourceContainerName +\"/\" | ||
\t$blobs | ForEach-Object ` | ||
\t{ Start-AzureStorageBlobCopy ` | ||
\t -SrcUri \"$uri$($_.Name)\" ` | ||
-Context $SourceContext ` | ||
\t -DestContext $DestinationContext ` | ||
\t -DestContainer $DestinationContainerName ` | ||
\t -DestBlob \"$DestinationBlobPrefix/$($_.Name)\" ` | ||
\t } | ||
} | ||
", | ||
"Octopus.Action.Script.ScriptFileName": null, | ||
"Octopus.Action.Package.NuGetFeedId": null, | ||
"Octopus.Action.Package.NuGetPackageId": null | ||
}, | ||
"Parameters": [ | ||
{ | ||
"Name": "SourceStorageAccountName", | ||
"Label": "Source Storage Account Name", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "SourceStorageAccountKey", | ||
"Label": "Source Storage Account Key", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "SourceContainerName", | ||
"Label": "Source Container Name", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "SourceBlobPrefix", | ||
"Label": "Source Blob Prefix (Optional)", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationStorageAccountName", | ||
"Label": "Destination Storage Account Name", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationStorageAccountKey", | ||
"Label": "Destination Storage Account Key", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationContainerName", | ||
"Label": "Destination Container Name", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationBlobPrefix", | ||
"Label": "Destination Blob Prefix (Optional)", | ||
"HelpText": null, | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
} | ||
], | ||
"LastModifiedBy": "ahmedig", | ||
"$Meta": { | ||
"ExportedAt": "2016-05-12T03:09:48.287+00:00", | ||
"OctopusVersion": "3.3.9", | ||
"Type": "ActionTemplate" | ||
}, | ||
"Category": "azure" | ||
} |
139 changes: 139 additions & 0 deletions
139
step-templates/Azure-CopySelectiveStorageAccountContainersUsingAZCopy.json.human
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ | ||
"Id": "24ab7967-8ae5-4852-bfdf-4e81d57245f6", | ||
"Name": "Azure - Copy Storage Account Containers AZCopy Inline", | ||
"Description": "Copies Storage Account containers, from a source storage account to destination. It copies the containers with the same names.", | ||
"ActionType": "Octopus.Script", | ||
"Version": 2, | ||
"Properties": { | ||
"Octopus.Action.Script.ScriptSource": "Inline", | ||
"Octopus.Action.Script.Syntax": "PowerShell", | ||
"Octopus.Action.Script.ScriptBody": "$SourceStorageAccountName = $OctopusParameters['SourceStorageAccountName'];\r | ||
$SourceStorageAccountKey = $OctopusParameters['SourceStorageAccountKey'];\r | ||
$DestinationStorageAccountName = $OctopusParameters['DestinationStorageAccountName'];\r | ||
$DestinationStorageAccountKey = $OctopusParameters['DestinationStorageAccountKey'];\r | ||
$ContainersIncluded = $OctopusParameters['ContainersIncluded'];\r | ||
$ContainersExcluded = $OctopusParameters['ContainersExcluded'];\r | ||
\r | ||
$AzCopy = Join-Path ${env:ProgramFiles(x86)} \"Microsoft SDKs\\Azure\\AzCopy\\AzCopy.exe\"\r | ||
\r | ||
function AzCopyContainer($containerName)\r | ||
{\r | ||
&$AzCopy /Source:http://$($SourceStorageAccountName).blob.core.windows.net/$containerName `\r | ||
\t/Dest:http://$($DestinationStorageAccountName).blob.core.windows.net/$containerName `\r | ||
\t/SourceKey:$SourceStorageAccountKey `\r | ||
\t/DestKey:$DestinationStorageAccountKey `\r | ||
\t/S /XO /XN /V | Out-Host\r | ||
}\r | ||
\r | ||
# List all Containers\r | ||
$ctx = New-AzureStorageContext -StorageAccountName $SourceStorageAccountName -StorageAccountKey $SourceStorageAccountKey\r | ||
$containers = Get-AzureStorageContainer -Context $ctx\r | ||
\r | ||
\t\r | ||
# If Containers Included is there => Copy Included Only \r | ||
if($ContainersIncluded)\r | ||
{\r | ||
\t# Parse the Included list\r | ||
\t$ContainersIncluded.Split(\",\") | foreach {\r | ||
\t\tAzCopyContainer $_\r | ||
\t}\r | ||
}\r | ||
\r | ||
# If Containers Excluded is there, and no Included => Copy all except excluded\r | ||
elseif(!$ContainersIncluded -and $ContainersExcluded)\r | ||
{\r | ||
\t#Parse the exclusion list\r | ||
\t[Collections.Generic.List[String]]$lst = $ContainersExcluded.Split(\",\")\r | ||
\r | ||
\t# Loop through all the containers, and\r | ||
\tforeach ($container in $containers) \r | ||
\t{\r | ||
\t\tif($lst.Contains($container.Name)) {\r | ||
\t\t\tcontinue\r | ||
\t\t}\r | ||
\t\telse \r | ||
\t\t{\r | ||
\t\t\t$containerName = $container.Name\r | ||
AzCopyContainer $containerName\r | ||
\t\t}\r | ||
\t} \r | ||
}\r | ||
\r | ||
# Copy all containers\r | ||
else\r | ||
{\r | ||
\t# Loop through all the containers, and\r | ||
\tforeach ($container in $containers) \r | ||
\t{\r | ||
\t\t$containerName = $container.Name\r | ||
AzCopyContainer $containerName\r | ||
\t} \r | ||
}", | ||
"Octopus.Action.Script.ScriptFileName": null, | ||
"Octopus.Action.Package.NuGetFeedId": null, | ||
"Octopus.Action.Package.NuGetPackageId": null | ||
}, | ||
"Parameters": [ | ||
{ | ||
"Name": "SourceStorageAccountName", | ||
"Label": "Source Storage Account Name", | ||
"HelpText": "Storage Account Name of the source storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "SourceStorageAccountKey", | ||
"Label": "Source Storage Account Key", | ||
"HelpText": "Storage Account Key of the source storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationStorageAccountName", | ||
"Label": "Destination Storage Account Name", | ||
"HelpText": "Storage Account Name of the destination storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "DestinationStorageAccountKey", | ||
"Label": "Destination Storage Account Key", | ||
"HelpText": "Storage Account key of the destination storage account", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "ContainersIncluded", | ||
"Label": "Containers Included", | ||
"HelpText": "A comma separated list of containers that will be copied only, and all the rest will be excluded. If this value is filled with a value, the \"Containers Excluded\" value will be neglected.", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
}, | ||
{ | ||
"Name": "ContainersExcluded", | ||
"Label": "Containers Excluded", | ||
"HelpText": "A comma separated list of containers that will be excluded. All containers in source storage account will be copied to destination except these containers. Please note that if the \"Containers Included\" has a value, the \"Containers Excluded\" will be neglected.", | ||
"DefaultValue": null, | ||
"DisplaySettings": { | ||
"Octopus.ControlType": "SingleLineText" | ||
} | ||
} | ||
], | ||
"LastModifiedBy": "ahmedig", | ||
"$Meta": { | ||
"ExportedAt": "2016-07-24T12:55:38.909+00:00", | ||
"OctopusVersion": "3.3.22", | ||
"Type": "ActionTemplate" | ||
}, | ||
"Category": "azure" | ||
} |
Oops, something went wrong.