Created
August 11, 2020 19:00
-
-
Save mariomeyrelles/2cf7375c13e64e5193ea0b1a9e524f04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: | |
- master | |
pr: none | |
pool: | |
vmImage: 'ubuntu-latest' | |
variables: | |
- group: shared-variables | |
stages: | |
- stage: build | |
jobs: | |
- job: build_app | |
pool: | |
vmImage: 'ubuntu-latest' | |
steps: | |
- task: Gradle@2 | |
inputs: | |
gradleWrapperFile: 'gradlew' | |
tasks: 'build' | |
publishJUnitResults: true | |
testResultsFiles: '**/TEST-*.xml' | |
javaHomeOption: 'JDKVersion' | |
options: '-x :startScripts' | |
- task: CmdLine@2 | |
enabled: false | |
inputs: | |
script: | | |
./gradlew sonarqube \ | |
-Dsonar.projectKey=$(SonarProjectKeyJava) \ | |
-Dsonar.host.url=$(SonarUrl) \ | |
-Dsonar.login=$(SonarLogin) | |
- task: CopyFiles@2 | |
displayName: 'Copy File to: $(TargetFolder)' | |
inputs: | |
SourceFolder: '$(Build.SourcesDirectory)' | |
Contents: | | |
**/*.war | |
**/*jar-with-dependencies.jar | |
**/deploy-web-app.json | |
TargetFolder: '$(Build.ArtifactStagingDirectory)' | |
flattenFolders: true | |
- task: PublishBuildArtifacts@1 | |
displayName: 'Publish Artifacts: drop' | |
- stage: deploy | |
dependsOn: build | |
jobs: | |
- job: deploy_arm_template | |
pool: | |
vmImage: 'ubuntu-latest' | |
steps: | |
- task: DownloadBuildArtifacts@0 | |
inputs: | |
buildType: 'current' | |
downloadType: 'specific' | |
itemPattern: 'drop/**' | |
downloadPath: '$(System.ArtifactsDirectory)' | |
- task: AzureResourceManagerTemplateDeployment@3 | |
inputs: | |
deploymentScope: 'Resource Group' | |
azureResourceManagerConnection: 'AzureRM Connection' | |
subscriptionId: 'e6e6977a-839e-4361-b6e3-86b8d7820c52' | |
action: 'Create Or Update Resource Group' | |
resourceGroupName: 'demo-java-vale-rg2' | |
location: 'East US 2' | |
templateLocation: 'Linked artifact' | |
csmFile: '$(System.ArtifactsDirectory)/drop/deploy-web-app.json' | |
overrideParameters: '-webAppName demo-java-vale-12121 -hostingPlanName demo-java-vale-plan-12121 -appInsightsLocation "East US 2" -sku "P1v2 Premium"' | |
deploymentMode: 'Incremental' | |
- stage: publish | |
dependsOn: deploy | |
jobs: | |
- deployment: PublishWebApp | |
displayName: Publish Web App | |
pool: | |
vmImage: 'Ubuntu-latest' | |
# este ambiente, caso não exista, será criado e aparecerá na aba "Environments", dentro de Pipelines. | |
environment: 'java-web-app-azure' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: DownloadBuildArtifacts@0 | |
inputs: | |
buildType: 'current' | |
downloadType: 'specific' | |
itemPattern: 'drop/**' | |
downloadPath: '$(System.ArtifactsDirectory)' | |
- task: AzureRmWebAppDeployment@4 | |
inputs: | |
ConnectionType: 'AzureRM' | |
azureSubscription: 'AzureRM Connection' | |
appType: 'webAppLinux' | |
WebAppName: 'demo-java-vale-12121' | |
packageForLinux: '$(System.ArtifactsDirectory)/**/*.war' | |
RuntimeStack: 'TOMCAT|9.0-jre8' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment