Skip to content

Commit

Permalink
Letting the user skip scoping if it already exists. Adding tenant tag…
Browse files Browse the repository at this point in the history
… check
  • Loading branch information
BobJWalker committed Nov 15, 2021
1 parent 01e3412 commit f7d8e0f
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 53 deletions.
5 changes: 4 additions & 1 deletion CloneLibraryVariableSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ param (
$VariableMachineScopingMatch,
$VariableAccountScopingMatch,
$VariableCertificateScopingMatch,
$VariableTenantTagScopingMatch,
$WhatIf
)

Expand All @@ -42,6 +43,7 @@ $VariableActionScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "Va
$VariableMachineScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableMachineScopingMatch" -ParameterValue $VariableMachineScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableAccountScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableAccountScopingMatch" -ParameterValue $VariableAccountScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableCertificateScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableCertificateScopingMatch" -ParameterValue $VariableCertificateScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableTenantTagScopingMatch" -ParameterValue $VariableTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $true

$IgnoreVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $IgnoreVersionCheckResult -parameterName "IgnoreVersionCheckResult" -defaultValue $false
$SkipPausingWhenIgnoringVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $SkipPausingWhenIgnoringVersionCheckResult -parameterName "SkipPausingWhenIgnoringVersionCheckResult" -defaultValue $false
Expand All @@ -50,14 +52,15 @@ $WhatIf = Test-OctopusTrueFalseParameter -parameterValue $WhatIf -parameterName
$CloneScriptOptions = @{
OverwriteExistingVariables = $OverwriteExistingVariables;
LibraryVariableSetsToClone = $SourceVariableSetName;
DestinationVariableSetName = $DestinationVariableSetName;
DestinationVariableSetName = $DestinationVariableSetName;
VariableChannelScopingMatch = $VariableChannelScopingMatch;
VariableEnvironmentScopingMatch = $VariableEnvironmentScopingMatch;
VariableProcessOwnerScopingMatch = $VariableProcessOwnerScopingMatch;
VariableActionScopingMatch = $VariableActionScopingMatch;
VariableMachineScopingMatch = $VariableMachineScopingMatch;
VariableAccountScopingMatch = $VariableAccountScopingMatch;
VariableCertificateScopingMatch = $VariableCertificateScopingMatch;
VariableTenantTagScopingMatch = $VariableTenantTagScopingMatch;
}

