-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-push-image-template.yml
48 lines (42 loc) · 1.8 KB
/
build-and-push-image-template.yml
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
47
48
# dapr/dapr build and push image template
parameters:
targetArch: 'amd64'
releaseVersion: ''
dockerHubRegistry: 'docker.io/daprio'
steps:
- script: |
SOURCEBRANCH=$(Build.SourceBranch)
echo Source branch name : $SOURCEBRANCH
if [[ $SOURCEBRANCH != refs/tags/v* ]]; then
VERSION_TAG="edge"
else
VERSION_TAG=${{ parameters.releaseVersion }}
# Set LATEST_RELEASE to add latest tag if SOURCEBRANCH doesn't have -rc tag
if [[ $SOURCEBRANCH != *-rc.* ]]; then
echo "This is the latest release tag"
echo "##vso[task.setvariable variable=LATEST_RELEASE]true"
fi
fi
if [ "${{ parameters.targetArch }}" != "amd64" ]; then
VERSION_TAG=$VERSION_TAG-${{ parameters.targetArch }}
fi
echo "##vso[task.setvariable variable=DOCKER_VERSION_TAG]$VERSION_TAG"
echo Target Architecture: ${{ parameters.targetArch }}
echo Docker Version TAG: $VERSION_TAG
displayName: 'Docker image tag name setting'
- task: DownloadPipelineArtifact@2
displayName: 'Download pipeline artifacts to workspace'
inputs:
buildType: 'current'
itemPattern: '**/*_linux_${{ parameters.targetArch }}.*'
targetPath: '$(Pipeline.Workspace)/${{ parameters.targetArch }}'
- script: |
export RELEASE_DIR=./dist/linux_${{ parameters.targetArch }}/release/
mkdir -p $RELEASE_DIR
for tgzfile in $(Pipeline.Workspace)/${{ parameters.targetArch }}/drop/*.tar.gz; do
echo "Extracting $tgzfile to $RELEASE_DIR ..."
tar xzvf $tgzfile -C $RELEASE_DIR
done
echo "Build docker image and push image ..."
make docker-push DAPR_REGISTRY=${{ parameters.dockerHubRegistry }} DAPR_TAG=$(DOCKER_VERSION_TAG) GOARCH=${{ parameters.targetArch }}
displayName: 'Build and push docker image'