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)' |   - script: 'oc project $(OpenShiftProject)' | ||||||
|     failOnStderr: true |     failOnStderr: true | ||||||
|     displayName: 'Set Project Context' |     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 |   - task: DownloadPipelineArtifact@2 | ||||||
|     inputs: |     inputs: | ||||||
|       artifact: drop |       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 |     failOnStderr: true | ||||||
|     displayName: 'Create OpenShift Build' |     displayName: 'Ensure OpenShift BuildConfig' | ||||||
|     condition: and(succeeded(), eq(variables['BuildExists'], False)) |  | ||||||
|   - powershell: | |   - powershell: | | ||||||
|       $pinfo = New-Object System.Diagnostics.ProcessStartInfo |       $pinfo = New-Object System.Diagnostics.ProcessStartInfo | ||||||
|       $pinfo.FileName = "oc.exe" |       $pinfo.FileName = "oc.exe" | ||||||
|  | |||||||
| @ -1,13 +1,14 @@ | |||||||
| apiVersion: template.openshift.io/v1 | apiVersion: template.openshift.io/v1 | ||||||
| kind: Template | kind: Template | ||||||
| metadata: | metadata: | ||||||
|   name: 'api-template' |   name: ${TEMPLATE_NAME} | ||||||
| objects: | objects: | ||||||
| - apiVersion: apps.openshift.io/v1 | - apiVersion: apps.openshift.io/v1 | ||||||
|   kind: DeploymentConfig |   kind: DeploymentConfig | ||||||
|   metadata: |   metadata: | ||||||
|     labels: |     labels: | ||||||
|       app: ${APPLICATION_NAME} |       app: ${APPLICATION_NAME} | ||||||
|  |       template: ${TEMPLATE_NAME} | ||||||
|     name: ${APPLICATION_NAME} |     name: ${APPLICATION_NAME} | ||||||
|   spec: |   spec: | ||||||
|     replicas: 1 |     replicas: 1 | ||||||
| @ -54,6 +55,7 @@ objects: | |||||||
|   metadata: |   metadata: | ||||||
|     labels: |     labels: | ||||||
|       app: ${APPLICATION_NAME} |       app: ${APPLICATION_NAME} | ||||||
|  |       template: ${TEMPLATE_NAME} | ||||||
|     name: ${APPLICATION_NAME} |     name: ${APPLICATION_NAME} | ||||||
|   spec: |   spec: | ||||||
|     ports: |     ports: | ||||||
| @ -77,3 +79,8 @@ parameters: | |||||||
|   displayName: Image Registry Project Name |   displayName: Image Registry Project Name | ||||||
|   name: IMAGE_REGISTRY_PROJECT_NAME |   name: IMAGE_REGISTRY_PROJECT_NAME | ||||||
|   required: true |   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