Merge branch 'master' of https://dev.azure.com/olympusai/Olympus/_git/hermione
This commit is contained in:
@@ -1,28 +1,114 @@
|
|||||||
# Maven
|
|
||||||
# Build your Java project and run tests with Apache Maven.
|
|
||||||
# Add steps that analyze code, save build artifacts, deploy, and more:
|
|
||||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
pool:
|
resources:
|
||||||
vmImage: ubuntu-latest
|
repositories:
|
||||||
|
- repository: olympus-common # Alias for the first repository
|
||||||
|
type: git
|
||||||
|
name: Olympus/olympus-common # Project and repository name
|
||||||
|
ref: master
|
||||||
|
|
||||||
steps:
|
variables:
|
||||||
- task: DownloadSecureFile@1
|
dockerRegistryServiceConnection: 'docker-registry-olympus'
|
||||||
name: mvnSettings
|
imageName: 'hermione'
|
||||||
displayName: 'Download Maven settings'
|
shortCommitSha: ''
|
||||||
inputs:
|
envName: 'aks-olympus'
|
||||||
secureFile: 'maven-azuredevops-settings.xml'
|
azurecontainerRegistry: 'olympusreg.azurecr.io'
|
||||||
- task: Maven@3
|
resourceName: 'olympus'
|
||||||
inputs:
|
|
||||||
mavenPomFile: 'pom.xml'
|
stages:
|
||||||
goals: 'deploy'
|
- stage: Build
|
||||||
options: '-s $(mvnSettings.secureFilePath)'
|
displayName: Build stage
|
||||||
mavenAuthenticateFeed: true
|
jobs:
|
||||||
publishJUnitResults: true
|
- job: Build
|
||||||
testResultsFiles: '**/TEST-*.xml'
|
displayName: "Build & push to ACR"
|
||||||
javaHomeOption: 'JDKVersion'
|
pool:
|
||||||
jdkVersionOption: '1.21'
|
name: azureselfhosted
|
||||||
mavenVersionOption: 'Default'
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
- checkout: olympus-common
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)"
|
||||||
|
displayName: 'Set Short Commit SHA'
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo "Building the first repository..."
|
||||||
|
ls -lrth
|
||||||
|
displayName: 'list files'
|
||||||
|
|
||||||
|
- task: Maven@3
|
||||||
|
inputs:
|
||||||
|
mavenPomFile: 'olympus-common/pom.xml'
|
||||||
|
goals: 'install'
|
||||||
|
displayName: 'Build olympus-common'
|
||||||
|
|
||||||
|
- task: Maven@3
|
||||||
|
inputs:
|
||||||
|
mavenPomFile: 'hermione/pom.xml'
|
||||||
|
goals: 'install -DskipTests'
|
||||||
|
displayName: 'Build hermione'
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo "Listing the docker images..."
|
||||||
|
docker images
|
||||||
|
displayName: 'list docker images'
|
||||||
|
|
||||||
|
- task: Docker@2
|
||||||
|
inputs:
|
||||||
|
command: 'buildAndPush'
|
||||||
|
repository: '$(imageName)'
|
||||||
|
Dockerfile: 'hermione/Dockerfile'
|
||||||
|
containerRegistry: $(dockerRegistryServiceConnection)
|
||||||
|
tags: '$(shortCommitSha)'
|
||||||
|
displayName: 'Build and push an image to container registry'
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo "Listing the docker images..."
|
||||||
|
docker images
|
||||||
|
displayName: 'List docker images'
|
||||||
|
|
||||||
|
- upload: hermione/manifests
|
||||||
|
artifact: manifests
|
||||||
|
|
||||||
|
- stage: Deploy
|
||||||
|
displayName: Deploy stage
|
||||||
|
dependsOn: Build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- deployment: Deploy
|
||||||
|
condition: succeeded()
|
||||||
|
displayName: "Deploy to ${{variables.envName}}"
|
||||||
|
pool:
|
||||||
|
name: azureselfhosted
|
||||||
|
environment:
|
||||||
|
name: $(envName).$(resourceName)
|
||||||
|
resourceType: Kubernetes
|
||||||
|
strategy:
|
||||||
|
runOnce:
|
||||||
|
deploy:
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)"
|
||||||
|
displayName: 'Set Short Commit SHA'
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
echo "########################################################################"
|
||||||
|
echo "Short Commit SHA: $(shortCommitSha)"
|
||||||
|
displayName: 'Echo short commit SHA'
|
||||||
|
|
||||||
|
- task: KubernetesManifest@0
|
||||||
|
displayName: Deploy to Kubernetes cluster
|
||||||
|
inputs:
|
||||||
|
action: deploy
|
||||||
|
manifests: |
|
||||||
|
$(Pipeline.Workspace)/manifests/hermione-deployment.yaml
|
||||||
|
containers: |
|
||||||
|
$(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()
|
||||||
31
manifests/hermione-deployment.yaml
Normal file
31
manifests/hermione-deployment.yaml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
name: hermione
|
||||||
|
namespace: olympus
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: hermione
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: hermione
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: hermione
|
||||||
|
image: olympusreg.azurecr.io/hermione:a843dee4
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: olympus-db-shared-cfg
|
||||||
|
env:
|
||||||
|
- name: HERMIONE_FE_URL
|
||||||
|
value: http://hermione-aks.olympusai.live
|
||||||
|
- name: ARIADNE_FE_URL
|
||||||
|
value: http://ariadne-aks.olympusai.live
|
||||||
|
- name: EUREKA_URI
|
||||||
|
value: >-
|
||||||
|
http://eureka-server-service.olympus.svc.cluster.local:8761/eureka
|
||||||
|
resources: {}
|
||||||
|
imagePullPolicy: Always
|
||||||
Reference in New Issue
Block a user