From 5e793ae3f46cdd9999b6f83420c355f365e2630b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 8 Nov 2018 04:25:32 -0500 Subject: [PATCH] Have 1 common azure-build-pipeline.yml file for the 4 apps (#14) * Add 1 common azure-pipelines.yml file * Add 1 common azure-pipelines.yml file * Add 1 common azure-pipelines.yml file * Add 1 common azure-pipelines.yml file * Add 1 common azure-pipelines.yml file * Add 1 common azure-pipelines.yml file * Update and rename azure-pipelines.yml to azure-build-pipeline.yml * Update README.md * azureServiceEndpoint * Simplify the `az acr helm push` part * Update azure-build-pipeline.yml --- README.md | 9 +--- ...-pipelines.yml => azure-build-pipeline.yml | 10 ++--- captainkube/azure-pipelines.yml | 41 ------------------- nodebrady/azure-pipelines.yml | 41 ------------------- phippy/azure-pipelines.yml | 41 ------------------- 5 files changed, 5 insertions(+), 137 deletions(-) rename parrot/azure-pipelines.yml => azure-build-pipeline.yml (73%) delete mode 100644 captainkube/azure-pipelines.yml delete mode 100644 nodebrady/azure-pipelines.yml delete mode 100644 phippy/azure-pipelines.yml diff --git a/README.md b/README.md index 3080a23..3b4455a 100644 --- a/README.md +++ b/README.md @@ -169,14 +169,9 @@ Watch as more brady ninjas come to life! ## Leverage Azure DevOps -You could also leverage [Azure DevOps](https://docs.microsoft.com/azure/devops) to implement a [CI/CD pipeline](https://docs.microsoft.com/azure/devops/pipelines) for each app. For that you could [create one Azure build pipeline](https://docs.microsoft.com/azure/devops/pipelines/get-started-yaml#get-your-first-build) per app by using its associated YAML definition: +You could also leverage [Azure DevOps](https://docs.microsoft.com/azure/devops) to implement a [CI/CD pipeline](https://docs.microsoft.com/azure/devops/pipelines) for each app. For that you could [create one Azure build pipeline](https://docs.microsoft.com/azure/devops/pipelines/get-started-yaml#get-your-first-build) per app by using the associated YAML definition: [azure-build-pipeline.yml](azure-build-pipeline.yml). -- [parrot/azure-pipelines.yml](parrot/azure-pipelines.yml) -- [captainkube/azure-pipelines.yml](captainkube/azure-pipelines.yml) -- [phippy/azure-pipelines.yml](phippy/azure-pipelines.yml) -- [nodebrady/azure-pipelines.yml](nodebrady/azure-pipelines.yml) - -*Coming soon: more to come, a blog article is coming explaining how to setup your Azure release pipeline. Stay tuned!* +*Coming soon: more to come, a blog article is coming explaining how to setup your Azure build and release pipelines. Stay tuned!* ## Issues? diff --git a/parrot/azure-pipelines.yml b/azure-build-pipeline.yml similarity index 73% rename from parrot/azure-pipelines.yml rename to azure-build-pipeline.yml index f5593d3..a362219 100644 --- a/parrot/azure-pipelines.yml +++ b/azure-build-pipeline.yml @@ -4,9 +4,8 @@ pool: variables: registryServerName: '$(registryName).azurecr.io' - projectName: 'parrot' imageName: '$(projectName)' - # define 4 more variables registryAzureSubscriptionServiceEndpoint, registryName, registryLogin and registryPassword in the build pipeline in UI + # define 4 more variables: projectName, registryName, registryLogin and registryPassword in the build pipeline in UI steps: @@ -33,9 +32,6 @@ steps: - bash: helm package --version $(build.buildId) --destination $(build.artifactStagingDirectory) $(system.defaultWorkingDirectory)/$(projectName)/charts/$(projectName) displayName: 'helm package' -- task: AzureCLI@1 +- bash: az acr helm push -n $(registryName) -u $(registryLogin) -p $(registryPassword) $(build.artifactStagingDirectory)/$(projectName)-$(build.buildId).tgz displayName: 'az acr helm push' - inputs: - azureSubscription: '$(registryAzureSubscriptionServiceEndpoint)' - scriptLocation: inlineScript - inlineScript: 'az acr helm push -n $(registryName) $(build.artifactStagingDirectory)/$(projectName)-$(build.buildId).tgz' \ No newline at end of file + condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master')) diff --git a/captainkube/azure-pipelines.yml b/captainkube/azure-pipelines.yml deleted file mode 100644 index fb77f3c..0000000 --- a/captainkube/azure-pipelines.yml +++ /dev/null @@ -1,41 +0,0 @@ -pool: - vmImage: 'Ubuntu 16.04' - - -variables: - registryServerName: '$(registryName).azurecr.io' - projectName: 'captainkube' - imageName: '$(projectName)' - # define 4 more variables registryAzureSubscriptionServiceEndpoint, registryName, registryLogin and registryPassword in the build pipeline in UI - - -steps: -- bash: docker build -f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile -t $(registryServerName)/$(imageName):$(build.buildId) -t $(registryServerName)/$(imageName):latest $(system.defaultWorkingDirectory)/$(projectName) - displayName: 'docker build' - -- bash: docker login $(registryServerName) -u $(registryLogin) -p $(registryPassword) - displayName: 'docker login' - -- bash: | - docker push $(registryServerName)/$(imageName):$(build.buildId) - docker push $(registryServerName)/$(imageName):latest - displayName: 'docker push' - condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master')) - -- task: HelmInstaller@0 - displayName: 'Install Helm 2.11.0' - inputs: - helmVersion: 2.11.0 - -- bash: helm init --client-only --wait - displayName: 'helm init' - -- bash: helm package --version $(build.buildId) --destination $(build.artifactStagingDirectory) $(system.defaultWorkingDirectory)/$(projectName)/charts/$(projectName) - displayName: 'helm package' - -- task: AzureCLI@1 - displayName: 'az acr helm push' - inputs: - azureSubscription: '$(registryAzureSubscriptionServiceEndpoint)' - scriptLocation: inlineScript - inlineScript: 'az acr helm push -n $(registryName) $(build.artifactStagingDirectory)/$(projectName)-$(build.buildId).tgz' \ No newline at end of file diff --git a/nodebrady/azure-pipelines.yml b/nodebrady/azure-pipelines.yml deleted file mode 100644 index 6dc6bf4..0000000 --- a/nodebrady/azure-pipelines.yml +++ /dev/null @@ -1,41 +0,0 @@ -pool: - vmImage: 'Ubuntu 16.04' - - -variables: - registryServerName: '$(registryName).azurecr.io' - projectName: 'nodebrady' - imageName: '$(projectName)' - # define 4 more variables registryAzureSubscriptionServiceEndpoint, registryName, registryLogin and registryPassword in the build pipeline in UI - - -steps: -- bash: docker build -f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile -t $(registryServerName)/$(imageName):$(build.buildId) -t $(registryServerName)/$(imageName):latest $(system.defaultWorkingDirectory)/$(projectName) - displayName: 'docker build' - -- bash: docker login $(registryServerName) -u $(registryLogin) -p $(registryPassword) - displayName: 'docker login' - -- bash: | - docker push $(registryServerName)/$(imageName):$(build.buildId) - docker push $(registryServerName)/$(imageName):latest - displayName: 'docker push' - condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master')) - -- task: HelmInstaller@0 - displayName: 'Install Helm 2.11.0' - inputs: - helmVersion: 2.11.0 - -- bash: helm init --client-only --wait - displayName: 'helm init' - -- bash: helm package --version $(build.buildId) --destination $(build.artifactStagingDirectory) $(system.defaultWorkingDirectory)/$(projectName)/charts/$(projectName) - displayName: 'helm package' - -- task: AzureCLI@1 - displayName: 'az acr helm push' - inputs: - azureSubscription: '$(registryAzureSubscriptionServiceEndpoint)' - scriptLocation: inlineScript - inlineScript: 'az acr helm push -n $(registryName) $(build.artifactStagingDirectory)/$(projectName)-$(build.buildId).tgz' \ No newline at end of file diff --git a/phippy/azure-pipelines.yml b/phippy/azure-pipelines.yml deleted file mode 100644 index 822133b..0000000 --- a/phippy/azure-pipelines.yml +++ /dev/null @@ -1,41 +0,0 @@ -pool: - vmImage: 'Ubuntu 16.04' - - -variables: - registryServerName: '$(registryName).azurecr.io' - projectName: 'phippy' - imageName: '$(projectName)' - # define 4 more variables registryAzureSubscriptionServiceEndpoint, registryName, registryLogin and registryPassword in the build pipeline in UI - - -steps: -- bash: docker build -f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile -t $(registryServerName)/$(imageName):$(build.buildId) -t $(registryServerName)/$(imageName):latest $(system.defaultWorkingDirectory)/$(projectName) - displayName: 'docker build' - -- bash: docker login $(registryServerName) -u $(registryLogin) -p $(registryPassword) - displayName: 'docker login' - -- bash: | - docker push $(registryServerName)/$(imageName):$(build.buildId) - docker push $(registryServerName)/$(imageName):latest - displayName: 'docker push' - condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master')) - -- task: HelmInstaller@0 - displayName: 'Install Helm 2.11.0' - inputs: - helmVersion: 2.11.0 - -- bash: helm init --client-only --wait - displayName: 'helm init' - -- bash: helm package --version $(build.buildId) --destination $(build.artifactStagingDirectory) $(system.defaultWorkingDirectory)/$(projectName)/charts/$(projectName) - displayName: 'helm package' - -- task: AzureCLI@1 - displayName: 'az acr helm push' - inputs: - azureSubscription: '$(registryAzureSubscriptionServiceEndpoint)' - scriptLocation: inlineScript - inlineScript: 'az acr helm push -n $(registryName) $(build.artifactStagingDirectory)/$(projectName)-$(build.buildId).tgz' \ No newline at end of file