From 7059bc8267be81665072eb1f3f7150e51a579c42 Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 5 May 2023 09:34:58 +0300 Subject: [PATCH] separate build and deploy stages --- etc/azure/build-push.yaml | 39 +++++++++++++++++++++ etc/azure/deploy-to-k8s.yml | 67 ------------------------------------- 2 files changed, 39 insertions(+), 67 deletions(-) create mode 100644 etc/azure/build-push.yaml delete mode 100644 etc/azure/deploy-to-k8s.yml diff --git a/etc/azure/build-push.yaml b/etc/azure/build-push.yaml new file mode 100644 index 0000000..b8a5bb1 --- /dev/null +++ b/etc/azure/build-push.yaml @@ -0,0 +1,39 @@ +variables: + version: $(Build.BuildId) + +trigger: + branches: + include: + - refs/heads/main + +pool: + vmImage: "ubuntu-latest" + +steps: + - task: UseDotNet@2 + displayName: "Use .NET sdk" + inputs: + packageType: sdk + version: 7.0.x + installationPath: $(Agent.ToolsDirectory)/dotnet + includePreviewVersions: true + + - task: PowerShell@2 + displayName: Build docker images + inputs: + filePath: "etc/k8s/scripts/build-images.ps1" + arguments: "-version $(version)" + + - task: Docker@2 + displayName: Login to ACR + inputs: + containerRegistry: "volosoft" + command: "login" + + - task: PowerShell@2 + displayName: Push images to ACR + inputs: + filePath: "etc/azure/scripts/push-images.ps1" + arguments: "-version $(version)" + + diff --git a/etc/azure/deploy-to-k8s.yml b/etc/azure/deploy-to-k8s.yml deleted file mode 100644 index e97f314..0000000 --- a/etc/azure/deploy-to-k8s.yml +++ /dev/null @@ -1,67 +0,0 @@ -variables: - version: $(Build.BuildId) - -trigger: - branches: - include: - - refs/heads/main - -pool: - vmImage: "ubuntu-latest" - -steps: - - task: UseDotNet@2 - displayName: "Use .NET sdk" - inputs: - packageType: sdk - version: 7.0.x - installationPath: $(Agent.ToolsDirectory)/dotnet - includePreviewVersions: true - - - task: PowerShell@2 - displayName: Build docker images - inputs: - filePath: "etc/k8s/scripts/build-images.ps1" - arguments: "-version $(version)" - - - task: Docker@2 - displayName: Login to ACR - inputs: - containerRegistry: "volocr" - command: "login" - - - task: PowerShell@2 - displayName: Push images to ACR - inputs: - filePath: "etc/azure/scripts/push-images.ps1" - arguments: "-version $(version)" - - - task: Kubernetes@1 - displayName: Delete migrator job - continueOnError: true - inputs: - connectionType: "Azure Resource Manager" - azureSubscriptionEndpoint: "volosoft (fe02ef9f-9e1c-4e40-b924-505981688dd8)" - azureResourceGroup: "volo" - kubernetesCluster: "volo" - namespace: "eventhub" - command: "delete" - arguments: "job eh-az-dbmigrator" - secretType: "dockerRegistry" - containerRegistryType: "Azure Container Registry" - - - task: HelmDeploy@0 - displayName: Helm deploy - inputs: - connectionType: "Azure Resource Manager" - azureSubscription: "volosoft(fe02ef9f-9e1c-4e40-b924-505981688dd8)" - azureResourceGroup: "volo" - kubernetesCluster: "volo" - useClusterAdmin: true - namespace: "eventhub" - command: "upgrade" - chartType: "Name" - chartName: "etc/k8s/helm-chart/eventhub" - releaseName: "eh-az" - valueFile: "etc/k8s/helm-chart/eventhub/values.azure.yaml" - arguments: "--timeout 20m --namespace eventhub --create-namespace --set global.eventHubImageVersion=$(version)"