-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
89 lines (78 loc) · 3.69 KB
/
azure-pipelines.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
trigger:
branches:
include:
- '*'
paths:
include:
- '*'
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- master
always: true
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true
clean: true
- bash: |
echo "SourceBranchName = $(Build.SourceBranchName)"
echo "SourceBranch = $(Build.SourceBranch)"
branch_name_extracted=$(echo "${SourceBranch/refs\/head\// }")
displayName: Extract branch name
# - bash: |
# git clone https://github.com/samiyaakhtar/container-journey.git
# cd container-journey/pipeline-scripts
# sudo /usr/bin/easy_install virtualenv
# pip install virtualenv
# pip install --upgrade pip
# python -m virtualenv venv
# source venv/bin/activate
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# tag_name="hello-bedrock-$(Build.SourceBranchName)-$(Build.BuildId)"
# commitId=$(Build.SourceVersion)
# commitId=$(echo "${commitId:0:7}")
# echo "python update_pipeline.py $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) p1 $(Build.BuildId) imageTag $tag_name commitId $commitId"
# python update_pipeline.py $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) p1 $(Build.BuildId) imageTag $tag_name commitId $commitId
# displayName: Update source pipeline details in CJ db
# - bash: |
# tag_name="hello-bedrock-$(Build.SourceBranchName)-$(Build.BuildId)"
# commitId=$(Build.SourceVersion)
# commitId=$(echo "${commitId:0:7}")
# service=$(Build.Repository.Name)
# service=${service##*/}
# all_data="{\"account_key\": \"$(ACCOUNT_KEY)\", \"account_name\": \"$(ACCOUNT_NAME)\", \"table_name\": \"$(TABLE_NAME)\", \"partition_key\": \"$(PARTITION_KEY)\", \"filter_name\": \"p1\", \"filter_value\": \"$(Build.BuildId)\", \"name1\": \"imageTag\", \"value1\": \"$tag_name\", \"name2\": \"commitId\", \"value2\": \"$commitId\", \"name3\": \"service\", \"value3\": \"$service\" }"
# echo $all_data
# echo "curl https://spektateprototypefunc.azurewebsites.net/api/UpdatePipelineStorage --request POST --header \"Content-type: application/json\" --data $all_data"
# curl https://spektateprototypefunc.azurewebsites.net/api/UpdatePipelineStorage --request POST --header "Content-type: application/json" --data "$all_data"
# displayName: Update source pipeline details in Spektate
- bash: |
tag_name="hello-bedrock-$(Build.SourceBranchName)-$(Build.BuildId)"
commitId=$(Build.SourceVersion)
commitId=$(echo "${commitId:0:7}")
service=$(Build.Repository.Name)
service=${service##*/}
url=$(git remote --verbose | grep origin | grep fetch | cut -f2 | cut -d' ' -f1)
repourl=${url##*@}
# VERSION_TO_DOWNLOAD=$(curl -s "https://api.github.com/repos/CatalystCode/spk/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/')
# echo "Downloading SPK version $VERSION_TO_DOWNLOAD" && wget "https://github.com/CatalystCode/spk/releases/download/$VERSION_TO_DOWNLOAD/spk-linux"
git clone https://github.com/CatalystCode/spk.git
cd spk
yarn
yarn build
cd dist
chmod +x ./spk-linux
./spk-linux deployment create -n $(ACCOUNT_NAME) -k $(ACCOUNT_KEY) -t $(TABLE_NAME) -p $(PARTITION_KEY) --p1 $(Build.BuildId) --image-tag $tag_name --commit-id $commitId --service $service --repository $repourl
displayName: Update source pipeline details in CJ db
- task: Docker@2
inputs:
containerRegistry: 'hellorings_acr'
repository: 'hellobedrock'
command: 'buildAndPush'
Dockerfile: '**/src/Dockerfile'
tags: 'hello-bedrock-$(Build.SourceBranchName)-$(Build.BuildId)'
condition: ne(variables['Build.Reason'], 'PullRequest')