ops:切换离线发布为本地构建上传
This commit is contained in:
46
deploy/stage-release.ps1
Normal file
46
deploy/stage-release.ps1
Normal file
@@ -0,0 +1,46 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ReleaseDir,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$PlanFile,
|
||||
|
||||
[string]$BundleDir = ".docker-bundles"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$releaseAbs = Join-Path $repoRoot $ReleaseDir
|
||||
$bundleAbs = Join-Path $repoRoot $BundleDir
|
||||
|
||||
if (-not (Test-Path -LiteralPath $PlanFile)) {
|
||||
throw ("release plan not found: {0}" -f $PlanFile)
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $releaseAbs) {
|
||||
Remove-Item -LiteralPath $releaseAbs -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $releaseAbs "deploy\nginx") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $releaseAbs "deploy\certs") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $releaseAbs ".docker-bundles") | Out-Null
|
||||
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "docker-compose.full.yml") -Destination (Join-Path $releaseAbs "docker-compose.full.yml")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\docker-load.sh") -Destination (Join-Path $releaseAbs "deploy\docker-load.sh")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\project-release.sh") -Destination (Join-Path $releaseAbs "deploy\project-release.sh")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\project-rollback.sh") -Destination (Join-Path $releaseAbs "deploy\project-rollback.sh")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\impact-rules.sh") -Destination (Join-Path $releaseAbs "deploy\impact-rules.sh")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\service-catalog.sh") -Destination (Join-Path $releaseAbs "deploy\service-catalog.sh")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\service-catalog.txt") -Destination (Join-Path $releaseAbs "deploy\service-catalog.txt")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\nginx\default.conf") -Destination (Join-Path $releaseAbs "deploy\nginx\default.conf")
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\certs\README.md") -Destination (Join-Path $releaseAbs "deploy\certs\README.md")
|
||||
Copy-Item -LiteralPath $PlanFile -Destination (Join-Path $releaseAbs "deploy\release-plan.env")
|
||||
|
||||
if (Test-Path -LiteralPath $bundleAbs) {
|
||||
$bundles = Get-ChildItem -LiteralPath $bundleAbs -Filter "*.tar" -File
|
||||
foreach ($bundle in $bundles) {
|
||||
Copy-Item -LiteralPath $bundle.FullName -Destination (Join-Path $releaseAbs ".docker-bundles")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user