This repository was archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython_publish_service.yml
More file actions
46 lines (40 loc) · 1.66 KB
/
python_publish_service.yml
File metadata and controls
46 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
steps:
# Set service name as build variable.
- script: $(python3 $(BUILD_SCRIPTS_DIR)/python_export_service_name.py)
displayName: Get Service Name
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
- script: docker -v
displayName: Printing docker version info
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
# Log in to docker.
- script: docker login $REGISTRY_URL -u $DOCKER_ID -p $DOCKER_PASSWORD
env:
DOCKER_ID: $(CONTAINER_REGISTRY_ID)
DOCKER_PASSWORD: $(CONTAINER_REGISTRY_PASSWORD)
REGISTRY_URL: $(CONTAINER_REGISTRY_URL)
displayName: "Logging into DockerHub"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
# Build docker image, tag as latest and version.
- script: |
docker build \
--no-cache \
--build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
--build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL \
-t $REGISTRY_URL/$SERVICE_NAME:$RELEASE_VERSION \
-t $REGISTRY_URL/$SERVICE_NAME:latest .
env:
RELEASE_VERSION: $(RELEASE_VERSION)
REGISTRY_URL: $(CONTAINER_REGISTRY_URL)
PIP_INDEX_URL: $(PIP_INDEX_URL)
PIP_EXTRA_INDEX_URL: $(PIP_EXTRA_INDEX_URL)
DOCKER_BUILDKIT: 1
displayName: 'Building Docker Image'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
# Push docker image.
- script: docker push $REGISTRY_URL/$SERVICE_NAME
displayName: 'Upload Image'
env:
REGISTRY_URL: $(CONTAINER_REGISTRY_URL)
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
# Merge build to master and tag as release version.
- template: git_update_master_version.yml