Commit 25571b23 authored by Daniel Scholl's avatar Daniel Scholl
Browse files

Azure AKS Final and remove Azure Web App Support

parent 87c19e0f
Pipeline #7142 passed with stage
in 9 seconds
......@@ -2,62 +2,12 @@
# EXPECTED PIPELINE INHERITED GROUP VARIABLES
# --------------------------------------------------------------------------------
# AZURE (Protected Branch)
# AZURE_APP_ID (Protected Branch)
# AZURE_APP_ID_OTHER (Protected Branch)
# AZURE_BASE (Protected Branch)
# AZURE_BASENAME (Protected Branch)
# AZURE_BASENAME_21 (Protected Branch)
# AZURE_ELASTIC_HOST (Protected Branch)
# AZURE_ELASTIC_PASSWORD (Protected Branch/Masked Variable)
# AZURE_INVALID_JWT (Protected Branch)
# AZURE_NO_ACCESS_ID (Protected Branch)
# AZURE_NO_ACCESS_SECRET (Protected Branch/Masked Variable)
# AZURE_PRINCIPAL_ID (Protected Branch)
# AZURE_PRINCIPAL_SECRET (Protected Branch/Masked Variable)
# AZURE_SERVICEBUS_KEY (Protected Branch/Masked Variable)
# AZURE_STORAGE_KEY (Protected Branch/Masked Variable)
# AZURE_SUBSCRIPTION_ID (Protected Branch)
# AZURE_SUBSCRIPTION_NAME (Protected Branch)
# AZURE_TENANT_ID (Protected Branch)
# AZURE_REGISTRY (Protected Branch)
# JOBS
azure_containerize:
tags: ["osdu-medium"]
image: docker:latest
services:
- docker:dind
stage: containerize
needs: ["compile-and-unit-test"]
variables:
IMAGE: ${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- apk add bash make py-pip
- apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python3-dev
- pip3 install azure-cli
- az --version
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
script:
- docker build -f $AZURE_BUILD_SUBDIR/Dockerfile -t ${CI_REGISTRY_IMAGE}/$IMAGE .
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${CI_REGISTRY_IMAGE}/$IMAGE:$CI_COMMIT_SHA
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${CI_REGISTRY_IMAGE}/$IMAGE:latest
- docker push ${CI_REGISTRY_IMAGE}/$IMAGE:$CI_COMMIT_SHA
- docker push ${CI_REGISTRY_IMAGE}/$IMAGE:latest
# Azure Container Registry
- az acr login -n ${AZURE_BASE}cr
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${AZURE_BASE}cr.azurecr.io/$IMAGE:$CI_COMMIT_SHA
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${AZURE_BASE}cr.azurecr.io/$IMAGE:latest
- docker push ${AZURE_BASE}cr.azurecr.io/$IMAGE:$CI_COMMIT_SHA
- docker push ${AZURE_BASE}cr.azurecr.io/$IMAGE:latest
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_containerize_aks:
tags: ["osdu-medium"]
image: danielscholl/azure-build-image
stage: containerize
......@@ -68,70 +18,43 @@ azure_containerize_aks:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- az --version
- az login --service-principal -u $AZURE_AKS_PRINCIPAL_ID -p $AZURE_AKS_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
script:
# Gitlab Container Registry
- docker build -f $AZURE_BUILD_SUBDIR/Dockerfile -t $CI_REGISTRY_IMAGE/$SHA_IMAGE .
- docker push ${CI_REGISTRY_IMAGE}/$SHA_IMAGE
# Azure Container Registry
- az acr login -n $AZURE_AKS_REGISTRY
- docker tag $CI_REGISTRY_IMAGE/$SHA_IMAGE ${AZURE_AKS_REGISTRY}.azurecr.io/$SHA_IMAGE
- docker push ${AZURE_AKS_REGISTRY}.azurecr.io/$SHA_IMAGE
- docker tag $CI_REGISTRY_IMAGE/$SHA_IMAGE ${AZURE_AKS_REGISTRY}.azurecr.io/$LATEST_IMAGE
- docker push ${AZURE_AKS_REGISTRY}.azurecr.io/$LATEST_IMAGE
only:
variables:
- $AZURE == 'true' && $AZURE_AKS == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_deploy:
image: microsoft/azure-cli
tags: ["osdu-medium"]
stage: deploy
needs: ["azure_containerize"]
variables:
AZURE_RESOURCE_GROUP: ${AZURE_BASENAME}-osdu-r2-app-rg
AZURE_FUNCTIONAPP_NAME: ${AZURE_BASENAME_21}-enque
IMAGE: ${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}
before_script:
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
script:
- |
az functionapp config container set \
--docker-custom-image-name ${AZURE_BASE}cr.azurecr.io/$IMAGE:latest \
--name $AZURE_FUNCTIONAPP_NAME \
--resource-group $AZURE_RESOURCE_GROUP \
-ojsonc
- az acr login -n $AZURE_REGISTRY
- docker tag $CI_REGISTRY_IMAGE/$SHA_IMAGE ${AZURE_REGISTRY}.azurecr.io/$SHA_IMAGE
- docker push ${AZURE_REGISTRY}.azurecr.io/$SHA_IMAGE
- docker tag $CI_REGISTRY_IMAGE/$SHA_IMAGE ${AZURE_REGISTRY}.azurecr.io/$LATEST_IMAGE
- docker push ${AZURE_REGISTRY}.azurecr.io/$LATEST_IMAGE
only:
variables:
- $AZURE == 'true'
azure_deploy_aks:
azure_deploy:
image: danielscholl/azure-build-image
tags: ["osdu-medium"]
stage: deploy
needs: ["azure_containerize_aks"]
needs: ["azure_containerize"]
variables:
BRANCH: ${CI_COMMIT_REF_SLUG}
TAG: $CI_COMMIT_SHA
before_script:
- az login --service-principal -u $AZURE_AKS_PRINCIPAL_ID -p $AZURE_AKS_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
- az aks get-credentials -g $AZURE_UNIQUE-rg -n $AZURE_UNIQUE-aks
script:
- cd devops/azure
- echo "--set image.branch=$BRANCH --set image.tag=$TAG"
# Install Service
- helm upgrade -i osdu-gitlab-$CI_PROJECT_NAME chart --set image.repository=${AZURE_AKS_REGISTRY}.azurecr.io --set image.branch=$BRANCH --set image.tag=$TAG
- helm upgrade -i osdu-gitlab-$CI_PROJECT_NAME chart --set image.repository=${AZURE_REGISTRY}.azurecr.io --set image.branch=$BRANCH --set image.tag=$TAG
- pod=$(kubectl get pod -n osdu|grep $CI_PROJECT_NAME |tail -1 |awk '{print $1}')
- status=$(kubectl wait -n osdu --for=condition=Ready pod/$pod --timeout=100s)
- if [[ "$status" != *"met"* ]]; then echo "POD didn't start correctly" ; exit 1 ; fi
only:
variables:
- $AZURE == 'true' && $AZURE_AKS == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
- $AZURE == 'true'
# EXPECTED PIPELINE INHERITED GROUP VARIABLES
# --------------------------------------------------------------------------------
# AZURE (Protected Branch)
# AZURE_APP_ID (Protected Branch)
# AZURE_APP_ID_OTHER (Protected Branch)
# AZURE_APP_OID_OTHER (Protected Branch)
# AZURE_BASE (Protected Branch)
# AZURE_BASENAME (Protected Branch)
# AZURE_BASENAME_21 (Protected Branch)
# AZURE_ELASTIC_HOST (Protected Branch)
# AZURE_ELASTIC_PASSWORD (Protected Branch/Masked Variable)
# AZURE_INVALID_JWT (Protected Branch)
# AZURE_NO_ACCESS_ID (Protected Branch)
# AZURE_NO_ACCESS_SECRET (Protected Branch/Masked Variable)
# AZURE_PRINCIPAL_ID (Protected Branch)
# AZURE_PRINCIPAL_SECRET (Protected Branch/Masked Variable)
# AZURE_SERVICEBUS_KEY (Protected Branch/Masked Variable)
# AZURE_STORAGE_KEY (Protected Branch/Masked Variable)
# AZURE_SUBSCRIPTION_ID (Protected Branch)
# AZURE_SUBSCRIPTION_NAME (Protected Branch)
# AZURE_TENANT_ID (Protected Branch)
.azure_variables:
variables:
# Deploy Section
AZURE_CLIENT_ID: $AZURE_PRINCIPAL_ID
AZURE_CLIENT_SECRET: $AZURE_PRINCIPAL_SECRET
AZURE_RESOURCE_GROUP: ${AZURE_BASENAME}-osdu-r2-app-rg
AZURE_APPSERVICE_PLAN: ${AZURE_BASENAME}-osdu-r2-sp
AZURE_APPSERVICE_NAME: ${AZURE_BASENAME_21}-au-${AZURE_SERVICE}
AZURE_CONTAINER_REGISTRY: ${AZURE_BASE}cr
AZURE_FUNCTIONAPP_NAME: ${AZURE_BASENAME_21}-enque
# Common Section
ENTITLEMENT_URL: https://${AZURE_BASENAME_21}-au-entitlements.azurewebsites.net/entitlements/v1/
LEGAL_URL: https://${AZURE_BASENAME_21}-au-legal.azurewebsites.net/api/legal/v1/
STORAGE_URL: https://${AZURE_BASENAME_21}-au-storage.azurewebsites.net/api/storage/v2/
SEARCH_URL: https://${AZURE_BASENAME_21}-au-search.azurewebsites.net/api/search/v2/
INDEXER_URL: https://${AZURE_BASENAME_21}-au-indexer.azurewebsites.net/api/indexer/v2/
AZURE_AD_TENANT_ID: $AZURE_TENANT_ID
INTEGRATION_TESTER: $AZURE_PRINCIPAL_ID
AZURE_TESTER_SERVICEPRINCIPAL_SECRET: $AZURE_PRINCIPAL_SECRET
AZURE_AD_APP_RESOURCE_ID: $AZURE_APP_ID
AZURE_STORAGE_ACCOUNT: ${AZURE_BASE}sa
MY_TENANT: opendes
DOMAIN: contoso.com
ELASTIC_HOST: $AZURE_ELASTIC_HOST
ELASTIC_PORT: 9243
ELASTIC_USER_NAME: elastic
ELASTIC_PASSWORD: $AZURE_ELASTIC_PASSWORD
# Entitlement Section
ENTITLEMENT_MEMBER_NAME_VALID: $AZURE_PRINCIPAL_ID
AZURE_AD_OTHER_APP_RESOURCE_ID: $AZURE_APP_ID_OTHER
AZURE_AD_OTHER_APP_RESOURCE_OID: $AZURE_APP_OID_OTHER
EXPIRED_TOKEN: $AZURE_INVALID_JWT
ENTITLEMENT_GROUP_NAME_VALID: integ.test.data.creator
ENTITLEMENT_MEMBER_NAME_INVALID: InvalidTestAdmin
AZURE_AD_USER_EMAIL: integration.test@azureglobal1.onmicrosoft.com
AZURE_AD_USER_OID: 469e9c25-ad0b-42e3-b023-03814437b21e
AZURE_AD_GUEST_EMAIL: integration.test@email.com
AZURE_AD_GUEST_OID: 4cf85597-116b-4aa5-bf03-7665a5b14ed5
# Legal Section
HOST_URL: https://${AZURE_BASENAME_21}-au-${AZURE_SERVICE}.azurewebsites.net/api/legal/v1/
AZURE_LEGAL_STORAGE_ACCOUNT: ${AZURE_BASE}sa
AZURE_LEGAL_STORAGE_KEY: $AZURE_STORAGE_KEY
LEGAL_STORAGE_CONTAINER: legal-service-azure-configuration
AZURE_LEGAL_SERVICEBUS: Endpoint=sb://${AZURE_BASENAME_21}sb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=${AZURE_SERVICEBUS_KEY}
AZURE_LEGAL_TOPICNAME: legaltags
# Storage Section
TENANT_NAME: opendes
TESTER_SERVICEPRINCIPAL_SECRET: $AZURE_PRINCIPAL_SECRET
NO_DATA_ACCESS_TESTER: $AZURE_NO_ACCESS_ID
NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET: $AZURE_NO_ACCESS_SECRET
PUBSUB_TOKEN: az
DEPLOY_ENV: empty
# Indexer & Search Section
SEARCH_HOST: https://${AZURE_BASENAME_21}-au-search.azurewebsites.net/api/search/v2/
aad_client_id: $AZURE_APP_ID
STORAGE_HOST: https://${AZURE_BASENAME_21}-au-storage.azurewebsites.net/api/storage/v2/
aad_client_id: $AZURE_APP_ID
DEFAULT_DATA_PARTITION_ID_TENANT1: opendes
DEFAULT_DATA_PARTITION_ID_TENANT2: $AZURE_DEFAULT_DATA_PARTITION_ID_TENANT2 # legal=common search=othertenant2
ENTITLEMENTS_DOMAIN: contoso.com
ENVIRONMENT: CLOUD
LEGAL_TAG: opendes-public-usa-dataset-7643990
OTHER_RELEVANT_DATA_COUNTRIES: US
# JOBS
# --------------------------------------------------------------------------------
azure_debug:
stage: build
tags: ["osdu-small"]
image: maven:3.3.9-jdk-8
extends:
- .azure_variables
script: |
echo "# Pipeline Variables"
echo "export AZURE_SERVICE=\"$AZURE_SERVICE\""
echo "export AZURE_BUILD_SUBDIR=\"$AZURE_BUILD_SUBDIR\""
echo "export AZURE_TEST_SUBDIR=\"$AZURE_TEST_SUBDIR\""
echo "# Group Level Variables"
echo "export AZURE_UNIQUE=\"$AZURE_UNIQUE\""
echo "export AZURE_APP_ID=\"$AZURE_APP_ID\""
echo "export AZURE_APP_ID_OTHER=\"$AZURE_APP_ID_OTHER\""
echo "export AZURE_BASE=\"$AZURE_BASE\""
echo "export AZURE_BASENAME=\"$AZURE_BASENAME\""
echo "export AZURE_BASENAME_21=\"$AZURE_BASENAME_21\""
echo "export AZURE_ELASTIC_HOST=\"$AZURE_ELASTIC_HOST\""
echo "export AZURE_ELASTIC_PASSWORD=\"$AZURE_ELASTIC_PASSWORD\""
echo "export AZURE_INVALID_JWT=\"$AZURE_INVALID_JWT\""
echo "export AZURE_NO_ACCESS_SECRET=\"$AZURE_NO_ACCESS_SECRET\""
echo "export AZURE_PRINCIPAL_ID=\"$AZURE_PRINCIPAL_ID\""
echo "export AZURE_PRINCIPAL_SECRET=\"$AZURE_PRINCIPAL_SECRET\""
echo "export AZURE_SERVICEBUS_KEY=\"$AZURE_SERVICEBUS_KEY\""
echo "export AZURE_STORAGE_KEY=\"$AZURE_STORAGE_KEY\""
echo "export AZURE_SUBSCRIPTION_ID=\"$AZURE_SUBSCRIPTION_ID\""
echo "export AZURE_SUBSCRIPTION_NAME=\"$AZURE_SUBSCRIPTION_NAME\""
echo "export AZURE_TENANT_ID=\"$AZURE_TENANT_ID\""
echo "# Deploy Section"
echo "export AZURE_CLIENT_ID=\"\$AZURE_PRINCIPAL_ID\""
echo "export AZURE_CLIENT_SECRET=\"\$AZURE_PRINCIPAL_SECRET\""
echo "export AZURE_RESOURCE_GROUP=\"${AZURE_BASENAME}-osdu-r2-app-rg\""
echo "export AZURE_APPSERVICE_PLAN=\"${AZURE_BASENAME}-osdu-r2-sp\""
echo "export AZURE_APPSERVICE_NAME=\"${AZURE_BASENAME_21}-au-${AZURE_SERVICE}\""
echo "export AZURE_CONTAINER_REGISTRY=\"${AZURE_BASE}cr\""
echo "export AZURE_FUNCTIONAPP_NAME=\"${AZURE_BASENAME_21}-enque\""
echo "# Common Section"
echo "export HOST_URL=\"$HOST_URL\""
echo "export ENTITLEMENT_URL=\"$ENTITLEMENT_URL\""
echo "export LEGAL_URL=\"$LEGAL_URL\""
echo "export STORAGE_URL=\"$STORAGE_URL\""s
echo "export SEARCH_URL=\"$SEARCH_URL\""
echo "export INDEXER_URL=\"$INDEXER_URL\""
echo "export INTEGRATION_TESTER=\"\$AZURE_PRINCIPAL_ID\""
echo "export AZURE_TESTER_SERVICEPRINCIPAL_SECRET=\"\$AZURE_PRINCIPAL_SECRET\""
echo "export AZURE_AD_APP_RESOURCE_ID=\"$AZURE_AD_APP_RESOURCE_ID\""
echo "export AZURE_AD_APP_RESOURCE_OID=\"$AZURE_AD_APP_RESOURCE_OID\""
echo "export MY_TENANT=\"$MY_TENANT\""
echo "export DOMAIN=\"$DOMAIN\""
echo "export ELASTIC_HOST=\"\$AZURE_ELASTIC_HOST\""
echo "export ELASTIC_PORT=\"$ELASTIC_PORT\""
echo "export ELASTIC_USER_NAME=\"$ELASTIC_USER_NAME\""
echo "export ELASTIC_PASSWORD=\"\$AZURE_ELASTIC_PASSWORD\""
echo "# Entitlement Section"
echo "export ENTITLEMENT_MEMBER_NAME_VALID=\"\$AZURE_PRINCIPAL_ID\""
echo "export AZURE_AD_OTHER_APP_RESOURCE_ID=\"\$AZURE_APP_ID_OTHER\""
echo "export EXPIRED_TOKEN=\"\$AZURE_INVALID_JWT\""
echo "export ENTITLEMENT_GROUP_NAME_VALID=\"$ENTITLEMENT_GROUP_NAME_VALID\""
echo "export ENTITLEMENT_MEMBER_NAME_INVALID=\"$ENTITLEMENT_MEMBER_NAME_INVALID\""
echo "export AZURE_AD_USER_EMAIL=\"\$AZURE_AD_USER_EMAIL\""
echo "export AZURE_AD_USER_OID=\"\$AZURE_AD_USER_OID\""
echo "export AZURE_AD_GUEST_EMAIL=\"\$AZURE_AD_GUEST_EMAIL\""
echo "export AZURE_AD_GUEST_OID=\"\$AZURE_AD_GUEST_OID\""
echo "# Legal Section"
echo "export AZURE_LEGAL_STORAGE_ACCOUNT=\"$AZURE_LEGAL_STORAGE_ACCOUNT\""
echo "export AZURE_LEGAL_STORAGE_KEY=\"\$AZURE_STORAGE_KEY\""
echo "export LEGAL_STORAGE_CONTAINER=\"$LEGAL_STORAGE_CONTAINER\""
echo "export AZURE_LEGAL_SERVICEBUS=\"Endpoint=sb://${AZURE_BASENAME_21}sb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=\${AZURE_SERVICEBUS_KEY}\""
echo "export AZURE_LEGAL_TOPICNAME=\"$AZURE_LEGAL_TOPICNAME\""
echo ""
echo "# Storage Section"
echo "export AZURE_AD_TENANT_ID=\"$AZURE_TENANT_ID\""
echo "export TENANT_NAME=\"$TENANT_NAME\""
echo "export TESTER_SERVICEPRINCIPAL_SECRET=\"\$AZURE_PRINCIPAL_SECRET\""
echo "export AZURE_STORAGE_ACCOUNT=\"$AZURE_STORAGE_ACCOUNT\""
echo "export NO_DATA_ACCESS_TESTER=\"$NO_DATA_ACCESS_TESTER\""
echo "export NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET=\"\$AZURE_NO_ACCESS_SECRET\""
echo "export PUBSUB_TOKEN=\"$PUBSUB_TOKEN\""
echo "export DEPLOY_ENV=\"$DEPLOY_ENV\""
echo ""
echo "# Index Section"
echo "export SEARCH_HOST=\"$SEARCH_HOST\""
echo "export STORAGE_HOST=\"$STORAGE_HOST\""
echo "export aad_client_id=\"$aad_client_id\""
echo "export ELASTIC_HOST=\"$ELASTIC_HOST\""
echo "export ELASTIC_USER_NAME=\"$ELASTIC_USER_NAME\""
echo "export DEFAULT_DATA_PARTITION_ID_TENANT1=\"$DEFAULT_DATA_PARTITION_ID_TENANT1\""
echo "export DEFAULT_DATA_PARTITION_ID_TENANT2=\"$DEFAULT_DATA_PARTITION_ID_TENANT2\""
echo "export ENTITLEMENTS_DOMAIN=\"$ENTITLEMENTS_DOMAIN\""
echo "export ENVIRONMENT=\"$ENVIRONMENT\""
echo "export LEGAL_TAG=\"$LEGAL_TAG\""
echo "export OTHER_RELEVANT_DATA_COUNTRIES=\"$OTHER_RELEVANT_DATA_COUNTRIES\""
only:
variables:
- $AZURE_DEBUG == 'true'
azure_containerize:
tags: ["osdu-medium"]
image: docker:latest
services:
- docker:dind
stage: containerize
needs: ["compile-and-unit-test"]
variables:
IMAGE: ${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- apk add bash make py-pip
- apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python3-dev
- pip3 install azure-cli
- az --version
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
script:
- |
echo 'FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]' > Dockerfile
- |
if [ "$AZURE_SERVICE" == "entitlements" ]; then
TARGET=$(find ./$AZURE_BUILD_SUBDIR/target -name '*.jar' |head -n 1)
else
TARGET=$(find ./$AZURE_BUILD_SUBDIR/target -name '*-spring-boot.jar' |head -n 1)
fi
# Gitlab Container Registry
- echo "Startup Jar is $TARGET"
- docker build --build-arg JAR_FILE=$TARGET -t ${CI_REGISTRY_IMAGE}/$IMAGE .
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${CI_REGISTRY_IMAGE}/$IMAGE:$CI_COMMIT_SHA
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${CI_REGISTRY_IMAGE}/$IMAGE:latest
- docker push ${CI_REGISTRY_IMAGE}/$IMAGE:$CI_COMMIT_SHA
- docker push ${CI_REGISTRY_IMAGE}/$IMAGE:latest
# Azure Container Registry
- az acr login -n ${AZURE_BASE}cr
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${AZURE_BASE}cr.azurecr.io/$IMAGE:$CI_COMMIT_SHA
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${AZURE_BASE}cr.azurecr.io/$IMAGE:latest
- docker push ${AZURE_BASE}cr.azurecr.io/$IMAGE:$CI_COMMIT_SHA
- docker push ${AZURE_BASE}cr.azurecr.io/$IMAGE:latest
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_deploy:
extends:
- .maven
- .azure_variables
stage: deploy
needs: ["compile-and-unit-test"]
script:
- cd $AZURE_BUILD_SUBDIR && pwd
- |
$MAVEN azure-webapp:deploy \
-DAZURE_TENANT_ID=$AZURE_TENANT_ID \
-Dazure.appservice.subscription=$AZURE_SUBSCRIPTION_ID \
-DAZURE_CLIENT_ID=$AZURE_CLIENT_ID \
-DAZURE_CLIENT_SECRET=$AZURE_CLIENT_SECRET \
-Dazure.appservice.resourcegroup=$AZURE_RESOURCE_GROUP \
-Dazure.appservice.plan=$AZURE_APPSERVICE_PLAN \
-Dazure.appservice.appname=$AZURE_APPSERVICE_NAME
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_config:
image: mcr.microsoft.com/azure-cli
tags: ["osdu-medium"]
stage: deploy
needs: ["compile-and-unit-test"]
extends:
- .azure_variables
before_script:
- az login --service-principal -u $AZURE_PRINCIPAL_ID -p $AZURE_PRINCIPAL_SECRET --tenant $AZURE_TENANT_ID
script:
- |
if [ "$AZURE_SERVICE" == "entitlements" ]; then
TARGET=$(find ./$AZURE_BUILD_SUBDIR/target -name '*.jar' |head -n 1)
else
TARGET=$(find ./$AZURE_BUILD_SUBDIR/target -name '*-spring-boot.jar' |head -n 1)
fi
- JAR_FILE=${TARGET##*/}
- echo "Startup Jar is $JAR_FILE"
- JAVA_COMMAND="java -jar /home/site/wwwroot/${JAR_FILE}"
- JSON_TEMPLATE='{"appCommandLine":"%s"}'
- JSON_FILE="config.json"
- echo $(printf "$JSON_TEMPLATE" "$JAVA_COMMAND") > $JSON_FILE
- az webapp config set --resource-group $AZURE_RESOURCE_GROUP --name $AZURE_APPSERVICE_NAME --generic-configurations @$JSON_FILE
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_test:
stage: integration
needs: ["azure_config", "azure_deploy"]
extends:
- .maven
- .azure_variables
script:
- mvn clean test -f $AZURE_TEST_SUBDIR/pom.xml
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true' || $AZURE_SKIP_TEST == 'true'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment