diff --git a/01-docker-build-and-push-to-acr-pipeline.yml b/03-custom1-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml similarity index 50% rename from 01-docker-build-and-push-to-acr-pipeline.yml rename to 03-custom1-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml index cbeb7fc..a01ab1a 100644 --- a/01-docker-build-and-push-to-acr-pipeline.yml +++ b/03-custom1-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml @@ -1,7 +1,3 @@ -# Docker -# Build and push an image to Azure Container Registry -# https://docs.microsoft.com/azure/devops/pipelines/languages/docker - trigger: - master @@ -10,23 +6,23 @@ resources: variables: # Container registry service connection established during pipeline creation - dockerRegistryServiceConnection: '4ee05316-45b2-4c65-9574-a13237e77eb4' - imageRepository: 'app1/app1nginx' - containerRegistry: 'aksdevopsacr.azurecr.io' + dockerRegistryServiceConnection: 'd6ae712d-d9d8-4b2e-ac07-5015f00d75d2' + imageRepository: 'scutom1' + containerRegistry: 'cgaksdevopsacr.azurecr.io' dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' tag: '$(Build.BuildId)' - + # Agent VM image name - vmImageName: 'ubuntu-latest' + vmImageName: 'Linuxtesting' stages: - stage: Build displayName: Build and push stage - jobs: + jobs: - job: Build displayName: Build pool: - vmImage: $(vmImageName) + name: $(vmImageName) steps: - task: Docker@2 displayName: Build and push an image to container registry @@ -37,3 +33,17 @@ stages: containerRegistry: $(dockerRegistryServiceConnection) tags: | $(tag) + +#publuc artificat + - task: CopyFiles@2 + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/kube-manifests' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + OverWrite: true + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'kube-manifests' + publishLocation: 'Container' + \ No newline at end of file diff --git a/04-custom2-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml b/04-custom2-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml new file mode 100644 index 0000000..0ff2f97 --- /dev/null +++ b/04-custom2-BuildPushToACR-Publish-k8s-manifests-to-AzurePipelines.yml @@ -0,0 +1,40 @@ +trigger: +- master + +variables: + tag: '$(Build.BuildId)' + +stages: +- stage: Build + displayName: Build-Stage + jobs: + - job: Build + displayName: Build job + pool: + name: Linuxtesting + steps: + - task: Docker@2 + inputs: + containerRegistry: 'acr-shrikant' + repository: 'myappshrikantrepo' + command: 'buildAndPush' + Dockerfile: '**/Dockerfile' + tags: | + $(tag) + $(Build.SourceVersion) + + - task: CopyFiles@2 + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/kube-manifests' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + OverWrite: true + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'kube-manifests' + publishLocation: 'Container' + + + + diff --git a/azure-devops-github-acr-aks-app1 b/azure-devops-github-acr-aks-app1 new file mode 160000 index 0000000..2a72290 --- /dev/null +++ b/azure-devops-github-acr-aks-app1 @@ -0,0 +1 @@ +Subproject commit 2a722908a4d2c25912364da6341f79453a85c9bc diff --git a/04-custom2-pipeline-build-from-scratch.yml b/azure-pipelines-5testing.yml similarity index 95% rename from 04-custom2-pipeline-build-from-scratch.yml rename to azure-pipelines-5testing.yml index 58d3bcb..49294ee 100644 --- a/04-custom2-pipeline-build-from-scratch.yml +++ b/azure-pipelines-5testing.yml @@ -20,12 +20,12 @@ stages: - job: Build displayName: Build Job pool: - vmImage: 'ubuntu-latest' + name: Linuxtesting steps: # Task-1: Build Docker Image and push to Azure Container Registry ACR - task: Docker@2 inputs: - containerRegistry: 'manual-aksdevopsacr-svc' + containerRegistry: 'acr-shrikant' repository: 'custom2aksnginxapp1' command: 'buildAndPush' Dockerfile: '**/Dockerfile' diff --git a/02-docker-build-push-to-acs-deploy-to-aks-pipeline.yml b/azure-pipelines.yml similarity index 72% rename from 02-docker-build-push-to-acs-deploy-to-aks-pipeline.yml rename to azure-pipelines.yml index d457d27..431b9c4 100644 --- a/02-docker-build-push-to-acs-deploy-to-aks-pipeline.yml +++ b/azure-pipelines.yml @@ -1,7 +1,3 @@ -# 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 @@ -11,25 +7,25 @@ resources: variables: # Container registry service connection established during pipeline creation - dockerRegistryServiceConnection: '569fbdc4-eae7-48e7-a717-a723d2ae03ce' - imageRepository: 'app1nginxaks' - containerRegistry: 'aksdevopsacr.azurecr.io' + dockerRegistryServiceConnection: '2ae50189-233f-4cbb-ba92-0b18a0a77842' + imageRepository: 'shyamazuredevopsgithubacraksapp' + containerRegistry: 'cgaksdevopsacr.azurecr.io' dockerfilePath: '**/Dockerfile' tag: '$(Build.BuildId)' - imagePullSecret: 'aksdevopsacr21364011-auth' + imagePullSecret: 'cgaksdevopsacr11054010-auth' # Agent VM image name - vmImageName: 'ubuntu-latest' - + vmImageName: 'Linuxtesting' + stages: - stage: Build displayName: Build stage - jobs: + jobs: - job: Build displayName: Build pool: - vmImage: $(vmImageName) + name: Linuxtesting steps: - task: Docker@2 displayName: Build and push an image to container registry @@ -40,7 +36,7 @@ stages: containerRegistry: $(dockerRegistryServiceConnection) tags: | $(tag) - + - upload: manifests artifact: manifests @@ -52,8 +48,8 @@ stages: - deployment: Deploy displayName: Deploy pool: - vmImage: $(vmImageName) - environment: 'stacksimplifyazuredevopsgithubacraksapp1.default' + name: Linuxtesting + environment: 'shyam1986azuredevopsgithubacraksapp1-1113.aksnamspace' strategy: runOnce: deploy: @@ -64,7 +60,7 @@ stages: action: createSecret secretName: $(imagePullSecret) dockerRegistryEndpoint: $(dockerRegistryServiceConnection) - + - task: KubernetesManifest@0 displayName: Deploy to Kubernetes cluster inputs: diff --git a/03-custom1-pipeline-buildandpush-to-acr-and-publish-artifacts.yml b/azure-pipelines0001-1.yml similarity index 60% rename from 03-custom1-pipeline-buildandpush-to-acr-and-publish-artifacts.yml rename to azure-pipelines0001-1.yml index b23ce93..49294ee 100644 --- a/03-custom1-pipeline-buildandpush-to-acr-and-publish-artifacts.yml +++ b/azure-pipelines0001-1.yml @@ -1,42 +1,37 @@ -# Docker -# Build and push an image to Azure Container Registry -# https://docs.microsoft.com/azure/devops/pipelines/languages/docker +# Stages +# Stage-1: + # Task-1: Build Docker Image and push to Azure Container Registry ACR + # Task-2: Copy kube-manifest files to Build Artifact Directory + # Task-3: Publish build articats to Azure Pipelines +# Pipeline Hierarchial Flow: Stages -> Stage -> Jobs -> Job -> Steps -> Task1, Task2, Task3 trigger: - master -resources: -- repo: self - +# Variables variables: - # Container registry service connection established during pipeline creation - dockerRegistryServiceConnection: 'cf9f2bef-6696-4dea-9fa3-580d9b5cab9d' - imageRepository: 'custom1aksnginxapp1' - containerRegistry: 'aksdevopsacr.azurecr.io' - dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' tag: '$(Build.BuildId)' - - # Agent VM image name - vmImageName: 'ubuntu-latest' stages: +# Build Stage - stage: Build - displayName: Build and push stage - jobs: + displayName: Build Stage + jobs: - job: Build - displayName: Build - pool: - vmImage: $(vmImageName) - steps: + displayName: Build Job + pool: + name: Linuxtesting + steps: + # Task-1: Build Docker Image and push to Azure Container Registry ACR - task: Docker@2 - displayName: Build and push an image to container registry inputs: - command: buildAndPush - repository: $(imageRepository) - dockerfile: $(dockerfilePath) - containerRegistry: $(dockerRegistryServiceConnection) + containerRegistry: 'acr-shrikant' + repository: 'custom2aksnginxapp1' + command: 'buildAndPush' + Dockerfile: '**/Dockerfile' tags: | $(tag) + $(Build.SourceVersion) ## Publish Artifacts pipeline code in addition to Build and Push - bash: echo Contents in System Default Working Directory; ls -R $(System.DefaultWorkingDirectory) - bash: echo Before copying Contents in Build Artifact Directory; ls -R $(Build.ArtifactStagingDirectory) diff --git a/index.html b/index.html index 15d2edf..d6a6175 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,9 @@ - -

