Skip to content

Commit

Permalink
image-redactor release pipeline (microsoft#565)
Browse files Browse the repository at this point in the history
* add image-redactor to pypi release pipeline
  • Loading branch information
navalev authored Mar 1, 2021
1 parent 6baee6e commit 92abc1c
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

# Version change should be approved by a member of 'presidio-administrators' team
VERSION @microsoft/presidio-administrators
VERSION-IMAGE-REDACTOR @microsoft/presidio-administrators

7 changes: 5 additions & 2 deletions .pipelines/templates/build-and-push-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ parameters:
- name: IMAGE_PREFIX
type: string
default: ''
- name: DOCKER_COMPOSE_FILE
type: string
default: 'docker-compose.yml'
steps:
- task: DockerCompose@0
displayName: Build Presidio Images
inputs:
action: Build services
dockerComposeFile: docker-compose.yml
dockerComposeFile: ${{ parameters.DOCKER_COMPOSE_FILE }}
dockerComposeFileArgs: |
REGISTRY_NAME=${{ parameters.REGISTRY_NAME }}
IMAGE_PREFIX=${{ parameters.IMAGE_PREFIX }}
Expand All @@ -24,7 +27,7 @@ steps:
displayName: Push Presidio Images to ACR
inputs:
action: Push services
dockerComposeFile: docker-compose.yml
dockerComposeFile: ${{ parameters.DOCKER_COMPOSE_FILE }}
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: ${{ parameters.AZURE_SUBSCRIPTION }}
azureContainerRegistry: ${{ parameters.REGISTRY_NAME }}
Expand Down
41 changes: 41 additions & 0 deletions .pipelines/templates/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ stages:
displayName: Set Version
name: setVer
- job: imageVersion
displayName: 'Get image-redactor version number'
steps:
- bash: |
set -eux # exit on error
imageVer=$(cat VERSION-IMAGE-REDACTOR)
echo $imageVer
echo "##vso[task.setvariable variable=imageVersion;isOutput=true]$imageVer"
displayName: Set Image Version
name: setImageVer
- job: githubRelease
displayName: GitHub Release
dependsOn: version
Expand All @@ -41,6 +52,8 @@ stages:
WORKING_FOLDER: 'presidio-analyzer'
Anonymizer:
WORKING_FOLDER: 'presidio-anonymizer'
Image-Redactor:
WORKING_FOLDER: 'presidio-image-redactor'
steps:
- template: ./publish-to-pypi.yml
parameters:
Expand All @@ -62,12 +75,40 @@ stages:
IMAGE_PREFIX: $(IMAGE_PREFIX)
TAG: ":$(version)"
AZURE_SUBSCRIPTION: $(ACR_AZURE_SUBSCRIPTION)
DOCKER_COMPOSE_FILE: '../docker-compose-text.yml'
- template: ./build-and-push-containers.yml
parameters:
REGISTRY_NAME: $(REGISTRY_NAME)
IMAGE_PREFIX: $(IMAGE_PREFIX)
TAG: ":latest"
AZURE_SUBSCRIPTION: $(ACR_AZURE_SUBSCRIPTION)
DOCKER_COMPOSE_FILE: '../docker-compose-text.yml'

- job: BuildAndPushImageRedactorContainer
displayName: Build and Push Image Redactor Container
dependsOn: imageVersion
pool:
vmImage: 'ubuntu-16.04'
variables:
version: $[ dependencies.Version.outputs['setImageVer.imageVersion'] ]
REGISTRY_NAME: '$(ACR_REGISTRY_NAME).azurecr.io/'
IMAGE_PREFIX: 'public/'
steps:
- template: ./build-and-push-containers.yml
parameters:
REGISTRY_NAME: $(REGISTRY_NAME)
IMAGE_PREFIX: $(IMAGE_PREFIX)
TAG: ':$(version)'
AZURE_SUBSCRIPTION: $(ACR_AZURE_SUBSCRIPTION)
DOCKER_COMPOSE_FILE: '../docker-compose-image.yml'
- template: ./build-and-push-containers.yml
parameters:
REGISTRY_NAME: $(REGISTRY_NAME)
IMAGE_PREFIX: $(IMAGE_PREFIX)
TAG: ':latest'
AZURE_SUBSCRIPTION: $(ACR_AZURE_SUBSCRIPTION)
DOCKER_COMPOSE_FILE: '../docker-compose-image.yml'

- stage: DeployProd
dependsOn: Release
variables:
Expand Down
1 change: 1 addition & 0 deletions VERSION-IMAGE-REDACTOR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
12 changes: 12 additions & 0 deletions docker-compose-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
presidio-image-redactor:
image: ${REGISTRY_NAME}${IMAGE_PREFIX}presidio-image-redactor${TAG}
build:
context: ./presidio-image-redactor
args:
- NAME=presidio-image-redactor
environment:
- PORT=5001
ports:
- "5003:5001"
22 changes: 22 additions & 0 deletions docker-compose-text.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3'
services:
presidio-anonymizer:
image: ${REGISTRY_NAME}${IMAGE_PREFIX}presidio-anonymizer${TAG}
build:
context: ./presidio-anonymizer
args:
- NAME=presidio-anonymizer
environment:
- PORT=5001
ports:
- "5001:5001"
presidio-analyzer:
image: ${REGISTRY_NAME}${IMAGE_PREFIX}presidio-analyzer${TAG}
build:
context: ./presidio-analyzer
args:
- NAME=presidio-analyzer
environment:
- PORT=5001
ports:
- "5002:5001"
2 changes: 1 addition & 1 deletion presidio-image-redactor/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
with open(path.join(this_directory, "README.MD"), encoding="utf-8") as f:
long_description = f.read()

with open(os.path.join(parent_directory, "VERSION")) as version_file:
with open(os.path.join(parent_directory, "VERSION-IMAGE-REDACTOR")) as version_file:
__version__ = version_file.read().strip()

setup(
Expand Down

0 comments on commit 92abc1c

Please sign in to comment.