generated from dopt-python/py311
fix for alembic pipeline
This commit is contained in:
@@ -8,6 +8,28 @@ $ENV_PATH = 'B:\deployments\WCE-NAFKA\dopt_nafka_wce-crm'
|
||||
$PY_PATH = Join-Path -Path $ENV_PATH -ChildPath 'python'
|
||||
$SRC_PATH = (Get-Location).Path
|
||||
|
||||
function create_folder {
|
||||
param (
|
||||
[string]$base_path,
|
||||
[string]$folder_name,
|
||||
[switch]$recreate
|
||||
)
|
||||
$target_path = Join-Path -Path $base_path -ChildPath $folder_name
|
||||
|
||||
$target_path_exists = Test-Path -Path $target_path
|
||||
if (-not $target_path_exists){
|
||||
Write-Output "[PWSH] Folder >$folder_name< not existing. Create..."
|
||||
New-Item -Path $target_path -ItemType Directory
|
||||
}
|
||||
elseif ($target_path_exists -and $recreate){
|
||||
Write-Output "[PWSH] Folder >$folder_name< exists, but should be recreated..."
|
||||
Remove-Item -Path $target_path -Recurse -Force
|
||||
New-Item -Path $target_path -ItemType Directory
|
||||
}
|
||||
else {
|
||||
Write-Output "Folder >$folder_name< already exists."
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Build Pipeline for d-opt WCE/NAFKA project"
|
||||
|
||||
@@ -88,6 +110,23 @@ if ($? -eq $false){
|
||||
}
|
||||
Write-Output "Copied database files successfully"
|
||||
|
||||
# copy alembic files
|
||||
Write-Output "Copying alembic files..."
|
||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'alembic'
|
||||
$dest_file = Join-Path -Path $PY_PATH -ChildPath 'alembic'
|
||||
create_folder -base_path $PY_PATH -folder_name 'alembic'
|
||||
Copy-Item -Path $copy_file -Destination $dest_file -Force -Recurse
|
||||
if ($? -eq $false){
|
||||
Write-Output "[PWSH] Exiting script because there were errors while copying the alembic folder"
|
||||
Exit
|
||||
}
|
||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'alembic.ini'
|
||||
Copy-Item -Path $copy_file -Destination $dest_file -Force
|
||||
if ($? -eq $false){
|
||||
Write-Output "[PWSH] Exiting script because there were errors while copying the alembic INI file"
|
||||
Exit
|
||||
}
|
||||
|
||||
# copy .env file
|
||||
Write-Output "Copying ENV file..."
|
||||
$env_file = Join-Path -Path $SRC_PATH -ChildPath 'deployment/.env'
|
||||
|
||||
Reference in New Issue
Block a user