From f649fbc4fb7e8a51c66a666f15e25d9ec77b537b Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Fri, 21 Feb 2020 22:11:58 -0800 Subject: [PATCH] Added ordering-api pipelines and template --- build/aro/identity-api/azure-pipelines.yml | 2 +- build/aro/ordering-api/azure-pipelines.yml | 24 ++++ deploy/aro/catalog-api/azure-pipelines.yml | 2 +- deploy/aro/identity-api/azure-pipelines.yml | 2 +- .../orderingapi-deploy-template.yml | 123 ++++++++++++++++++ deploy/aro/ordering-api/azure-pipelines.yml | 36 +++++ 6 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 build/aro/ordering-api/azure-pipelines.yml create mode 100644 deploy/aro/openshift-templates/orderingapi-deploy-template.yml create mode 100644 deploy/aro/ordering-api/azure-pipelines.yml diff --git a/build/aro/identity-api/azure-pipelines.yml b/build/aro/identity-api/azure-pipelines.yml index 60462107f..b88887ce4 100644 --- a/build/aro/identity-api/azure-pipelines.yml +++ b/build/aro/identity-api/azure-pipelines.yml @@ -11,7 +11,7 @@ trigger: paths: include: - src/BuildingBlocks/* - - src/Services/Catalog/* + - src/Services/Identity/* jobs: - template: ../webapp-build-artifacts.yml parameters: diff --git a/build/aro/ordering-api/azure-pipelines.yml b/build/aro/ordering-api/azure-pipelines.yml new file mode 100644 index 000000000..56726ea8e --- /dev/null +++ b/build/aro/ordering-api/azure-pipelines.yml @@ -0,0 +1,24 @@ +variables: + ProjectName: Ordering.API + OpenShiftProject: development + AppName: orderingapi + OpenShiftServiceConnection: 'OpenShift on ARO' +trigger: + branches: + include: + - master + - dev + paths: + include: + - src/BuildingBlocks/* + - src/Services/Ordering/* +jobs: +- template: ../webapp-build-artifacts.yml + parameters: + ProjectName: $(ProjectName) +- template: ../webapp-container-build.yml + parameters: + ProjectName: $(ProjectName) + OpenShiftProject: $(OpenShiftProject) + AppName: $(AppName) + OpenShiftServiceConnection: $(OpenShiftServiceConnection) diff --git a/deploy/aro/catalog-api/azure-pipelines.yml b/deploy/aro/catalog-api/azure-pipelines.yml index e24f7d84d..4bffab4fc 100644 --- a/deploy/aro/catalog-api/azure-pipelines.yml +++ b/deploy/aro/catalog-api/azure-pipelines.yml @@ -7,7 +7,7 @@ trigger: - dev paths: include: - - deploy/aro/basket-api/* + - deploy/aro/catalog-api/* - deploy/aro/openshift-templates/* stages: - stage: development diff --git a/deploy/aro/identity-api/azure-pipelines.yml b/deploy/aro/identity-api/azure-pipelines.yml index c0f9929f9..ede57cc13 100644 --- a/deploy/aro/identity-api/azure-pipelines.yml +++ b/deploy/aro/identity-api/azure-pipelines.yml @@ -7,7 +7,7 @@ trigger: - dev paths: include: - - deploy/aro/basket-api/* + - deploy/aro/identity-api/* - deploy/aro/openshift-templates/* stages: - stage: development diff --git a/deploy/aro/openshift-templates/orderingapi-deploy-template.yml b/deploy/aro/openshift-templates/orderingapi-deploy-template.yml new file mode 100644 index 000000000..dbc570b56 --- /dev/null +++ b/deploy/aro/openshift-templates/orderingapi-deploy-template.yml @@ -0,0 +1,123 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + 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 + selector: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + strategy: + type: Rolling + revisionHistoryLimit: 2 + template: + metadata: + labels: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + spec: + containers: + - env: + - name: IdentityUrlExternal + value: ${IDENTITY_URL_EXTERNAL} + - name: IdentityUrl + value: ${IDENTITY_URL} + - name: EventBusConnection + value: ${RABBITMQ_HOSTNAME} + - name: PORT + value: "8080" + - name: GRPC_PORT + value: "8081" + - name: PATH_BASE + value: /ordering-api + - name: ConnectionString + valueFrom: + secretKeyRef: + key: ConnectionString + name: ordering-db-connection-secret + image: docker-registry.default.svc:5000/${IMAGE_REGISTRY_PROJECT_NAME}/${APPLICATION_NAME}:latest + imagePullPolicy: Always + name: ${APPLICATION_NAME} + ports: + - containerPort: 8080 + protocol: TCP + - containerPort: 8081 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - ${APPLICATION_NAME} + from: + kind: ImageStreamTag + name: ${APPLICATION_NAME}:latest + namespace: ${IMAGE_REGISTRY_PROJECT_NAME} + type: ImageChange +- apiVersion: v1 + kind: Service + metadata: + labels: + app: ${APPLICATION_NAME} + template: ${TEMPLATE_NAME} + name: ${APPLICATION_NAME} + spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + - name: 8081-tcp-grpc + port: 8081 + protocol: TCP + targetPort: 8081 + selector: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + sessionAffinity: None + type: ClusterIP + status: + loadBalancer: {} +parameters: +- description: The name for the application. + displayName: Application Name + name: APPLICATION_NAME + required: true + value: orderingapi +- description: The OpenShift project name that is hosting the image registry. + 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: orderingapi-deploy-template +- description: The external URL of the Identity endpoint + displayName: Identity URL External + name: IDENTITY_URL_EXTERNAL + required: true +- description: The cluster internal URL of the Identity endpoint + displayName: Identity URL + name: IDENTITY_URL + required: true +- description: The hostname of the RabbitMQ service + displayName: RabbitMQ Hostname + name: RABBITMQ_HOSTNAME + required: true diff --git a/deploy/aro/ordering-api/azure-pipelines.yml b/deploy/aro/ordering-api/azure-pipelines.yml new file mode 100644 index 000000000..b81aa5040 --- /dev/null +++ b/deploy/aro/ordering-api/azure-pipelines.yml @@ -0,0 +1,36 @@ +variables: + OpenShiftServiceConnection: 'OpenShift on ARO' +trigger: + branches: + include: + - master + - dev + paths: + include: + - deploy/aro/ordering-api/* + - deploy/aro/openshift-templates/* +stages: + - stage: development + displayName: Development + variables: + OpenShiftProject: development + SourceImageRegistryProjectName: development + EnvironmentName: dev + jobs: + - job: OrderingApiDeployment + displayName: 'Ordering API Deployment' + variables: + - template: ../azure-devops-templates/variables.yml + pool: + vmImage: 'windows-latest' + steps: + - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 + displayName: 'Setup Openshift CLI' + inputs: + openshiftService: $(OpenShiftServiceConnection) + - script: 'oc project $(OpenShiftProject)' + failOnStderr: true + displayName: 'Set OpenShift Project Context' + - script: 'oc process -f ./deploy/aro/openshift-templates/orderingapi-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) -p RABBITMQ_HOSTNAME=$(RabbitMqHostname) -p IDENTITY_URL_EXTERNAL=$(IdentityUrlExternal) -p IDENTITY_URL=$(IdentityApiUrl) | oc apply -f-' + failOnStderr: true + displayName: 'Ensure Ordering API OpenShift DeploymentConfig and Service' \ No newline at end of file