Write-OctopusVerbose "The clone parameters sent in are:"
Expand Down
9 changes: 9 additions & 0 deletions CloneSpace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ param (
$CloneTenantVariables,
$ProcessEnvironmentScopingMatch,
$ProcessChannelScopingMatch,
$ProcessTenantTagScopingMatch,
$VariableChannelScopingMatch,
$VariableEnvironmentScopingMatch,
$VariableProcessOwnerScopingMatch,
$VariableActionScopingMatch,
$VariableMachineScopingMatch,
$VariableAccountScopingMatch,
$VariableCertificateScopingMatch,
$VariableTenantTagScopingMatch,
$InfrastructureEnvironmentScopingMatch,
$InfrastructureTenantScopingMatch,
$InfrastructureTenantTagScopingMatch,
$ProcessCloningOption,
$WhatIf
)
Expand Down Expand Up @@ -117,6 +120,7 @@ if ($null -ne $CertificatesToClone -and $CertificatesToClone.ToLower().Trim() -e
$ProcessCloningOption = Test-OctopusProcessCloningParameter -ParameterValue $ProcessCloningOption
$ProcessEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessEnvironmentScopingMatch" -ParameterValue $ProcessEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessChannelScopingMatch" -ParameterValue $ProcessChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessTenantTagScopingMatch" -ParameterValue $ProcessTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$VariableChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableChannelScopingMatch" -ParameterValue $VariableChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableEnvironmentScopingMatch" -ParameterValue $VariableEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
Expand All @@ -125,9 +129,11 @@ $VariableActionScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "Va
$VariableMachineScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableMachineScopingMatch" -ParameterValue $VariableMachineScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableAccountScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableAccountScopingMatch" -ParameterValue $VariableAccountScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableCertificateScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableCertificateScopingMatch" -ParameterValue $VariableCertificateScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableTenantTagScopingMatch" -ParameterValue $VariableTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$InfrastructureEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureEnvironmentScopingMatch" -ParameterValue $InfrastructureEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$InfrastructureTenantScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureTenantScopingMatch" -ParameterValue $InfrastructureTenantScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$InfrastructureTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureTenantTagScopingMatch" -ParameterValue $InfrastructureTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$IgnoreVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $IgnoreVersionCheckResult -parameterName "IgnoreVersionCheckResult" -defaultValue $false
$SkipPausingWhenIgnoringVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $SkipPausingWhenIgnoringVersionCheckResult -parameterName "SkipPausingWhenIgnoringVersionCheckResult" -defaultValue $false
Expand Down Expand Up @@ -167,15 +173,18 @@ $CloneScriptOptions = @{
CloneTenantVariables = $CloneTenantVariables;
ProcessEnvironmentScopingMatch = $ProcessEnvironmentScopingMatch;
ProcessChannelScopingMatch = $ProcessChannelScopingMatch;
ProcessTenantTagScopingMatch = $ProcessTenantTagScopingMatch;
VariableChannelScopingMatch = $VariableChannelScopingMatch;
VariableEnvironmentScopingMatch = $VariableEnvironmentScopingMatch;
VariableProcessOwnerScopingMatch = $VariableProcessOwnerScopingMatch;
VariableActionScopingMatch = $VariableActionScopingMatch;
VariableMachineScopingMatch = $VariableMachineScopingMatch;
VariableAccountScopingMatch = $VariableAccountScopingMatch;
VariableCertificateScopingMatch = $VariableCertificateScopingMatch;
VariableTenantTagScopingMatch = $VariableTenantTagScopingMatch;
InfrastructureEnvironmentScopingMatch = $InfrastructureEnvironmentScopingMatch;
InfrastructureTenantScopingMatch = $InfrastructureTenantScopingMatch;
InfrastructureTenantTagScopingMatch = $InfrastructureTenantTagScopingMatch;
ProcessCloningOption = $ProcessCloningOption;
}

Expand Down
13 changes: 12 additions & 1 deletion CloneSpaceProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ param (
$ClonePackages,
$ProcessEnvironmentScopingMatch,
$ProcessChannelScopingMatch,
$ProcessTenantTagScopingMatch,
$VariableChannelScopingMatch,
$VariableEnvironmentScopingMatch,
$VariableProcessOwnerScopingMatch,
$VariableActionScopingMatch,
$VariableMachineScopingMatch,
$VariableAccountScopingMatch,
$VariableCertificateScopingMatch,
$VariableTenantTagScopingMatch,
$InfrastructureEnvironmentScopingMatch,
$InfrastructureTenantScopingMatch,
$InfrastructureTenantTagScopingMatch,
$ProcessCloningOption,
$IgnoreVersionCheckResult,
$SkipPausingWhenIgnoringVersionCheckResult,
Expand Down Expand Up @@ -66,9 +69,9 @@ $CloneProjectDeploymentProcess = Test-OctopusTrueFalseParameter -parameterValue
$CloneTenantVariables = Test-OctopusTrueFalseParameter -parameterValue $CloneTenantVariables -parameterName "CloneTenantVariables" -defaultValue $false
$ClonePackages = Test-OctopusTrueFalseParameter -parameterValue $ClonePackages -parameterName "ClonePackages" -defaultValue $false

$ProcessCloningOption = Test-OctopusProcessCloningParameter -ParameterValue $ProcessCloningOption
$ProcessEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessEnvironmentScopingMatch" -ParameterValue $ProcessEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessChannelScopingMatch" -ParameterValue $ProcessChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessTenantTagScopingMatch" -ParameterValue $ProcessTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$VariableChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableChannelScopingMatch" -ParameterValue $VariableChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableEnvironmentScopingMatch" -ParameterValue $VariableEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
Expand All @@ -77,9 +80,11 @@ $VariableActionScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "Va
$VariableMachineScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableMachineScopingMatch" -ParameterValue $VariableMachineScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableAccountScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableAccountScopingMatch" -ParameterValue $VariableAccountScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableCertificateScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableCertificateScopingMatch" -ParameterValue $VariableCertificateScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableTenantTagScopingMatch" -ParameterValue $VariableTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$InfrastructureEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureEnvironmentScopingMatch" -ParameterValue $InfrastructureEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$InfrastructureTenantScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureTenantScopingMatch" -ParameterValue $InfrastructureTenantScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$InfrastructureTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "InfrastructureTenantTagScopingMatch" -ParameterValue $InfrastructureTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$IgnoreVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $IgnoreVersionCheckResult -parameterName "IgnoreVersionCheckResult" -defaultValue $false
$SkipPausingWhenIgnoringVersionCheckResult = Test-OctopusTrueFalseParameter -parameterValue $SkipPausingWhenIgnoringVersionCheckResult -parameterName "SkipPausingWhenIgnoringVersionCheckResult" -defaultValue $false
Expand Down Expand Up @@ -690,15 +695,18 @@ Write-OctopusSuccess " -SkipPausingWhenIgnoringVersionCheckResult $SkipPausingW
Write-OctopusSuccess " -CloneTenantVariables $CloneTenantVariables"
Write-OctopusSuccess " -ProcessEnvironmentScopingMatch $ProcessEnvironmentScopingMatch"
Write-OctopusSuccess " -ProcessChannelScopingMatch $ProcessChannelScopingMatch"
Write-OctopusSuccess " -ProcessTenantTagScopingMatch $ProcessTenantTagScopingMatch"
Write-OctopusSuccess " -VariableChannelScopingMatch $VariableChannelScopingMatch"
Write-OctopusSuccess " -VariableEnvironmentScopingMatch $VariableEnvironmentScopingMatch"
Write-OctopusSuccess " -VariableProcessOwnerScopingMatch $VariableProcessOwnerScopingMatch"
Write-OctopusSuccess " -VariableActionScopingMatch $VariableActionScopingMatch"
Write-OctopusSuccess " -VariableMachineScopingMatch $VariableMachineScopingMatch"
Write-OctopusSuccess " -VariableAccountScopingMatch $VariableAccountScopingMatch"
Write-OctopusSuccess " -VariableCertificateScopingMatch $VariableCertificateScopingMatch"
Write-OctopusSuccess " -VariableTenantTagScopingMatch $VariableTenantTagScopingMatch"
Write-OctopusSuccess " -InfrastructureEnvironmentScopingMatch $InfrastructureEnvironmentScopingMatch"
Write-OctopusSuccess " -InfrastructureTenantScopingMatch $InfrastructureTenantScopingMatch"
Write-OctopusSuccess " -InfrastructureTenantTagScopingMatch $InfrastructureTenantTagScopingMatch"
Write-OctopusSuccess " -ProcessCloningOption $ProcessCloningOption"
Write-OctopusSuccess " -WhatIf $WhatIf"

Expand Down Expand Up @@ -741,15 +749,18 @@ $cloneSpaceScript = "$PSScriptRoot\CloneSpace.ps1"
-EnvironmentScopingMatch "$EnvironmentScopingMatch" `
-ProcessEnvironmentScopingMatch "$ProcessEnvironmentScopingMatch" `
-ProcessChannelScopingMatch "$ProcessChannelScopingMatch" `
-ProcessTenantTagScopingMatch "$ProcessTenantTagScopingMatch" `
-VariableChannelScopingMatch "$VariableChannelScopingMatch" `
-VariableEnvironmentScopingMatch "$VariableEnvironmentScopingMatch" `
-VariableProcessOwnerScopingMatch "$VariableProcessOwnerScopingMatch" `
-VariableActionScopingMatch "$VariableActionScopingMatch" `
-VariableMachineScopingMatch "$VariableMachineScopingMatch" `
-VariableAccountScopingMatch "$VariableAccountScopingMatch" `
-VariableCertificateScopingMatch "$VariableCertificateScopingMatch" `
-VariableTenantTagScopingMatch "$VariableTenantTagScopingMatch" `
-InfrastructureEnvironmentScopingMatch "$InfrastructureEnvironmentScopingMatch" `
-InfrastructureTenantScopingMatch "$InfrastructureTenantScopingMatch" `
-InfrastructureTenantTagScopingMatch "$InfrastructureTenantTagScopingMatch" `
-ProcessCloningOption "$ProcessCloningOption" `
-WhatIf "$whatIf"

10 changes: 8 additions & 2 deletions ProjectSyncer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ param (
$CloneProjectDeploymentProcess,
$ProcessEnvironmentScopingMatch,
$ProcessChannelScopingMatch,
$ProcessTenantTagScopingMatch,
$VariableChannelScopingMatch,
$VariableEnvironmentScopingMatch,
$VariableProcessOwnerScopingMatch,
$VariableActionScopingMatch,
$VariableMachineScopingMatch,
$VariableAccountScopingMatch,
$VariableCertificateScopingMatch,
$VariableCertificateScopingMatch,
$VariableTenantTagScopingMatch,
$ProcessCloningOption,
$WhatIf
)
Expand Down Expand Up @@ -56,6 +58,7 @@ $CloneProjectDeploymentProcess = Test-OctopusTrueFalseParameter -parameterValue
$ProcessCloningOption = Test-OctopusProcessCloningParameter -ParameterValue $ProcessCloningOption
$ProcessEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessEnvironmentScopingMatch" -ParameterValue $ProcessEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessChannelScopingMatch" -ParameterValue $ProcessChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$ProcessTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "ProcessTenantTagScopingMatch" -ParameterValue $ProcessTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$VariableChannelScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableChannelScopingMatch" -ParameterValue $VariableChannelScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableEnvironmentScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableEnvironmentScopingMatch" -ParameterValue $VariableEnvironmentScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
Expand All @@ -64,6 +67,7 @@ $VariableActionScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "Va
$VariableMachineScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableMachineScopingMatch" -ParameterValue $VariableMachineScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false
$VariableAccountScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableAccountScopingMatch" -ParameterValue $VariableAccountScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableCertificateScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableCertificateScopingMatch" -ParameterValue $VariableCertificateScopingMatch -DefaultValue "SkipUnlessExactMatch" -SingleValueItem $true
$VariableTenantTagScopingMatch = Test-OctopusScopeMatchParameter -ParameterName "VariableTenantTagScopingMatch" -ParameterValue $VariableTenantTagScopingMatch -DefaultValue "SkipUnlessPartialMatch" -SingleValueItem $false

$WhatIf = Test-OctopusTrueFalseParameter -parameterValue $WhatIf -parameterName "WhatIf" -defaultValue $false

Expand All @@ -78,13 +82,15 @@ $CloneScriptOptions = @{
CloneProjectDeploymentProcess = $CloneProjectDeploymentProcess;
ProcessEnvironmentScopingMatch = $ProcessEnvironmentScopingMatch;
ProcessChannelScopingMatch = $ProcessChannelScopingMatch;
ProcessTenantTagScopingMatch = $ProcessTenantTagScopingMatch;
VariableChannelScopingMatch = $VariableChannelScopingMatch;
VariableEnvironmentScopingMatch = $VariableEnvironmentScopingMatch;
VariableProcessOwnerScopingMatch = $VariableProcessOwnerScopingMatch;
VariableActionScopingMatch = $VariableActionScopingMatch;
VariableMachineScopingMatch = $VariableMachineScopingMatch;
VariableAccountScopingMatch = $VariableAccountScopingMatch;
VariableCertificateScopingMatch = $VariableCertificateScopingMatch;
VariableCertificateScopingMatch = $VariableCertificateScopingMatch;
VariableTenantTagScopingMatch = $VariableTenantTagScopingMatch;
ProcessCloningOption = $ProcessCloningOption;
}

Expand Down
Loading

0 comments on commit f7d8e0f

Please sign in to comment.