diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cff7fecdc8f8283f23fac1ecd0b464019778b817..5b41901e9ab351c8ba9372fff7d8aff7f0ddbafc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,11 @@ variables: SIS_DATA: $CI_PROJECT_DIR/apachesis_setup/SIS_DATA + AZURE_SERVICE: crs_converter + AZURE_BUILD_SUBDIR: provider/crs-converter-azure/crs-converter-aks + AZURE_TEST_SUBDIR: testing/crs_converter_test_azure + + AWS_BUILD_SUBDIR: provider/crs-converter-aws/build-aws AWS_TEST_SUBDIR: testing/crs_converter_test_aws AWS_SERVICE: crs-conversion @@ -24,6 +29,9 @@ include: - project: "osdu/platform/ci-cd-pipelines" file: "scanners/gitlab-ultimate.yml" + - project: "osdu/platform/ci-cd-pipelines" + file: "cloud-providers/azure.yml" + - project: "osdu/platform/ci-cd-pipelines" file: "cloud-providers/aws.yml" diff --git a/devops/azure/Dockerfile b/devops/azure/Dockerfile deleted file mode 100644 index 95aa22a744f51ccef819f58dd49208a585290548..0000000000000000000000000000000000000000 --- a/devops/azure/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM openjdk:8-jdk-alpine - -COPY provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-1.0.0.jar /app.jar - -ENTRYPOINT ["java","-jar","/app.jar"] - diff --git a/devops/azure/chart/.helmignore b/devops/azure/chart/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/devops/azure/chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/devops/azure/chart/Chart.yaml b/devops/azure/chart/Chart.yaml index 7a9d162b9b3ab6d43d5e68da038cd8a979fdb237..0f2538d69b45ad3fc99d573b0a8361824bd4932d 100644 --- a/devops/azure/chart/Chart.yaml +++ b/devops/azure/chart/Chart.yaml @@ -1,6 +1,36 @@ +# Copyright Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: v2 -name: crs-conversion-service -appVersion: "latest" -description: Helm Chart for installing crs-conversion-service service. -version: 0.1.0 +name: crs-converter +description: A Helm chart for installing crs-conversion-service on Azure + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: "latest" \ No newline at end of file diff --git a/devops/azure/chart/templates/NOTES.txt b/devops/azure/chart/templates/NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..0840ebc4634db658ec74b4fdaedd741e6f0dbcd4 --- /dev/null +++ b/devops/azure/chart/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "azure-crs-converter.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "azure-crs-converter.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "azure-crs-converter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "azure-crs-converter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/devops/azure/chart/templates/_helpers.tpl b/devops/azure/chart/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..9fcf67ac07995c0f3110aff958f679c7a4af8448 --- /dev/null +++ b/devops/azure/chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "azure-crs-converter.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "azure-crs-converter.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "azure-crs-converter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "azure-crs-converter.labels" -}} +helm.sh/chart: {{ include "azure-crs-converter.chart" . }} +{{ include "azure-crs-converter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "azure-crs-converter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "azure-crs-converter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "azure-crs-converter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "azure-crs-converter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/devops/azure/chart/templates/deployment.yaml b/devops/azure/chart/templates/deployment.yaml index 7334c3dcb10cc940207daba1321fd6e7983ea261..b178350c743da9b6beb3bd96f6a347d4c14e6a6a 100644 --- a/devops/azure/chart/templates/deployment.yaml +++ b/devops/azure/chart/templates/deployment.yaml @@ -1,81 +1,115 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Release.Name }} namespace: osdu + name: {{ include "azure-crs-converter.fullname" . }} + labels: + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity spec: +{{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.global.replicaCount }} +{{- end }} selector: matchLabels: + aadpodidbinding: osdu-identity app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} template: metadata: labels: - app: {{ .Chart.Name }} aadpodidbinding: osdu-identity + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} spec: volumes: - - name: azure-keyvault - csi: - driver: secrets-store.csi.k8s.io - readOnly: true - volumeAttributes: - secretProviderClass: azure-keyvault - containers: - - name: {{ .Chart.Name }} - image: {{ .Values.image.repository }}/{{ .Chart.Name }}-{{ .Values.image.branch }}:{{ .Values.image.tag | default .Chart.AppVersion }} - imagePullPolicy: Always - ports: - - containerPort: 8080 - readinessProbe: - httpGet: - path: /api/crs/converter/swagger-ui.html - port: 8080 - volumeMounts: - name: azure-keyvault - mountPath: "/mnt/azure-keyvault" - readOnly: true - env: - - name: spring_application_name - value: crs-conversion-service - - name: server.servlet.contextPath - value: /api/crs/converter/ - - name: server_port - value: "8080" - - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS - value: "true" - - name: KEYVAULT_URI - valueFrom: - configMapKeyRef: - name: osdu-svc-properties - key: ENV_KEYVAULT - - name: AZURE_TENANT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: tenantid - - name: AZURE_CLIENT_ID - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientid - - name: AZURE_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: active-directory - key: principal-clientpassword - - name: appinsights_key - valueFrom: - secretKeyRef: - name: central-logging - key: appinsights - - name: aad_client_id - valueFrom: - secretKeyRef: - name: active-directory - key: application-appid - - name: ENTITLEMENT_URL - value: http://entitlements-azure/entitlements/v1 - - name: azure_istioauth_enabled - value: "true" - + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: azure-keyvault + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}/{{ .Chart.Name }}-{{ .Values.image.branch }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.application.port }} + protocol: TCP + readinessProbe: + httpGet: + path: /api/crs/converter/swagger-ui.html + port: {{ .Values.application.port }} + initialDelaySeconds: 45 + timeoutSeconds: 15 + periodSeconds: 2 + successThreshold: 1 + failureThreshold: 5 + volumeMounts: + - name: azure-keyvault + mountPath: "/mnt/azure-keyvault" + readOnly: true + env: + - name: spring_application_name + value: crs-conversion-service + - name: server.servlet.contextPath + value: /api/crs/converter/ + - name: server_port + value: "8080" + - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS + value: "true" + - name: KEYVAULT_URI + valueFrom: + configMapKeyRef: + name: osdu-svc-properties + key: ENV_KEYVAULT + - name: AZURE_TENANT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: tenantid + - name: AZURE_CLIENT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientid + - name: AZURE_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientpassword + - name: appinsights_key + valueFrom: + secretKeyRef: + name: central-logging + key: appinsights + - name: aad_client_id + valueFrom: + secretKeyRef: + name: active-directory + key: application-appid + - name: ENTITLEMENT_URL + value: http://entitlements-azure/entitlements/v1 + - name: azure_istioauth_enabled + value: "true" + - name: ESRI_DATA_PATH + value: \crs-conversion-service + - name: cosmosdb_database + value: osdu-db + - name: service_domain_name + value: contoso.com diff --git a/devops/azure/chart/templates/service.yaml b/devops/azure/chart/templates/service.yaml index a0134bfb4f157206791df4312d89a76ca03339da..0e70c075b449fab3d173441ecf0235696a1c5115 100644 --- a/devops/azure/chart/templates/service.yaml +++ b/devops/azure/chart/templates/service.yaml @@ -1,13 +1,34 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. apiVersion: v1 kind: Service metadata: - name: {{ .Chart.Name }} + name: crs-conversion-service namespace: osdu + labels: + resource: "crsService" + app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity spec: - type: ClusterIP + type: {{ .Values.service.type }} ports: - - protocol: TCP - port: 80 - targetPort: 8080 + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetport }} + protocol: TCP + name: http selector: app: {{ .Chart.Name }} + appversion: {{ .Chart.Version }} + aadpodidbinding: osdu-identity diff --git a/devops/azure/chart/values.yaml b/devops/azure/chart/values.yaml index 69862f83b33ea3122246c8666301b305b6359db5..bb51c8c5879924fe9e76c13ff0d952ec7ff20b7c 100644 --- a/devops/azure/chart/values.yaml +++ b/devops/azure/chart/values.yaml @@ -1,10 +1,34 @@ +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + global: replicaCount: 1 image: - repository: ${CONTAINER_REGISTRY_NAME}.azurecr.io/crs-conversion-app - tag: latest + repository: community.opengroup.org:5555/osdu/platform/system/reference/crs-conversion-service pullPolicy: Always - - - + branch: master + tag: latest +service: + type: ClusterIP + port: 80 + targetport: 8080 +application: + port: 8080 +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 diff --git a/devops/azure/pipeline.yml b/devops/azure/pipeline.yml index 23ccad1c2be80a46aca28fc118a1a6a4c66a06f2..110f4d54266f616cc518b23fdf5513da661c00a2 100644 --- a/devops/azure/pipeline.yml +++ b/devops/azure/pipeline.yml @@ -1,4 +1,3 @@ - trigger: batch: true branches: @@ -31,9 +30,6 @@ variables: value: "devops/azure/chart/helm-config.yaml" - name: 'MANIFEST_REPO' value: $[ resources.repositories['FluxRepo'].name ] - - name: dockerFile - value: "devops/azure/Dockerfile" - stages: - template: /devops/build-stage.yml@TemplateRepo parameters: @@ -45,7 +41,6 @@ stages: pom.xml provider/crs-converter-azure/crs-converter-aks/pom.xml provider/crs-converter-azure/crs-converter-aks/target/*.jar - devops/azure/Dockerfile copyFileContentsToFlatten: '' mavenSettingsFile: './maven/settings.xml' serviceBase: ${{ variables.serviceName }} @@ -57,7 +52,6 @@ stages: serviceName: ${{ variables.serviceName }} chartPath: ${{ variables.chartPath }} valuesFile: ${{ variables.valuesFile }} - dockerFile: ${{ variables.dockerFile }} testCoreMavenPomFile: '' testCoreMavenOptions: '' skipDeploy: ${{ variables.SKIP_DEPLOY }} diff --git a/devops/azure/release.yaml b/devops/azure/release.yaml new file mode 100644 index 0000000000000000000000000000000000000000..30148364e9c7e969395ae9bd38633910cf2f3dd6 --- /dev/null +++ b/devops/azure/release.yaml @@ -0,0 +1,151 @@ +--- +# Source: crs-converter/templates/service.yaml +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +apiVersion: v1 +kind: Service +metadata: + name: crs-conversion-service + namespace: osdu + labels: + resource: "crsService" + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +--- +# Source: crs-converter/templates/deployment.yaml +# Copyright © Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: osdu + name: osdu-gitlab-crs-conversion-service-crs-converter + labels: + app: crs-converter + appversion: 0.1.0 + aadpodidbinding: osdu-identity +spec: + replicas: 1 + selector: + matchLabels: + aadpodidbinding: osdu-identity + app: crs-converter + appversion: 0.1.0 + template: + metadata: + labels: + aadpodidbinding: osdu-identity + app: crs-converter + appversion: 0.1.0 + spec: + volumes: + - name: azure-keyvault + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: azure-keyvault + containers: + - name: crs-converter + image: "community.opengroup.org:5555/osdu/platform/system/reference/crs-conversion-service/crs-converter-master:latest" + imagePullPolicy: Always + ports: + - name: http + containerPort: 8080 + protocol: TCP + readinessProbe: + httpGet: + path: /api/crs/converter/swagger-ui.html + port: 8080 + initialDelaySeconds: 45 + timeoutSeconds: 15 + periodSeconds: 2 + successThreshold: 1 + failureThreshold: 5 + volumeMounts: + - name: azure-keyvault + mountPath: "/mnt/azure-keyvault" + readOnly: true + env: + - name: spring_application_name + value: crs-conversion-service + - name: server.servlet.contextPath + value: /api/crs/converter/ + - name: server_port + value: "8080" + - name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS + value: "true" + - name: KEYVAULT_URI + valueFrom: + configMapKeyRef: + name: osdu-svc-properties + key: ENV_KEYVAULT + - name: AZURE_TENANT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: tenantid + - name: AZURE_CLIENT_ID + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientid + - name: AZURE_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: active-directory + key: principal-clientpassword + - name: appinsights_key + valueFrom: + secretKeyRef: + name: central-logging + key: appinsights + - name: aad_client_id + valueFrom: + secretKeyRef: + name: active-directory + key: application-appid + - name: ENTITLEMENT_URL + value: http://entitlements-azure/entitlements/v1 + - name: azure_istioauth_enabled + value: "true" + - name: ESRI_DATA_PATH + value: \crs-conversion-service + - name: cosmosdb_database + value: osdu-db + - name: service_domain_name + value: contoso.com \ No newline at end of file diff --git a/provider/crs-converter-azure/crs-converter-aks/pom.xml b/provider/crs-converter-azure/crs-converter-aks/pom.xml index 352b31671daab17f2674634f603891561e39fd66..e377fe72588523e990d14d414937d0dadcd7f218 100644 --- a/provider/crs-converter-azure/crs-converter-aks/pom.xml +++ b/provider/crs-converter-azure/crs-converter-aks/pom.xml @@ -22,7 +22,7 @@ </prerequisites> <artifactId>crs-converter-aks</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.1-SNAPSHOT</version> <name>crs-converter-aks</name> <description>CRS converter service Azure Kubernetes Deployment</description> diff --git a/testing/crs_converter_test_azure/requirements.txt b/testing/crs_converter_test_azure/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..106c21fef3178d4ba708f9d0f3558f61f5909237 --- /dev/null +++ b/testing/crs_converter_test_azure/requirements.txt @@ -0,0 +1,18 @@ +adal==1.2.2 +boto3==1.14.40 +botocore==1.17.54 +certifi==2019.11.28 +cffi==1.14.0 +chardet==3.0.4 +cryptography==2.8 +docutils==0.15.2 +idna==2.9 +jmespath==0.10.0 +pycparser==2.20 +PyJWT==1.7.1 +python-dateutil==2.8.1 +requests==2.23.0 +s3transfer==0.3.3 +six==1.14.0 +urllib3==1.25.8 +xmlrunner==1.7.7 \ No newline at end of file diff --git a/testing/crs_converter_test_azure/run-integration-tests.sh b/testing/crs_converter_test_azure/run-integration-tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..63cf9d7c51ba02679b683db1fed904c9316572aa --- /dev/null +++ b/testing/crs_converter_test_azure/run-integration-tests.sh @@ -0,0 +1,38 @@ +#!/usr/bin/bash + +# Install venv for python3 +which apt-get && sudo apt-get install -y python3 python3-pip python3-venv || echo "Not Ubuntu, skipping" +which yum && sudo yum install -y python3 python3-pip python3-venv || echo "Not RHEL, skipping" +# if [[ "$OSTYPE" =~ ^msys ]]; then #windows + # if ! [ -x "$(command -v virtualenv)" ]; then + # python -m pip install virtualenv + # fi + + # python -m venv env + # source env/Scripts/activate + + # python -m pip install --upgrade pip + # python -m pip install -r requirements.txt +# else +python3 -m venv env +#sed -i 's/$1/${1:-}/' env/bin/activate # Fix deactivation bug '$1 unbound variable' +source env/bin/activate +python3 -m pip install --upgrade pip +python3 -m pip install -r requirements.txt + +# Run tests +echo ***RUNNING CRS Converter API TESTS*** +python3 run_test_api.py +TEST_STATUS=$? +echo ***FINISHED CRS Converter API V2 TESTS*** + + +# python3 -m pip freeze > requirements.txt +python3 -m pip uninstall -r requirements.txt -y +deactivate +rm -rf env/ + +if [ $TEST_STATUS -ne 0 ] +then + exit 1 +fi diff --git a/testing/crs_converter_test_azure/run_test_api.py b/testing/crs_converter_test_azure/run_test_api.py new file mode 100644 index 0000000000000000000000000000000000000000..50ef45ed26cccb5db52b78739996536258d91f37 --- /dev/null +++ b/testing/crs_converter_test_azure/run_test_api.py @@ -0,0 +1,8 @@ +import sys +sys.path.append("..") + +from crs_converter_test_core.test_crs_converter import * + +if __name__ == '__main__': + import xmlrunner + unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports/v2', outsuffix='azure'))