archetype-resources.azure-pipelines.yml Maven / Gradle / Ivy
The newest version!
variables:
- group: anypoint
- name: MAVEN_CACHE_FOLDER
value: $(Pipeline.Workspace)/.m2/repository
- name: MAVEN_OPTS
value: '--settings settings.xml -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -B -ntp -e'
- name: CI_ENVIRONMENT
value: 'Sandbox'
stages:
- stage: build
displayName: Build
jobs:
- job: build
displayName: Build Application
pool:
vmImage: 'Ubuntu-latest'
steps:
- task: Cache@2
inputs:
key: 'maven'
restoreKeys: 'maven'
path: $(MAVEN_CACHE_FOLDER)
displayName: Cache Maven local repo
- task: Maven@3
inputs:
options: "$(MAVEN_OPTS) -Danypoint.username=$(ANYPOINT_USERNAME) -Danypoint.password=$(ANYPOINT_PASSWORD)"
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- stage: deploy_sandbox
displayName: Deploy to Sandbox
variables:
- name: ENV_NAME
value: 'Sandbox'
- name: CFG_FILE
value: 'configurations/config-test.properties'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: deploy_sandbox
displayName: deploy to Sandbox
pool:
vmImage: 'Ubuntu-latest'
environment: 'Sandbox'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: Cache@2
inputs:
key: 'maven'
restoreKeys: maven
path: $(MAVEN_CACHE_FOLDER)
displayName: Cache Maven local repo
- task: Maven@3
displayName: Deploy to $(ENV_NAME)
inputs:
options: "$(MAVEN_OPTS) -Danypoint.username=$(ANYPOINT_USERNAME) -Danypoint.password=$(ANYPOINT_PASSWORD) -Danypoint.env=$(ENV_NAME) -Danypoint.deploy.propertyfile=$(Build.SourcesDirectory)/$(CFG_FILE)"
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'deploy'
- stage: deploy_prod
displayName: Deploy to Prod
variables:
- name: ENV_NAME
value: 'Prod'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: deploy_prod
displayName: deploy to Prod
pool:
vmImage: 'Ubuntu-latest'
environment: 'Sandbox'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: Cache@2
inputs:
key: 'maven'
restoreKeys: maven
path: $(MAVEN_CACHE_FOLDER)
displayName: Cache Maven local repo
- task: DownloadSecureFile@1
name: configFig
inputs:
secureFile: config-prod.properties
- task: Maven@3
displayName: Deploy to $(ENV_NAME)
inputs:
options: "$(MAVEN_OPTS) -Danypoint.username=$(ANYPOINT_USERNAME) -Danypoint.password=$(ANYPOINT_PASSWORD) -Danypoint.env=$(ENV_NAME) -Danypoint.deploy.propertyfile=$(configFig.secureFilePath)"
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'deploy'
© 2015 - 2025 Weber Informatics LLC | Privacy Policy