Commit f0fdd920 authored by Daniel Scholl's avatar Daniel Scholl
Browse files

Merge branch 'trusted-azure' into 'master'

Function App Pipeline

See merge request osdu/platform/ci-cd-pipelines!23
parents e585c9da ebd8b2eb
# 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)
# JOBS
# --------------------------------------------------------------------------------
azure_containerize:
tags: ["docker-runner"]
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_BUILD_ID}
- docker push ${CI_REGISTRY_IMAGE}/$IMAGE:${CI_BUILD_ID}
# Azure Container Registry
- az acr login -n ${AZURE_BASE}cr
- docker tag ${CI_REGISTRY_IMAGE}/$IMAGE ${AZURE_BASE}cr.azurecr.io/$IMAGE:${CI_BUILD_ID}
- docker push ${AZURE_BASE}cr.azurecr.io/$IMAGE:${CI_BUILD_ID}
only:
variables:
- $AZURE == 'true'
except:
variables:
- $AZURE_DEBUG == 'true'
azure_deploy:
image: microsoft/azure-cli
stage: deploy
needs: ["azure_containerize"]
variables:
AZURE_RESOURCE_GROUP: ${AZURE_BASENAME}-osdu-r2-app-rg
AZURE_FUNCTIONAPP_NAME: ${AZURE_BASENAME_21}-enque
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:${CI_BUILD_ID} \
--name $AZURE_FUNCTIONAPP_NAME \
--resource-group $AZURE_RESOURCE_GROUP \
-ojsonc
Markdown is supported
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