Welcome to Stack Simplify - Azure DevOps App1 - V13

+ +

Welcome to CG - Azure DevOps App1 - V14

Azure DevOps Demo App1

-

Application Version: V13

+

Application Version-final-test1: V14

+- \ No newline at end of file diff --git a/kube-manifests/01-Deployment-and-LoadBalancer-Service.yml b/kube-manifests/01-Deployment-and-LoadBalancer-Service.yml index 5f7add3..cb51569 100644 --- a/kube-manifests/01-Deployment-and-LoadBalancer-Service.yml +++ b/kube-manifests/01-Deployment-and-LoadBalancer-Service.yml @@ -16,7 +16,7 @@ spec: spec: containers: - name: app1-nginx - image: aksdevopsacr.azurecr.io/custom2aksnginxapp1 + image: cgaksdevopsacr.azurecr.io/custom2aksnginxapp1 ports: - containerPort: 80 --- diff --git a/manifests/deployment.yml b/manifests/deployment.yml index 649747f..15f9f13 100644 --- a/manifests/deployment.yml +++ b/manifests/deployment.yml @@ -1,19 +1,19 @@ apiVersion : apps/v1 kind: Deployment metadata: - name: app1nginxaks + name: shyamazuredevopsgithubacraksapp spec: replicas: 1 selector: matchLabels: - app: app1nginxaks + app: shyamazuredevopsgithubacraksapp template: metadata: labels: - app: app1nginxaks + app: shyamazuredevopsgithubacraksapp spec: containers: - - name: app1nginxaks - image: aksdevopsacr.azurecr.io/app1nginxaks + - name: shyamazuredevopsgithubacraksapp + image: cgaksdevopsacr.azurecr.io/shyamazuredevopsgithubacraksapp ports: - containerPort: 80 \ No newline at end of file diff --git a/manifests/service.yml b/manifests/service.yml index 5814545..a70ab1e 100644 --- a/manifests/service.yml +++ b/manifests/service.yml @@ -1,10 +1,10 @@ apiVersion: v1 kind: Service metadata: - name: app1nginxaks + name: shyamazuredevopsgithubacraksapp spec: type: LoadBalancer ports: - port: 80 selector: - app: app1nginxaks \ No newline at end of file + app: shyamazuredevopsgithubacraksapp \ No newline at end of file