-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
77 lines (67 loc) · 2.5 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
76
77
# Maven package Java project Web App to Linux on Azure
# Build your Java project and deploy it to Azure as a Linux web app
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- main
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: "14fa68b9-b7b7-4b72-b36b-577ec8b104ec"
# Web app name
webAppName: "realtorairbnb-api"
# Environment name
environmentName: "realtorairbnb-api"
# Agent VM image name
vmImageName: "ubuntu-latest"
stages:
- stage: Build
displayName: Build stage
jobs:
- job: MavenPackageAndPublishArtifacts
displayName: Maven Package and Publish Artifacts
pool:
vmImage: $(vmImageName)
steps:
- bash: |
echo "Setting environment variables"
env:
DATABASE_HOST: $(DATABASE_HOST)
DATABASE_NAME: $(DATABASE_NAME)
DATABASE_PASSWORD: $(DATABASE_PASSWORD)
DATABASE_PORT: $(DATABASE_PORT)
DATABASE_USERNAME: $(DATABASE_USERNAME)
AUTH0_DOMAIN: $(AUTH0_DOMAIN)
AUTH0_AUDIENCE: $(AUTH0_AUDIENCE)
- task: Maven@3
displayName: "Maven Package"
inputs:
mavenPomFile: "$(System.DefaultWorkingDirectory)/server/realtor-airbnb/pom.xml"
- task: CopyFiles@2
displayName: "Copy Files to artifact staging directory"
inputs:
SourceFolder: "$(System.DefaultWorkingDirectory)/server/realtor-airbnb"
Contents: "**/target/*.?(war|jar)"
TargetFolder: $(Build.ArtifactStagingDirectory)/server/realtor-airbnb
- upload: $(Build.ArtifactStagingDirectory)
artifact: drop
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeployLinuxWebApp
displayName: Deploy Linux Web App
environment: $(environmentName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: "Azure Web App Deploy: realtorairbnb-api"
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
package: "$(Pipeline.Workspace)/drop/**/target/*.?(war|jar)"