<# FPS:Containers:Make:SC-CICD:ACTIVE #>

 

if (!(Push-NeededFor CICD)) {

    # Remove a prior patch if it already exists

    Remove-Item -Path Function:\CICD

} else {

    # Only load the help line if a prior release is not present, otherwise just keep whats there.

    $genShortcuts = @($genShortcuts

    (ConvertTo-DotFill $global:SCDotLen 'CICD')+"[Switches(o): -Sync -LoadPublicHTML] Performs a complete CICD sync for the current system."

    )

}

 

function CICD {

 

<#

 

.DESCRIPTION

Module: Make

Shortcut: SC-CICD.ps1

Has Dependencies: Yes

 

This CmdLet encapsulates the process of syncing the container and metadata directories at a regular interval

as configured within the poller - or interactively.

   

.EXAMPLE

if (Push-NeededFor SC-CICD) { . (Get-ActiveFileNm -PS1 SC-CICD) }

 

.CC

 

[2024.11.07 JD] Updates made to the shortcuts for ConvertTo-DotFill use

[2024.10.20 JD] Removed the src copy because the directory now exists within Web:Admin:Views:Pages.

[2024.09.29 JD] Added the src directory within media to be moved

[2024.09.25 JD] Original code release

 

.NOTES

As written, all local sites within the runtime director are sync'd with the source. The LoadPublicHTML switched

conditional can be further modified for individual sites during the local site sync - if necessary.

 

#>

   

    [CmdletBinding()]

        param(

        [Parameter(Mandatory=$false)] [switch]$LoadPublicHTML,

        [Parameter(Mandatory=$false)] [switch]$Sync

    )

 

    #region Initialization

 

    $testCmdLet, $overrideTestSnippet, $overrideSnippet = "", "", "" # Initialize override variables

    . (Get-ActiveFileNm -PS1 Initialize-Make-Locations)

    . (Get-ActiveFileNm -PS1 Load-Make-Dependencies)

 

    #endregion

 

    if ($global:pro_CI.RuntimeDrive -eq $global:pro_CI.SourceDrive) {

 

        Write-Host "Both the source and runtimes are the same.  CICD run is unnessary."

 

    } else {

 

        if ($global:pro_CI.CanConnectToSource -eq "True") {

         

 

            $Source, $Target = $makLoc_CICDSourceContainers, $makLoc_CICDTargetContainers

            if ($PSBoundParameters.Sync -eq $true) {

                Sync-FPS -Source $Source -Target $Target -Sync

            } else {

                Sync-FPS -Source $Source -Target $Target

            }

 

            $Source, $Target = $makLoc_CICDSourceMetadata, $makLoc_CICDTargetMetadata

            if ($PSBoundParameters.Sync -eq $true) {

                Sync-FPS -Source $Source -Target $Target -Sync

            } else {

                Sync-FPS -Source $Source -Target $Target

            }

 

            # Default local website - NOTE: This is the local SysAdmin site used for CC, etc.  Basic site included

            # with all releases.  Src is located within pages.

            $Source, $Target = $makLoc_CICDSourceWebLocal, $makLoc_CICDTargetWebLocal

            if ($PSBoundParameters.Sync -eq $true) {

                Sync-FPS -Source $Source -Target $Target -Sync

            } else {

                Sync-FPS -Source $Source -Target $Target

            }

 

            <#

               From this point foward, all noted custom supported websites can be synchronized. The location for all other

               sites should be under the public_html and called out individually.  Web changes perspective to FoundationalOps,

               so leave FoundationalOps out.

 

            if ($PSBoundParameters.LoadPublicHTML -eq $true) {

                # Use the following to call out individual sites if necessary

                # $SiteHTMLPath = "\"

                # $Source = $makLoc_CICDSourcePublicHTML+$SiteHtmlPath

                # $Target = $makLoc_CICDTargetPublicHTML+$SiteHtmlPath

 

                $Source = $makLoc_CICDSourcePublicHTML

                $Target = $makLoc_CICDTargetPublicHTML

                if ($PSBoundParameters.Sync -eq $true) {

                    Sync-FPS -Source $Source -Target $Target -Sync

                } else {

                    Sync-FPS -Source $Source -Target $Target

                }

            }

            #>

 

        } else {

 

            Write-Host "Cannot connect to source.  CICD run is unnecessary."

 

        }

 

    }

 

}