|
|
@ -16,32 +16,12 @@ jobs: |
|
|
|
- script: 'oc project $(OpenShiftProject)' |
|
|
|
failOnStderr: true |
|
|
|
displayName: 'Set Project Context' |
|
|
|
- powershell: | |
|
|
|
$pinfo = New-Object System.Diagnostics.ProcessStartInfo |
|
|
|
$pinfo.FileName = "oc.exe" |
|
|
|
$pinfo.RedirectStandardError = $true |
|
|
|
$pinfo.RedirectStandardOutput = $true |
|
|
|
$pinfo.UseShellExecute = $false |
|
|
|
$pinfo.Arguments = "get buildConfig $(AppName)" |
|
|
|
$p = New-Object System.Diagnostics.Process |
|
|
|
$p.StartInfo = $pinfo |
|
|
|
$p.Start() | Out-Null |
|
|
|
$p.WaitForExit() |
|
|
|
$stdout = $p.StandardOutput.ReadToEnd() |
|
|
|
$stderr = $p.StandardError.ReadToEnd() |
|
|
|
Write-Host "stdout: $stdout" |
|
|
|
Write-Host "stderr: $stderr" |
|
|
|
Write-Host "exit code: " + $p.ExitCode |
|
|
|
$buildExists = $stdout.Contains("$(AppName)") |
|
|
|
Write-Host "##vso[task.setvariable variable=BuildExists;]$buildExists" |
|
|
|
displayName: 'Check for Existing Build' |
|
|
|
- task: DownloadPipelineArtifact@2 |
|
|
|
inputs: |
|
|
|
artifact: drop |
|
|
|
- script: 'oc new-build --name=$(AppName) dotnet:3.1 --binary=true' |
|
|
|
- script: 'oc process -f openshift-app-build-template.yml -p APPLICATION_NAME=$(AppName) | oc apply -f-' |
|
|
|
failOnStderr: true |
|
|
|
displayName: 'Create OpenShift Build' |
|
|
|
condition: and(succeeded(), eq(variables['BuildExists'], False)) |
|
|
|
displayName: 'Ensure OpenShift BuildConfig' |
|
|
|
- powershell: | |
|
|
|
$pinfo = New-Object System.Diagnostics.ProcessStartInfo |
|
|
|
$pinfo.FileName = "oc.exe" |
|
|
|