# Deploy to Azure Kubernetes Service # Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service # https://docs.microsoft.com/azure/devops/pipelines/languages/docker trigger: batch: true branches: include: - dev resources: - repo: self variables: # Container registry service connection established during pipeline creation dockerRegistryServiceConnection: 'aosdevacr' imageRepository: 'extranetui' containerRegistry: 'aosdevacr.azurecr.io' dockerfilePath: './Dockerfile' tag: 'dev-$(Build.BuildId)' imagePullSecret: 'acr-pull' # Agent VM image name vmImageName: 'ubuntu-latest' # SonarQube service connection sonarQubeServiceConnection: 'SonarQube-Server' stages: - stage: Build displayName: Build stage jobs: - job: Build displayName: Build and Analyze pool: vmImage: $(vmImageName) steps: - task: SonarQubePrepare@6 displayName: Prepare analysis on SonarQube inputs: SonarQube: 'SonarQube-Server' scannerMode: 'CLI' configMode: 'manual' cliProjectKey: 'AOS_TravelApplication.ExtranetUI_AZGeG15Wr_tZQyWvXGx3' cliProjectName: 'AOS-ExtranetUI' cliSources: '.' extraProperties: | # Additional properties that will be passed to the scanner, # Put one key=value per line, example: # sonar.exclusions=**/*.bin sonar.java.binaries=. - task: SonarQubeAnalyze@6 displayName: Run SonarQube analysis - task: SonarQubePublish@6 displayName: Publish quality gate result inputs: pollingTimeoutSec: '300' - task: Docker@2 displayName: Build and push an image to container registry inputs: command: buildAndPush repository: $(imageRepository) dockerfile: $(dockerfilePath) containerRegistry: $(dockerRegistryServiceConnection) tags: | $(tag) - upload: kustomize/manifests artifact: kustomize/manifests #- stage: Deploy # displayName: Deploy stage # dependsOn: Build # # jobs: # - deployment: Deploy # displayName: Deploy # pool: # vmImage: $(vmImageName) # #name: 'Az-agent-pool' # environment: 'aos-dev-aks' # strategy: # runOnce: # deploy: # steps: # - task: KubernetesManifest@0 # displayName: Create imagePullSecret # inputs: # connectionType: 'Kubernetes Service Connection' # kubernetesServiceConnection: 'aos-dev-aks' # namespace: 'dev' # action: createSecret # secretName: $(imagePullSecret) # dockerRegistryEndpoint: $(dockerRegistryServiceConnection) # # - task: KubernetesManifest@0 # displayName: Deploy to Kubernetes cluster # inputs: # connectionType: 'Kubernetes Service Connection' # kubernetesServiceConnection: 'aos-dev-aks' # namespace: 'dev' # action: deploy # manifests: | # $(Pipeline.Workspace)/kustomize/manifests/dev.yaml # imagePullSecrets: | # $(imagePullSecret) # containers: | # $(containerRegistry)/$(imageRepository):$(tag) #