skip the images in path cprnims-web\wwwroot\Content\Images\
All checks were successful
Build and Deploy CPRNIMS / build-and-deploy (push) Successful in 3m40s
All checks were successful
Build and Deploy CPRNIMS / build-and-deploy (push) Successful in 3m40s
This commit is contained in:
parent
d1686b15b7
commit
421b2959ec
@ -102,7 +102,8 @@ jobs:
|
|||||||
}
|
}
|
||||||
# Exclude dynamic user images from backup - not part of deployable artifact
|
# Exclude dynamic user images from backup - not part of deployable artifact
|
||||||
if (Test-Path "C:\inetpub\cprnims-web") {
|
if (Test-Path "C:\inetpub\cprnims-web") {
|
||||||
robocopy "C:\inetpub\cprnims-web" "C:\backups\$stamp\webapps" /MIR /R:2 /W:3 /XD "C:\inetpub\cprnims-web\wwwroot\Content\Images" | Out-Null
|
robocopy "C:\inetpub\cprnims-web" "C:\backups\$stamp\webapps" /MIR /R:2 /W:3 `
|
||||||
|
/XD "C:\inetpub\cprnims-web\wwwroot\Content\Images" | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
$stamp | Out-File -FilePath "C:\backups\latest.txt" -Encoding ascii -NoNewline
|
$stamp | Out-File -FilePath "C:\backups\latest.txt" -Encoding ascii -NoNewline
|
||||||
@ -140,13 +141,34 @@ jobs:
|
|||||||
id: deploy_web
|
id: deploy_web
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
# /XD preserves dynamically uploaded images in Content\Images across deploys
|
# Deploy everything EXCEPT the dynamic images folder.
|
||||||
robocopy "C:\ci-output\webapps" "C:\inetpub\cprnims-web" /MIR /R:3 /W:5 /XD "C:\inetpub\cprnims-web\wwwroot\Content\Images"
|
# /XD excludes the Images directory itself from mirroring (prevents deletion of subfolders).
|
||||||
|
# We use the destination full path for /XD so only this specific Images folder is protected,
|
||||||
|
# not any other folder named Images elsewhere in the tree.
|
||||||
|
# Note: files sitting directly inside Images\ are protected because /XD stops robocopy
|
||||||
|
# from treating that directory as part of the mirror scope entirely.
|
||||||
|
robocopy "C:\ci-output\webapps" "C:\inetpub\cprnims-web" /MIR /R:3 /W:5 `
|
||||||
|
/XD "C:\inetpub\cprnims-web\wwwroot\Content\Images"
|
||||||
|
|
||||||
$rc = $LASTEXITCODE
|
$rc = $LASTEXITCODE
|
||||||
Write-Host "ROBOCOPY EXIT CODE: $rc"
|
Write-Host "ROBOCOPY EXIT CODE: $rc"
|
||||||
if ($rc -ge 8) {
|
if ($rc -ge 8) {
|
||||||
throw "robocopy failed for WebApps with exit code $rc"
|
throw "robocopy failed for WebApps with exit code $rc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Separately sync only the static seed images that ARE part of the repo
|
||||||
|
# (1.jpg, 2.jpg, 3.jpg, 404userImage.jpg) without /PURGE or /MIR,
|
||||||
|
# so new files from the build are added but existing dynamic uploads are never deleted.
|
||||||
|
if (Test-Path "C:\ci-output\webapps\wwwroot\Content\Images") {
|
||||||
|
robocopy "C:\ci-output\webapps\wwwroot\Content\Images" `
|
||||||
|
"C:\inetpub\cprnims-web\wwwroot\Content\Images" `
|
||||||
|
/E /R:3 /W:5
|
||||||
|
$rc2 = $LASTEXITCODE
|
||||||
|
Write-Host "ROBOCOPY IMAGES EXIT CODE: $rc2"
|
||||||
|
if ($rc2 -ge 8) {
|
||||||
|
throw "robocopy failed for Images folder with exit code $rc2"
|
||||||
|
}
|
||||||
|
}
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
- name: Start app pools
|
- name: Start app pools
|
||||||
@ -188,7 +210,8 @@ jobs:
|
|||||||
}
|
}
|
||||||
# Exclude dynamic images from rollback restore - preserve images uploaded after the backup was taken
|
# Exclude dynamic images from rollback restore - preserve images uploaded after the backup was taken
|
||||||
if (Test-Path "$backupPath\webapps") {
|
if (Test-Path "$backupPath\webapps") {
|
||||||
robocopy "$backupPath\webapps" "C:\inetpub\cprnims-web" /MIR /R:3 /W:5 /XD "C:\inetpub\cprnims-web\wwwroot\Content\Images" | Out-Null
|
robocopy "$backupPath\webapps" "C:\inetpub\cprnims-web" /MIR /R:3 /W:5 `
|
||||||
|
/XD "C:\inetpub\cprnims-web\wwwroot\Content\Images" | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
Start-WebAppPool -Name "CPRNIMS-Api"
|
Start-WebAppPool -Name "CPRNIMS-Api"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user