Template file rnaming; added openshift template for BuildConfig
This commit is contained in:
parent
7e73d1a84b
commit
b6e0f04eab
44
build/aro/openshift-app-build-template.yml
Normal file
44
build/aro/openshift-app-build-template.yml
Normal file
@ -0,0 +1,44 @@
|
||||
apiVersion: template.openshift.io/v1
|
||||
kind: Template
|
||||
metadata:
|
||||
name: ${TEMPLATE_NAME}
|
||||
objects:
|
||||
- apiVersion: build.openshift.io/v1
|
||||
kind: BuildConfig
|
||||
metadata:
|
||||
labels:
|
||||
build: ${APPLICATION_NAME}
|
||||
template: ${TEMPLATE_NAME}
|
||||
name: ${APPLICATION_NAME}
|
||||
spec:
|
||||
failedBuildsHistoryLimit: 5
|
||||
nodeSelector: null
|
||||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: ${APPLICATION_NAME}:latest
|
||||
postCommit: {}
|
||||
resources: {}
|
||||
runPolicy: Serial
|
||||
source:
|
||||
binary: {}
|
||||
type: Binary
|
||||
strategy:
|
||||
sourceStrategy:
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: dotnet:3.1
|
||||
namespace: openshift
|
||||
type: Source
|
||||
successfulBuildsHistoryLimit: 5
|
||||
triggers: []
|
||||
parameters:
|
||||
- description: The name for the application.
|
||||
displayName: Application Name
|
||||
name: APPLICATION_NAME
|
||||
required: true
|
||||
- description: The template name.
|
||||
displayName: Template Name
|
||||
name: TEMPLATE_NAME
|
||||
required: true
|
||||
value: webapp-build-config-template
|
@ -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"
|
||||
|
@ -1,13 +1,14 @@
|
||||
apiVersion: template.openshift.io/v1
|
||||
kind: Template
|
||||
metadata:
|
||||
name: 'api-template'
|
||||
name: ${TEMPLATE_NAME}
|
||||
objects:
|
||||
- apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
labels:
|
||||
app: ${APPLICATION_NAME}
|
||||
template: ${TEMPLATE_NAME}
|
||||
name: ${APPLICATION_NAME}
|
||||
spec:
|
||||
replicas: 1
|
||||
@ -54,6 +55,7 @@ objects:
|
||||
metadata:
|
||||
labels:
|
||||
app: ${APPLICATION_NAME}
|
||||
template: ${TEMPLATE_NAME}
|
||||
name: ${APPLICATION_NAME}
|
||||
spec:
|
||||
ports:
|
||||
@ -77,3 +79,8 @@ parameters:
|
||||
displayName: Image Registry Project Name
|
||||
name: IMAGE_REGISTRY_PROJECT_NAME
|
||||
required: true
|
||||
- description: The template name.
|
||||
displayName: Template Name
|
||||
name: TEMPLATE_NAME
|
||||
required: true
|
||||
value: webapp-template
|
Loading…
x
Reference in New Issue
Block a user