From f7b189804d04390e1b3aa636da3f9765491aecfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Roa?= Date: Fri, 8 Feb 2019 16:16:35 +0100 Subject: [PATCH 1/4] Set up CI with Azure Pipelines --- azure-pipelines.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..4dd910be7 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,17 @@ +# Docker image +# Build a Docker image to deploy, run, or push to a container registry. +# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- master + +pool: + vmImage: 'Ubuntu-16.04' + +variables: + imageName: 'docker.tagshelf.io/tagshelfsrl/duckling:$(build.buildId)' + +steps: +- script: docker build -f Dockerfile -t $(imageName) . + displayName: 'docker build' From 63a98e7d22544fb1c4d3c6ca48d974ceafd7a7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Roa?= Date: Fri, 8 Feb 2019 18:50:00 +0100 Subject: [PATCH 2/4] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4dd910be7..dad90f967 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,13 +5,31 @@ trigger: - master +- development + +pr: +- master +- develop pool: vmImage: 'Ubuntu-16.04' variables: - imageName: 'docker.tagshelf.io/tagshelfsrl/duckling:$(build.buildId)' + tagshelfRegistry: 'docker.tagshelf.io' + imageName: 'tagshelfsrl/duckling' -steps: -- script: docker build -f Dockerfile -t $(imageName) . - displayName: 'docker build' +jobs: + - job: build + steps: + - script: docker build -f Dockerfile -t $(imageName) . + displayName: 'docker build' + - job: tagImage + steps: + - ${{ if eq(build.SourceBranchName, 'master') }}: + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):latest" + displayName: 'docker tag master as latest' + - ${{ if eq(build.SourceBranchName, 'development') }}: + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)" + displayName: 'docker tag development' + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)" + displayName: 'docker tag ' \ No newline at end of file From 474c8b911958ee3123f81a66207b208a2de51b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Roa?= Date: Fri, 8 Feb 2019 19:38:59 +0100 Subject: [PATCH 3/4] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dad90f967..c8f00e5ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,18 +18,14 @@ variables: tagshelfRegistry: 'docker.tagshelf.io' imageName: 'tagshelfsrl/duckling' -jobs: - - job: build - steps: - - script: docker build -f Dockerfile -t $(imageName) . - displayName: 'docker build' - - job: tagImage - steps: - - ${{ if eq(build.SourceBranchName, 'master') }}: - - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):latest" - displayName: 'docker tag master as latest' - - ${{ if eq(build.SourceBranchName, 'development') }}: - - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)" - displayName: 'docker tag development' - - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)" - displayName: 'docker tag ' \ No newline at end of file +steps: + - script: docker build -f Dockerfile -t $(imageName) . + displayName: 'docker build' + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):latest" + displayName: 'docker tag master as latest' + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)" + displayName: 'docker tag development' + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development')) + - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)" + displayName: 'docker tag branch_version' \ No newline at end of file From d3b19da3fec985779da688d9bdb2b43838a89f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Roa?= Date: Fri, 8 Feb 2019 21:50:34 +0100 Subject: [PATCH 4/4] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c8f00e5ef..f79cf5542 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,9 @@ trigger: - master - development +- feature/* +- bugfix/* +- hotfix/* pr: - master @@ -19,13 +22,33 @@ variables: imageName: 'tagshelfsrl/duckling' steps: + # Builds the docker image for all allowed branches - script: docker build -f Dockerfile -t $(imageName) . displayName: 'docker build' + # Tags builded image with the "latest" tag if its "master" branch and push - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):latest" displayName: 'docker tag master as latest' condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) + - script: | + docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry) + docker push $(tagshelfRegistry)/$(imageName):latest + displayName: 'docker push master as latest' + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) + # Tags builded image with the "development" tag if its "development" branch and push - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)" displayName: 'docker tag development' condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development')) + - script: | + docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry) + docker push $(tagshelfRegistry)/$(imageName):$(build.SourceBranchName) + displayName: 'docker push development' + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development')) + # Tags builded image with the branchName_commitHash tag if its "master" or "development" branch and push - script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)" - displayName: 'docker tag branch_version' \ No newline at end of file + displayName: 'docker tag branch_version' + condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'development'))) + - script: | + docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry) + docker push (tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion) + displayName: 'docker push buikd' + condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'development'))) \ No newline at end of file