-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
75 lines (61 loc) · 2.23 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
project.name: 'car-lookup'
image.name: bija/car_lookup
python.version: 3.9
steps:
- task: UsePythonVersion@0
displayName: Use Python $(python.version)
inputs:
versionSpec: '$(python.version)'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- script: pip install .[dev]
displayName: 'Install package'
- script: 'pylint -E slackbot/*.py'
displayName: Perform linting using pylint
continueOnError: true
- script: 'pytest --junitxml=junit/test-results.xml --cov=slackbot --cov-report=xml --cov-report=html'
displayName: Perform coverage test
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results $(python.version)'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
- task: Docker@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Docker login
inputs:
command: login
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: bija-dockerhub
- task: Docker@1
displayName: Docker build
inputs:
command: build
dockerFile: 'Dockerfile'
imageName: $(image.name)
includeLatestTag: true
# TODO: run the container to see if it actually starts up...
- task: Docker@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Docker push
inputs:
command: push
imageName: $(image.name)
- task: AzureCLI@1
condition: false
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Restart car-lookup container group
inputs:
# connectedServiceNameARM: azure-car-lookup-rg In Azure we need a SP which is allowed to restart the container.ß
scriptLocation: inlineScript
inlineScript: az container restart -g car-lookup-rg -n car-lookup-slackbot-api -o table