-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Expand file tree
/
Copy pathazure-pipelines-2.yml
More file actions
51 lines (43 loc) · 1.4 KB
/
azure-pipelines-2.yml
File metadata and controls
51 lines (43 loc) · 1.4 KB
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
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
jobs:
# JOB 1: Compilar el proyecto con Maven
- job: Build
displayName: Build Maven Project
steps:
- task: Maven@4
displayName: 'Maven Package'
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package -DskipTests'
- task: CopyFiles@2
displayName: 'Copy Files to artifact staging directory'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: '**/target/*.?(war|jar)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- publish: '$(Build.ArtifactStagingDirectory)'
artifact: 'drop'
# JOB 2: Despliegue en entorno de máquinas virtuales Linux
- deployment: VMDeploy
displayName: Web deploy to Linux VM
dependsOn: Build
condition: succeeded()
environment:
name: 'maquina1' # Tu environment existente
resourceType: VirtualMachine
tags: 'linux-app' # Etiqueta de las VMs (ajústala según tu entorno)
strategy:
runOnce: # Ejecuta una vez por VM
deploy:
steps:
- download: current
artifact: drop
- script: |
echo " Iniciando despliegue en máquina virtual Linux..."
echo " Artefactos disponibles:"
ls -R $(Pipeline.Workspace)/drop
echo "✅Despliegue completado en la VM con tag 'linux-app'"
displayName: 'Ejecutar despliegue en VM Linux'