Added new pipelines and templates

This commit is contained in:
Tim McCarthy 2020-01-26 15:59:17 -08:00
parent bc4bc18abc
commit 3656c57b64
7 changed files with 176 additions and 4 deletions

View File

@ -1,5 +1,7 @@
variables: variables:
ProjectName: Basket.API ProjectName: Basket.API
OpenShiftProject: development
AppName: basketapi
trigger: trigger:
branches: branches:
include: include:
@ -10,6 +12,11 @@ trigger:
- src/BuildingBlocks/* - src/BuildingBlocks/*
- src/Services/Basket/* - src/Services/Basket/*
jobs: jobs:
- template: ../webapp-build.yml - template: ../webapp-build-artifacts.yml
parameters: parameters:
ProjectName: $(ProjectName) ProjectName: $(ProjectName)
- template: ../webapp-container-build.yml
parameters:
ProjectName: $(ProjectName)
OpenShiftProject: $(OpenShiftProject)
AppName: $(AppName)

View File

@ -10,6 +10,6 @@ trigger:
- src/BuildingBlocks/* - src/BuildingBlocks/*
- src/Services/Catalog/* - src/Services/Catalog/*
jobs: jobs:
- template: ../webapp-build.yml - template: ../webapp-build-artifacts.yml
parameters: parameters:
ProjectName: $(ProjectName) ProjectName: $(ProjectName)

View File

@ -10,6 +10,6 @@ trigger:
- src/BuildingBlocks/* - src/BuildingBlocks/*
- src/Services/Catalog/* - src/Services/Catalog/*
jobs: jobs:
- template: ../webapp-build.yml - template: ../webapp-build-artifacts.yml
parameters: parameters:
ProjectName: $(ProjectName) ProjectName: $(ProjectName)

View File

@ -1,4 +1,4 @@
# Azure DevOps build definitions # ARO build definitions
This folder contains the Azure DevOps build definitions in YAML format. Each folder contains one `azure-pipelines.yml` that contains the build definition for one microservice (usually a Docker image, but some microservices generates more than one Docker image). This folder contains the Azure DevOps build definitions in YAML format. Each folder contains one `azure-pipelines.yml` that contains the build definition for one microservice (usually a Docker image, but some microservices generates more than one Docker image).

View File

@ -0,0 +1,47 @@
parameters:
ProjectName: ''
OpenShiftProject: ''
AppName: ''
jobs:
- job: Container_Build
pool:
name: 'Hosted Ubuntu 1604'
steps:
- task: redhat.openshift-vsts.oc-setup-task.oc-setup@2
displayName: 'oc-setup '
inputs:
openshiftService: 'OpenShift on ARO DEV'
- 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)-build"
$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)-build")
Write-Host "##vso[task.setvariable variable=BuildExists;]$buildExists"
displayName: 'Check for Existing Build'
- script: 'oc new-build --name=$(AppName)-build dotnet:3.1 --binary=true'
failOnStderr: true
displayName: 'Create OpenShift Build'
condition: and(succeeded(), eq(variables['BuildExists'], False))
- script: 'oc start-build $(AppName)-build --from-dir="$(Build.ArtifactStagingDirectory)/$(ProjectName)" --follow --wait'
failOnStderr: true
displayName: 'Start OpenShift Binary Build'
continueOnError: true

View File

@ -0,0 +1,118 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
creationTimestamp: null
name: '''basketapi-template'''
objects:
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
generation: 6
labels:
app: basketapi
name: basketapi
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
app: basketapi
deploymentconfig: basketapi
strategy:
activeDeadlineSeconds: 21600
resources: {}
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
type: Rolling
template:
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: basketapi
deploymentconfig: basketapi
spec:
containers:
- image: docker-registry.default.svc:5000/development/basketapi-build@sha256:7149637592a2e9bbfa78836762a5c300f6b19220ca001902e4c6c1767cb19c3d
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /liveness
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
name: basketapi
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /hc
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- basketapi
from:
kind: ImageStreamTag
name: basketapi-build:latest
namespace: development
lastTriggeredImage: docker-registry.default.svc:5000/development/basketapi-build@sha256:7149637592a2e9bbfa78836762a5c300f6b19220ca001902e4c6c1767cb19c3d
type: ImageChange
status:
availableReplicas: 0
latestVersion: 0
observedGeneration: 0
replicas: 0
unavailableReplicas: 0
updatedReplicas: 0
- apiVersion: v1
kind: Service
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: basketapi
name: basketapi
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: basketapi
deploymentconfig: basketapi
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}