@@ -92,6 +92,26 @@ To configure the variable group run:
9292spk variable-group create
9393```
9494
95+ You will need the following variables:
96+
97+ - ` ACCOUNT_KEY ` : Set this to the access key for your storage account
98+ - ` ACCOUNT_NAME ` : Set this to the name of your storage account
99+ - ` PARTITION_KEY ` : This field can be a distinguishing key that recognizea your
100+ source repository in the storage, for eg. in this example, we're using the
101+ name of the source repository ` hello-bedrock `
102+ - ` TABLE_NAME ` : Set this to the name of the table in your storage account that
103+ you prefer to use
104+
105+ ![ ] ( ./images/variable_group.png )
106+
107+ Make sure that you update the pipelines in the following steps to include this
108+ variable group, such as below:
109+
110+ ``` yaml
111+ variables :
112+ - group : <your-variable-group-name>
113+ ` ` `
114+
95115#### 2. CI pipeline configuration
96116
97117The CI pipeline runs from the source repository to build a docker image.
@@ -100,15 +120,15 @@ Paste the following task in its corresponding `azure-pipelines.yml`:
100120
101121` ` ` yaml
102122- bash: |
103- curl $SCRIPT > script.sh
104- chmod +x ./script.sh
105123 tag_name="hello-spektate-$(Build.SourceBranchName)-$(Build.BuildId)"
106124 commitId=$(Build.SourceVersion)
107125 commitId=$(echo "${commitId:0:7}")
108- ./script.sh $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) p1 $(Build.BuildId) imageTag $tag_name commitId $commitId service $(Build.Repository.Name)
109- displayName : Update manifest pipeline details in CJ db
110- env :
111- SCRIPT : https://raw.githubusercontent.com/catalystcode/spk/master/scripts/update_introspection.sh
126+ VERSION_TO_DOWNLOAD=$(curl -s "https://api.github.com/repos/CatalystCode/spk/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1 /')
127+ echo "Downloading SPK version $VERSION_TO_DOWNLOAD" && wget "https://github.com/CatalystCode/spk/releases/download/$VERSION_TO_DOWNLOAD/spk-linux"
128+ chmod +x ./spk-linux
129+ ./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
130+
131+ displayName: Update manifest pipeline details in Spektate db
112132` ` `
113133
114134This task will update the service introspection storage table for every build
@@ -127,58 +147,47 @@ by service introspection.
127147
128148The CD release pipeline updates the docker image number in the HLD.
129149
130- Paste the following task in its corresponding `azure-pipelines.yml` :
150+ Paste the following task towards the end of your release step in the release
151+ pipeline :
131152
132153` ` ` yaml
133- latest_commit=$(git rev-parse --short HEAD)
134- echo "latest_commit=$latest_commit"
135-
136- # Download update storage script
137- curl https://raw.githubusercontent.com/catalystcode/spk/master/scripts/update_introspection.sh > script.sh
138- chmod +x script.sh
139-
140- ./script.sh $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) imageTag $(Build.BuildId) p2 $(Release.ReleaseId) hldCommitId $latest_commit env $(Release.EnvironmentName)
154+ latest_commit=$(git rev-parse --short HEAD) echo "latest_commit=$latest_commit"
155+
156+ VERSION_TO_DOWNLOAD=$(curl -s
157+ "https://api.github.com/repos/CatalystCode/spk/releases/latest" | grep
158+ "tag_name" | sed -E 's/.*"([^"]+)".*/\1 /') echo "Downloading SPK version
159+ $VERSION_TO_DOWNLOAD" && wget
160+ "https://github.com/CatalystCode/spk/releases/download/$VERSION_TO_DOWNLOAD/spk-linux"
161+ chmod +x ./spk-linux ./spk-linux deployment create -n $(ACCOUNT_NAME) -k
162+ $(ACCOUNT_KEY) -t $(TABLE_NAME) -p $(PARTITION_KEY) --p2 $(Release.ReleaseId)
163+ --hld-commit-id $latest_commit --env $(Release.EnvironmentName) --image-tag
164+ $(Build.BuildId)
141165` ` `
142166
143- This task is the same as the one from step 1 but instead passes the information
167+ This task is similar to the one from step 1 but instead passes the information
144168that corresponds to the CD release pipeline.
145169
146170# ### 4. HLD manifest pipeline configuration
147171
148172The HLD manifest pipeline builds the HLD using `fabrikate` and generates
149173resource manifests that are then placed in the resource manifest repository.
150174
151- Paste the following task in the `azure-pipelines.yml` file **before ** the
175+ Paste the following task in the `azure-pipelines.yml` file **after ** the
152176`fabrikate` steps :
153177
154178` ` ` yaml
155179- bash: |
156- curl $SCRIPT > script.sh
157- chmod +x ./script.sh
180+ cd "$HOME"/<name of your manifest repository>
158181 commitId=$(Build.SourceVersion)
159182 commitId=$(echo "${commitId:0:7}")
160- ./script.sh $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) hldCommitId $commitId p3 $(Build.BuildId)
161- displayName: Update manifest pipeline details in CJ db
162- env:
163- SCRIPT: https://raw.githubusercontent.com/catalystcode/spk/master/scripts/update_introspection.sh
164- ` ` `
165-
166- Paste the following task after the `fabrikate` step :
167-
168- ` ` ` yaml
169- - script: |
170- cd "$HOME"/hello-bedrock-manifest
171- curl $SCRIPT > script.sh
172- chmod +x ./script.sh
173183 latest_commit=$(git rev-parse --short HEAD)
174- ./script.sh $(ACCOUNT_NAME) $(ACCOUNT_KEY) $(TABLE_NAME) $(PARTITION_KEY) p3 $(Build.BuildId) manifestCommitId $latest_commit
175- displayName: Update commit id in database
176- env:
177- SCRIPT: https://raw.githubusercontent.com/catalystcode/spk/master/scripts/update_introspection.sh
184+ VERSION_TO_DOWNLOAD=$(curl -s "https://api.github.com/repos/CatalystCode/spk/releases/latest" | grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1 /')
185+ echo "Downloading SPK version $VERSION_TO_DOWNLOAD" && wget "https://github.com/CatalystCode/spk/releases/download/$VERSION_TO_DOWNLOAD/spk-linux"
186+ chmod +x ./spk-linux
187+ ./spk-linux deployment create -n $(ACCOUNT_NAME) -k $(ACCOUNT_KEY) -t $(TABLE_NAME) -p $(PARTITION_KEY) --p3 $(Build.BuildId) --hld-commit-id $commitId --manifest-commit-id $latest_commit
188+ displayName: Update manifest pipeline details in Spektate db
178189` ` `
179190
180- This task will update the `manifestCommitId`.
181-
182191# # Getting started
183192
184193After completing the steps in this guide, you should be able to :
0 commit comments