-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
61 lines (58 loc) · 2.22 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
trigger:
batch: true
branches:
include: [master]
pool:
vmImage: 'ubuntu-16.04'
variables:
buildConfiguration: Release
steps:
- script: |
az login --service-principal --username $(AZ_SP_ID) --password $AZ_SP_PASSWORD --tenant $(AZ_SP_TENANT_ID)
az aks install-cli
az aks get-credentials -g $(AZ_RESOURCE_GROUP) -n $(AZ_AKS_CLUSTER_NAME)
env:
AZ_SP_PASSWORD: $(AZ_SP_PASSWORD)
displayName: Login with Azure CLI
- script: |
curl https://s3.amazonaws.com/datawire-static-files/forge/$(curl https://s3.amazonaws.com/datawire-static-files/forge/latest.url)/forge -o /tmp/forge
chmod a+x /tmp/forge
sudo mv /tmp/forge /usr/local/bin
displayName: Install forge binary
- script: |
echo "# Global forge configuration" >> ./forge.yaml
echo "# DO NOT CHECK INTO GITHUB, THIS FILE CONTAINS SECRETS" >> ./forge.yaml
echo "registry:" >> ./forge.yaml
echo " type: docker" >> ./forge.yaml
echo " url: $AZ_ACR_ACCOUNT.azurecr.io" >> ./forge.yaml
echo " user: $AZ_ACR_ACCOUNT" >> ./forge.yaml
echo -n " password: " >> ./forge.yaml
printf $AZ_ACR_PASSWORD | base64 >> ./forge.yaml
echo " namespace: $AZ_ACR_ACCOUNT" >> ./forge.yaml
env:
AZ_ACR_ACCOUNT: $(AZ_ACR_ACCOUNT)
AZ_ACR_PASSWORD: $(AZ_ACR_PASSWORD)
displayName: Write forge configuration
- script: |
python3 write_env.py
env:
AZURE_SEARCH_ACCOUNT_NAME: $(AZURE_SEARCH_ACCOUNT_NAME)
AZURE_SEARCH_KEY: $(AZURE_SEARCH_KEY)
AZURE_REDIS_HOST: $(AZURE_REDIS_HOST)
AZURE_REDIS_KEY: $(AZURE_REDIS_HOST)
displayName: Write Config
- script: |
forge --profile stable build
displayName: Build image with forge
- script: |
DOCKER_IMAGE=$(docker images -q | sed 1q)
docker run -i "$DOCKER_IMAGE" /bin/sh -c "black /usr/src"
displayName: Lint with black
continueOnError: true
- script: |
DOCKER_IMAGE=$(docker images -q | sed 1q)
docker run -i -v junit:/usr/src "$DOCKER_IMAGE" /bin/sh -c "pytest src/app/tests --doctest-modules --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html"
displayName: Test with pytest
- script: |
forge --profile stable deploy
displayName: Deploy to $(AZ_AKS_CLUSTER_NAME) cluster