0

Currently, TDS installer is taking 30 to 40 min of the time to deploy 5.2 package. I am exploring a few options to improve TDS deployment time.

I am trying to implement Sitecore Git Delta Deploy 2.0. I am using msbuild /p:CustomGitDeltaDeploy=True option.

So I have a question about this.

As it is mention in an article, it creates a file (LastDeploymentGitCommitId.txt) and stores it on a build server, but the problem we are facing is for each deployment it is storing the file in a different location, so it is not working for me.

e.g

2018-11-30T00:06:17.5788965Z git rev-parse HEAD > "F:\agentA_work\267\b\Delta\LastDeploymentGitCommitId.txt" 2018-11-30T04:06:51.2571889Z git rev-parse HEAD > "G:\agentB_work\182\b\Delta\LastDeploymentGitCommitId.txt" 2018-11-30T04:27:01.2790608Z git rev-parse HEAD > "F:\agentA_work\172\b\Delta\LastDeploymentGitCommitId.txt"

Is there a way that we can save this file at common location or any there option to tackle this scenario?

1 Answer 1

3

In my opinion, you are looking at this incorrectly. Have you got a release pipeline to tie into your build as well ? This is crucial to ensure that you Git Delta Deploy is integrated correctly.

This is the Powershell script required to work out the last successful Git Commit ID for the Delta build to work, and it must be setup as a build step

param(
    [string] $LastGitCommitId,
    [string] $AccessToken,
    [string] $AzureDevOpsAccountName,
    [string] $TeamProjectId,
    [string] $ReleaseDefinitionId
)
if ([string]::IsNullOrEmpty($LastGitCommitId))
{
    $hdrs = @{}
    $hdrs.Add("Authorization","Bearer $AccessToken")

    try
    {
        $LatestSuccessfulRelease = Invoke-RestMethod -Method Get -Uri "https://$AzureDevOpsAccountName.vsrm.visualstudio.com/$TeamProjectId/_apis/release/releases?definitionId=$ReleaseDefinitionId&resultFilter=succeeded&`$top=1" -ContentType 'application/json' -Headers $hdrs

        if ($LatestSuccessfulRelease.count -eq 1)
        {
            $ReleaseDetailUrl = $LatestSuccessfulRelease.value[0].url
            try
            {
                $ReleaseArtifactDetail = Invoke-RestMethod -Method Get -Uri "$ReleaseDetailUrl" -ContentType 'application/json' -Headers $hdrs

                if ($ReleaseArtifactDetail.PSobject.Properties.name -notcontains "innerException")
                {
                    $artifacts = $ReleaseArtifactDetail.artifacts | where {$_.definitionReference.project.id -eq $TeamProjectId}
                    if ($artifacts -ne $null)
                    {
                        $GitCommitId = $artifacts[0].definitionReference.pullRequestMergeCommitId.id
                        Write-Host "##vso[task.setvariable variable=LastGitCommitId;]$GitCommitId"                
                    }
                }
                else
                {
                    Write-Host "##vso[task.complete result=Failed;]Error in getting Release Details"
                }
            }
            catch
            {
                Write-Host "##vso[task.complete result=Failed;]Error in getting Release Details"
            }
        }
        else
        {
            Write-Host "##vso[task.complete result=Failed;]Error in getting the latest successful release."
        }
    }
    catch
    {
        Write-Host "##vso[task.complete result=Failed;]Error in getting the latest successful release."
    }
}

The MSBuild properties that needs to be overridden during builds will need to look like this: /property:LastDeploymentGitCommitID=%env.LastSuccessfulRunGitCommitId% /property:LastDeploymentGitTagName=

My blog post has a lot more details on how to get this all working. https://medium.com/@Vincent_Lui/yet-another-hedgehog-team-development-for-sitecore-setup-from-developer-workstation-to-ci-cd-98ec4fc1161b

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.