Untitled
markdown
8 days ago
3.1 kB
2
Indexable
Never
trigger: - master pr: - '*' stages: - stage: BuildAndTest displayName: 'Build and Test' jobs: - job: BuildAndTest displayName: 'Build and Test' pool: vmImage: 'windows-latest' steps: - task: UseJavaVersion@1 inputs: versionSpec: '11' # Java 11 jdkArchitectureOption: 'x64' - script: | # Build and test your Spring application # For example, using Maven: mvn clean install displayName: 'Build and Test' - stage: DeployToDev displayName: 'Deploy to Development' dependsOn: BuildAndTest jobs: - job: DeployToDev displayName: 'Deploy to Development' pool: vmImage: 'ubuntu-latest' steps: - script: | # Deployment steps for your development environment (Linux server) # Example: Copy the built artifact to the Dev server # Define source and destination paths $sourcePath = "$(Pipeline.Workspace)/target/your-app.jar" # Update the path to your built JAR $destinationPath = "/path/to/development/server" # Update the destination folder on Dev server # Copy the JAR file to the Dev server scp $sourcePath user@dev-server:$destinationPath # Optionally, you can run commands to restart services, etc., on the Dev server displayName: 'Deploy to Development' - stage: DeployToStaging displayName: 'Deploy to Staging' dependsOn: DeployToDev jobs: - job: DeployToStaging displayName: 'Deploy to Staging' pool: vmImage: 'ubuntu-latest' steps: - script: | # Deployment steps for your staging environment (Linux server) # Example: Copy the built artifact to the Staging server # Define source and destination paths $sourcePath = "$(Pipeline.Workspace)/target/your-app.jar" # Update the path to your built JAR $destinationPath = "/path/to/staging/server" # Update the destination folder on Staging server # Copy the JAR file to the Staging server scp $sourcePath user@staging-server:$destinationPath # Optionally, you can run commands to restart services, etc., on the Staging server displayName: 'Deploy to Staging' - stage: DeployToProd displayName: 'Deploy to Production' dependsOn: DeployToStaging jobs: - job: DeployToProd displayName: 'Deploy to Production' pool: vmImage: 'ubuntu-latest' steps: - script: | # Deployment steps for your production environment (Linux server) # Example: Copy the built artifact to the Production server # Define source and destination paths $sourcePath = "$(Pipeline.Workspace)/target/your-app.jar" # Update the path to your built JAR $destinationPath = "/path/to/production/server" # Update the destination folder on Production server # Copy the JAR file to the Production server scp $sourcePath user@production-server:$destinationPath # Optionally, you can run commands to restart services, etc., on the Production server displayName: 'Deploy to Production'