Update azure-pipelines.yml for Azure Pipelines

This commit is contained in:
shamrao shinde, sumedh
2024-12-06 12:05:51 +00:00
parent a6b42c7ac7
commit 0a0b08b0bb

View File

@@ -34,16 +34,17 @@ stages:
- script: | - script: |
echo "Building the first repository..." echo "Building the first repository..."
pwd
ls -lrth ls -lrth
displayName: 'list files' displayName: 'list files'
- task: Maven@3 - task: Maven@4
inputs: inputs:
mavenPomFile: 'olympus-common/pom.xml' mavenPomFile: 'olympus-common/pom.xml'
goals: 'install' goals: 'install'
displayName: 'Build olympus-common' displayName: 'Build olympus-common'
- task: Maven@3 - task: Maven@4
inputs: inputs:
mavenPomFile: 'hermione/pom.xml' mavenPomFile: 'hermione/pom.xml'
goals: 'install -DskipTests' goals: 'install -DskipTests'
@@ -68,8 +69,15 @@ stages:
docker images docker images
displayName: 'List docker images' displayName: 'List docker images'
- upload: hermione/manifests - script: |
artifact: manifests echo "Removing Docker images to clean up..."
docker rmi $(docker images -q)
displayName: 'Clean up Docker Images'
continueOnError: true
condition: always()
#- upload: hermione/manifests
# artifact: manifests
- stage: Deploy - stage: Deploy
displayName: Deploy stage displayName: Deploy stage
@@ -88,6 +96,7 @@ stages:
runOnce: runOnce:
deploy: deploy:
steps: steps:
- checkout: self
- script: | - script: |
echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)" echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)"
displayName: 'Set Short Commit SHA' displayName: 'Set Short Commit SHA'
@@ -97,18 +106,12 @@ stages:
echo "Short Commit SHA: $(shortCommitSha)" echo "Short Commit SHA: $(shortCommitSha)"
displayName: 'Echo short commit SHA' displayName: 'Echo short commit SHA'
- task: KubernetesManifest@0 - task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster displayName: Deploy to Kubernetes cluster
inputs: inputs:
action: deploy action: deploy
namespace: olympus
manifests: | manifests: |
$(Pipeline.Workspace)/manifests/hermione-deployment.yaml $(Pipeline.Workspace)/manifests/hermione-deployment.yaml
containers: | containers: |
$(azurecontainerRegistry)/$(imageName):$(shortCommitSha) $(azurecontainerRegistry)/$(imageName):$(shortCommitSha)
- script: |
echo "Removing Docker images to clean up..."
docker rmi $(docker images -q)
displayName: 'Clean up Docker Images'
continueOnError: true
condition: always()