mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 06:45:49 +00:00
t1
This commit is contained in:
parent
d569ff9399
commit
1fd2522379
2 changed files with 88 additions and 82 deletions
|
@ -1,84 +1,6 @@
|
||||||
# Deploy to Azure Kubernetes Service
|
pool:
|
||||||
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service
|
vmImage: 'ubuntu-16.04'
|
||||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
|
|
||||||
|
|
||||||
trigger:
|
# steps:
|
||||||
- master
|
# - script: docker build -t $(dockerId)/$(imageName) .
|
||||||
|
|
||||||
resources:
|
|
||||||
- repo: self
|
|
||||||
|
|
||||||
variables:
|
|
||||||
|
|
||||||
# Container registry service connection established during pipeline creation
|
|
||||||
dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
|
|
||||||
imageRepository: '{{#toAlphaNumericString imageRepository 50}}{{/toAlphaNumericString}}'
|
|
||||||
containerRegistry: '{{ containerRegistryConnection.Authorization.Parameters.loginServer }}'
|
|
||||||
dockerfilePath: '**/Dockerfile'
|
|
||||||
tag: '$(Build.BuildId)'
|
|
||||||
|
|
||||||
# Kubernetes Namespace
|
|
||||||
k8sNamespace: '{{ k8sResource.Namespace }}'
|
|
||||||
imagePullSecret: '{{#toAlphaNumericString containerRegistryConnection.Name 50}}{{/toAlphaNumericString}}{{#shortGuid}}{{/shortGuid}}-auth'
|
|
||||||
|
|
||||||
# Agent VM image name
|
|
||||||
vmImageName: 'ubuntu-latest'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Build
|
|
||||||
displayName: Build stage
|
|
||||||
jobs:
|
|
||||||
- job: Build
|
|
||||||
displayName: Build
|
|
||||||
pool:
|
|
||||||
vmImage: $(vmImageName)
|
|
||||||
steps:
|
|
||||||
- task: Docker@2
|
|
||||||
displayName: Build and push an image to container registry
|
|
||||||
inputs:
|
|
||||||
command: buildAndPush
|
|
||||||
repository: $(imageRepository)
|
|
||||||
dockerfile: $(dockerfilePath)
|
|
||||||
containerRegistry: $(dockerRegistryServiceConnection)
|
|
||||||
tags: |
|
|
||||||
$(tag)
|
|
||||||
|
|
||||||
- task: PublishPipelineArtifact@0
|
|
||||||
inputs:
|
|
||||||
artifactName: 'manifests'
|
|
||||||
targetPath: 'manifests'
|
|
||||||
|
|
||||||
- stage: Deploy
|
|
||||||
displayName: Deploy stage
|
|
||||||
dependsOn: Build
|
|
||||||
jobs:
|
|
||||||
- deployment: Deploy
|
|
||||||
displayName: Deploy
|
|
||||||
pool:
|
|
||||||
vmImage: $(vmImageName)
|
|
||||||
environment: '{{ k8sResource.EnvironmentReference.Name }}.{{ k8sResource.Name }}'
|
|
||||||
strategy:
|
|
||||||
runOnce:
|
|
||||||
deploy:
|
|
||||||
steps:
|
|
||||||
- task: KubernetesManifest@0
|
|
||||||
displayName: Create imagePullSecret
|
|
||||||
inputs:
|
|
||||||
action: createSecret
|
|
||||||
secretName: $(imagePullSecret)
|
|
||||||
namespace: $(k8sNamespace)
|
|
||||||
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
|
|
||||||
|
|
||||||
- task: KubernetesManifest@0
|
|
||||||
displayName: Deploy to Kubernetes cluster
|
|
||||||
inputs:
|
|
||||||
action: deploy
|
|
||||||
namespace: $(k8sNamespace)
|
|
||||||
manifests: |
|
|
||||||
$(System.ArtifactsDirectory)/manifests/deployment.yml
|
|
||||||
$(System.ArtifactsDirectory)/manifests/service.yml
|
|
||||||
imagePullSecrets: |
|
|
||||||
$(imagePullSecret)
|
|
||||||
containers: |
|
|
||||||
$(containerRegistry)/$(imageRepository):$(tag)
|
|
||||||
|
|
||||||
|
|
84
azure-pipelines.yml-bkp
Normal file
84
azure-pipelines.yml-bkp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
# 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:
|
||||||
|
- master
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- repo: self
|
||||||
|
|
||||||
|
variables:
|
||||||
|
|
||||||
|
# Container registry service connection established during pipeline creation
|
||||||
|
dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
|
||||||
|
imageRepository: '{{#toAlphaNumericString imageRepository 50}}{{/toAlphaNumericString}}'
|
||||||
|
containerRegistry: '{{ containerRegistryConnection.Authorization.Parameters.loginServer }}'
|
||||||
|
dockerfilePath: '**/Dockerfile'
|
||||||
|
tag: '$(Build.BuildId)'
|
||||||
|
|
||||||
|
# Kubernetes Namespace
|
||||||
|
k8sNamespace: '{{ k8sResource.Namespace }}'
|
||||||
|
imagePullSecret: '{{#toAlphaNumericString containerRegistryConnection.Name 50}}{{/toAlphaNumericString}}{{#shortGuid}}{{/shortGuid}}-auth'
|
||||||
|
|
||||||
|
# Agent VM image name
|
||||||
|
vmImageName: 'ubuntu-latest'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: Build
|
||||||
|
displayName: Build stage
|
||||||
|
jobs:
|
||||||
|
- job: Build
|
||||||
|
displayName: Build
|
||||||
|
pool:
|
||||||
|
vmImage: $(vmImageName)
|
||||||
|
steps:
|
||||||
|
- task: Docker@2
|
||||||
|
displayName: Build and push an image to container registry
|
||||||
|
inputs:
|
||||||
|
command: buildAndPush
|
||||||
|
repository: $(imageRepository)
|
||||||
|
dockerfile: $(dockerfilePath)
|
||||||
|
containerRegistry: $(dockerRegistryServiceConnection)
|
||||||
|
tags: |
|
||||||
|
$(tag)
|
||||||
|
|
||||||
|
- task: PublishPipelineArtifact@0
|
||||||
|
inputs:
|
||||||
|
artifactName: 'manifests'
|
||||||
|
targetPath: 'manifests'
|
||||||
|
|
||||||
|
- stage: Deploy
|
||||||
|
displayName: Deploy stage
|
||||||
|
dependsOn: Build
|
||||||
|
jobs:
|
||||||
|
- deployment: Deploy
|
||||||
|
displayName: Deploy
|
||||||
|
pool:
|
||||||
|
vmImage: $(vmImageName)
|
||||||
|
environment: '{{ k8sResource.EnvironmentReference.Name }}.{{ k8sResource.Name }}'
|
||||||
|
strategy:
|
||||||
|
runOnce:
|
||||||
|
deploy:
|
||||||
|
steps:
|
||||||
|
- task: KubernetesManifest@0
|
||||||
|
displayName: Create imagePullSecret
|
||||||
|
inputs:
|
||||||
|
action: createSecret
|
||||||
|
secretName: $(imagePullSecret)
|
||||||
|
namespace: $(k8sNamespace)
|
||||||
|
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
|
||||||
|
|
||||||
|
- task: KubernetesManifest@0
|
||||||
|
displayName: Deploy to Kubernetes cluster
|
||||||
|
inputs:
|
||||||
|
action: deploy
|
||||||
|
namespace: $(k8sNamespace)
|
||||||
|
manifests: |
|
||||||
|
$(System.ArtifactsDirectory)/manifests/deployment.yml
|
||||||
|
$(System.ArtifactsDirectory)/manifests/service.yml
|
||||||
|
imagePullSecrets: |
|
||||||
|
$(imagePullSecret)
|
||||||
|
containers: |
|
||||||
|
$(containerRegistry)/$(imageRepository):$(tag)
|
||||||
|
|
Loading…
Reference in a new issue