parameters: ProjectName: '' OpenShiftProject: '' AppName: '' OpenShiftServiceConnection: '' jobs: - job: Container_Build dependsOn: Restore_Build_Publish pool: vmImage: 'windows-latest' steps: - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 displayName: 'oc-setup ' inputs: openshiftService: $(OpenShiftServiceConnection) - script: 'oc project $(OpenShiftProject)' failOnStderr: true displayName: 'Set Project Context' - task: DownloadPipelineArtifact@2 inputs: artifact: drop - script: 'oc process -f ../openshift-app-build-template.yml -p APPLICATION_NAME=$(AppName) | oc apply -f-' failOnStderr: true displayName: 'Ensure OpenShift BuildConfig' - powershell: | $pinfo = New-Object System.Diagnostics.ProcessStartInfo $pinfo.FileName = "oc.exe" $pinfo.RedirectStandardError = $true $pinfo.RedirectStandardOutput = $true $pinfo.UseShellExecute = $false $pinfo.Arguments = "start-build $(AppName) --from-dir=$(ProjectName) --follow --wait" $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 $binaryBuildHasErrors = $p.ExitCode -ne 0 Write-Host "##vso[task.setvariable variable=BinaryBuildHasErrors;]$binaryBuildHasErrors" displayName: 'Start OpenShift Binary Build' failOnStderr: and(succeeded(), eq(variables['BinaryBuildHasErrors'], False)) workingDirectory: '$(Pipeline.Workspace)'