fiftyone.geolocation 4.2.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.gitmodules +3 -0
  2. package/README.md +2 -2
  3. package/ci/README.md +2 -0
  4. package/ci/build-and-test.yml +34 -0
  5. package/ci/common-ci/.github/labels.yml +59 -0
  6. package/ci/common-ci/.github/workflows/sync-labels.yml +49 -0
  7. package/ci/common-ci/CiTips.md +34 -0
  8. package/ci/common-ci/GitVersion.yml +18 -0
  9. package/ci/common-ci/LICENSE +286 -0
  10. package/ci/common-ci/README.md +365 -0
  11. package/ci/common-ci/build-and-test.yml +65 -0
  12. package/ci/common-ci/check-merge-commit-format.yml +50 -0
  13. package/ci/common-ci/cloud-release-config.json +51 -0
  14. package/ci/common-ci/create-tag.yml +41 -0
  15. package/ci/common-ci/deploy.yml +25 -0
  16. package/ci/common-ci/dotnet/shared-code-signing-steps.yml +20 -0
  17. package/ci/common-ci/dotnet/shared-extract-and-publish-packages.yml +29 -0
  18. package/ci/common-ci/go/shared-go-list-stage.yml +64 -0
  19. package/ci/common-ci/java/readme.md +22 -0
  20. package/ci/common-ci/java/shared-code-signing-steps.yml +17 -0
  21. package/ci/common-ci/node/shared-extract-and-publish-packages.yml +26 -0
  22. package/ci/common-ci/php/readme.md +15 -0
  23. package/ci/common-ci/release-config-schema.json +52 -0
  24. package/ci/common-ci/release-config-template.json +310 -0
  25. package/ci/common-ci/release-config.json +128 -0
  26. package/ci/common-ci/release-process.drawio +165 -0
  27. package/ci/common-ci/release-process.png +0 -0
  28. package/ci/common-ci/scripts/azure/checkSlot.ps1 +28 -0
  29. package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.Tests.ps1 +1 -0
  30. package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.psm1 +16 -0
  31. package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.Tests.ps1 +3 -0
  32. package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.psm1 +200 -0
  33. package/ci/common-ci/scripts/modules/51DDeployModule/51DDeployModule.psm1 +66 -0
  34. package/ci/common-ci/scripts/modules/51DDownloadDataFileModule/51DDownloadDataFileModule.psm1 +58 -0
  35. package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.Tests.ps1 +25 -0
  36. package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.psm1 +22 -0
  37. package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.Tests.ps1 +1 -0
  38. package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.psm1 +41 -0
  39. package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.Tests.ps1 +5 -0
  40. package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.psm1 +698 -0
  41. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.Tests.ps1 +842 -0
  42. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.psm1 +926 -0
  43. package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.Tests.ps1 +1 -0
  44. package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.psm1 +87 -0
  45. package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.Tests.ps1 +194 -0
  46. package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.psm1 +653 -0
  47. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.Tests.ps1 +277 -0
  48. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.psm1 +554 -0
  49. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.Tests.ps1 +1141 -0
  50. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psd1 +0 -0
  51. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psm1 +1465 -0
  52. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.Tests.ps1 +318 -0
  53. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.psm1 +344 -0
  54. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.Tests.ps1 +1186 -0
  55. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.psm1 +900 -0
  56. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/SharedVariables.psm1 +139 -0
  57. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/c-test-env-config.json +268 -0
  58. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-deploy-test-env-config.json +700 -0
  59. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-test-env-config.json +533 -0
  60. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-deploy-test-env-config.json +290 -0
  61. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-test-env-config.json +260 -0
  62. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-deploy-test-env-config.json +511 -0
  63. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-test-env-config.json +388 -0
  64. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-deploy-test-env-config.json +419 -0
  65. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-test-env-config.json +329 -0
  66. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/php-test-env-config.json +540 -0
  67. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-deploy-test-env-config.json +411 -0
  68. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-test-env-config.json +321 -0
  69. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/test-env-config.json +457 -0
  70. package/ci/common-ci/scripts/modules/51DRestModule/51DRestModule.psm1 +38 -0
  71. package/ci/common-ci/scripts/modules/AzurePortalModules/51DApplicationInsightsModule/51DApplicationInsightsModule.psm1 +104 -0
  72. package/ci/common-ci/scripts/modules/AzurePortalModules/51DChecksModule/51DChecksModule.psm1 +68 -0
  73. package/ci/common-ci/scripts/modules/AzurePortalModules/51DCloudModule/51DCloudModule.psm1 +155 -0
  74. package/ci/common-ci/scripts/modules/AzurePortalModules/51DConnectAzureModule/51DConnectAzureModule.psm1 +45 -0
  75. package/ci/common-ci/scripts/modules/AzurePortalModules/51DSSLBindingsModule/51DSSLBIndingsModule.psm1 +100 -0
  76. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStagingSlotModule/51DStagingSlotModule.psm1 +50 -0
  77. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStorageAccountModule/51DStorageAccountModule.psm1 +248 -0
  78. package/ci/common-ci/scripts/modules/AzurePortalModules/51DTrafficManagerModule/51DTrafficManagerModule.psm1 +58 -0
  79. package/ci/common-ci/shared-auto-complete-pr-stage.yml +61 -0
  80. package/ci/common-ci/shared-create-tag-job.yml +23 -0
  81. package/ci/common-ci/shared-docker-build-steps.yml +34 -0
  82. package/ci/common-ci/shared-docker-push-steps.yml +32 -0
  83. package/ci/common-ci/shared-docker-test-http-steps.yml +69 -0
  84. package/ci/common-ci/shared-git-tag-job.yml +38 -0
  85. package/ci/common-ci/shared-git-version-job.yml +71 -0
  86. package/ci/common-ci/shared-publish-github-stage.yml +107 -0
  87. package/ci/common-ci/shared-submodule-trigger-stage.yml +110 -0
  88. package/ci/common-ci/shared-variables.yml +3 -0
  89. package/ci/common-ci/trigger-release-apis.yml +39 -0
  90. package/ci/create-packages.yml +109 -0
  91. package/ci/deploy-external.yml +55 -0
  92. package/ci/deploy-internal.yml +50 -0
  93. package/ci/shared-build-and-test-platforms.yml +26 -0
  94. package/ci/shared-build-and-test-stage.yml +128 -0
  95. package/ci/shared-variables.yml +7 -0
  96. package/ci/submodule-trigger.yml +12 -0
  97. package/docs/Doxyfile +3 -3
  98. package/docs/DoxygenLayout.xml +1 -1
  99. package/examples/examples.test.js +3 -3
  100. package/geoLocationPipelineBuilder.js +16 -13
  101. package/package.json +14 -6
  102. package/setup.js +1 -0
  103. package/tests/geoLocationCloud.test.js +192 -0
  104. package/tsconfig.json +21 -0
  105. package/types/geoLocationCloud.d.ts +7 -0
  106. package/types/geoLocationPipelineBuilder.d.ts +17 -0
  107. package/types/index.d.ts +2 -0
  108. package/build-and-test.yml +0 -112
  109. package/publish-packages.yml +0 -87
@@ -0,0 +1,554 @@
1
+ <#
2
+ ===================== Release =====================
3
+ .Description
4
+ This module contains functions that perform package
5
+ release actions.
6
+ For more information, please read description of
7
+ each function.
8
+ #>
9
+
10
+ Using module 51DGitModule
11
+ Using module 51DPackageModule
12
+
13
+ # Read-only script variables. These variables are accessed for script read-only information.
14
+ # No functions should make changes to these variables.
15
+ $script:releaseConfig = ""
16
+ $script:repositories = ""
17
+
18
+ # Shared script list of repositories that require action and repositories
19
+ # that have been processed. These are allowed to be updated by
20
+ # Get-*-Action functions.
21
+ $script:actionTable = @{} # key is repository name, value is true or false
22
+ $script:traveledTable = @{} # key is repository name, value is true or false
23
+
24
+ <#
25
+ .Description
26
+ Get whether a repository release version need action.
27
+ The function will update the list of traveled nodes
28
+ and the list of action required nodes.
29
+
30
+ .Parameter RepositoryName
31
+ Name of the repository
32
+
33
+ .Parameter Version
34
+ The target version
35
+
36
+ .Parameter TeamProjectName
37
+ Name ofthe repository team project
38
+ #>
39
+ function Get-LeafAction {
40
+ param (
41
+ [Parameter(Mandatory)]
42
+ [string]$RepositoryName,
43
+ [Parameter(Mandatory)]
44
+ [string]$Version,
45
+ [Parameter(Mandatory)]
46
+ [string]$TeamProjectName
47
+ )
48
+
49
+ # If a tag exist, don't do anything and return.
50
+ if(!$script:traveledTable[$RepositoryName]) {
51
+ if (!$(Test-TagExist `
52
+ -RepositoryName $RepositoryName `
53
+ -Version $Version `
54
+ -TeamProjectName $TeamProjectName)) {
55
+ Write-Host "# Repository '$RepositoryName' requires actions."
56
+ $script:actionTable[$RepositoryName] = $true
57
+ }
58
+ $script:traveledTable[$RepositoryName] = $true
59
+ }
60
+ }
61
+
62
+ <#
63
+ .Description
64
+ Get whether a repository release version need action.
65
+ Further information of the dependencies are acquired
66
+ from the script release configuration object.
67
+ The function will update the list of traveled nodes
68
+ and the list of action required nodes.
69
+
70
+ .Parameter RepositoryName
71
+ Name of the repository
72
+
73
+ .Parameter Version
74
+ The target version
75
+
76
+ .Parameter Dependencies
77
+ Dependencies of the repository
78
+
79
+ .Parameter TeamProjectName
80
+ Name ofthe repository team project
81
+ #>
82
+ function Get-NonLeafAction {
83
+ param (
84
+ [Parameter(Mandatory)]
85
+ [string]$RepositoryName,
86
+ [Parameter(Mandatory)]
87
+ [string]$Version,
88
+ [Parameter(Mandatory)]
89
+ [string[]]$Dependencies,
90
+ [Parameter(Mandatory)]
91
+ [string]$TeamProjectName
92
+ )
93
+
94
+ # If a tag exist, don't do anything and return.
95
+ if(!$script:traveledTable[$RepositoryName]) {
96
+ if(!$(Test-TagExist `
97
+ -RepositoryName $RepositoryName `
98
+ -Version $Version `
99
+ -TeamProjectName $TeamProjectName)) {
100
+ $script:traveledTable[$RepositoryName] = $true
101
+ foreach ($dependency in $Dependencies) {
102
+ # Check if action required for a dependency.
103
+ if (!$script:traveledTable[$dependency]) {
104
+ Get-Action `
105
+ -RepositoryName $dependency `
106
+ -TeamProjectName $TeamProjectName
107
+ }
108
+
109
+ # If action is required for a dependency,
110
+ # then no action for this node.
111
+ if ($script:actionTable[$dependency]) {
112
+ return
113
+ }
114
+ }
115
+ Write-Host "# Repository '$RepositoryName' requires actions"
116
+ $script:actionTable[$RepositoryName] = $true
117
+ }
118
+ }
119
+ }
120
+
121
+ <#
122
+ .Description
123
+ Get whether a repository need action. The function
124
+ will obtain the target version and other information
125
+ from the script release configuration object.
126
+ The function will update the list of traveled nodes
127
+ and the list of action required nodes.
128
+ The algorithm is straighforward, providing the script
129
+ is single threaded.
130
+ For a repository, if it is a leaf node, process to determine action.
131
+ If it is not a leaf node, check the dependencies to determine action.
132
+ Update the action required list and the traveled list in flight.
133
+
134
+ .Parameter RepositoryName
135
+ Name of the repository
136
+
137
+ .Parameter TeamProjectName
138
+ Name ofthe repository team project
139
+ #>
140
+ function Get-Action {
141
+ param (
142
+ [Parameter(Mandatory)]
143
+ [string]$RepositoryName,
144
+ [Parameter(Mandatory)]
145
+ [string]$TeamProjectName
146
+ )
147
+
148
+ $version = $script:releaseConfig.repositories."$RepositoryName".version
149
+ $isLeaf = $script:releaseConfig.repositories."$RepositoryName".isLeaf
150
+
151
+ if ($isLeaf) {
152
+ $needAction = Get-LeafAction `
153
+ -RepositoryName $RepositoryName `
154
+ -Version $version `
155
+ -TeamProjectName $TeamProjectName
156
+ } else {
157
+ $dependencies = $script:releaseConfig.repositories."$RepositoryName".dependencies
158
+ $needAction = Get-NonLeafAction `
159
+ -RepositoryName $RepositoryName `
160
+ -Version $version `
161
+ -Dependencies $dependencies `
162
+ -TeamProjectName $TeamProjectName
163
+ }
164
+ }
165
+
166
+ <#
167
+ .Description
168
+ Bump release version. This checkout the 'main' branch and
169
+ update the release GitVersion.
170
+
171
+ .Parameter RepositoryName
172
+ Name of a repository
173
+
174
+ .Parameter Version
175
+ Target release version.
176
+
177
+ .Parameter TeamProjectName
178
+ Name ofthe repository team project
179
+
180
+ .Outputs true or false
181
+ #>
182
+ function Update-Version {
183
+ param (
184
+ [Parameter(Mandatory)]
185
+ [string]$RepositoryName,
186
+ [Parameter(Mandatory)]
187
+ [string]$Version,
188
+ [Parameter(Mandatory)]
189
+ [string]$TeamProjectName
190
+ )
191
+
192
+ Write-Host "# Bump release version of repository $RepositoryName to $Version."
193
+
194
+ # Checkout the repository main branch and extract the branch name
195
+ $mainBranch = Get-MainBranchRef `
196
+ -RepositoryName $RepositoryName `
197
+ -TeamProjectName $TeamProjectName
198
+ if ($mainBranch -match "refs/heads/(?<name>(master|main))") {
199
+ $mainBranchName = $Matches['name']
200
+ } else {
201
+ Write-Host "# ERROR: Main branch name is not standard."
202
+ return $false
203
+ }
204
+
205
+ $remoteUrl = Get-RepositoryRemoteUrl `
206
+ -RepositoryName $RepositoryName `
207
+ -TeamProjectName $TeamProjectName
208
+ if ($remoteUrl -ne $null) {
209
+ if ([GitHandler]::Clone($remoteUrl)) {
210
+ Push-Location $RepositoryName
211
+
212
+ # Configuration email address and user name before any commit for this repository.
213
+ if (![GitHandler]::Config("ciuser@51degrees.com", "CIUser")) {
214
+ Write-Host "# ERROR: Failed to configure email and user name"
215
+ return $false
216
+ }
217
+
218
+ # Checkout the main branch
219
+ if ($(git rev-parse --abbrev-ref HEAD) -notmatch "(master|main)") {
220
+ if ([GitHandler]::Checkout($mainBranchName)) {
221
+ Write-Host "# Successfully checkout main branch '$mainBranchName'."
222
+ } elseif ([GitHandler]::CheckoutTrack('origin/$mainBranchName')) {
223
+ Write-Host "# Successfully checkout and track main branch '$mainBranchName'."
224
+ } else {
225
+ Write-Host "# ERROR: Failed to checkout main branch."
226
+ Pop-Location
227
+ return $false
228
+ }
229
+ } else {
230
+ Write-Host "# Currently on $mainBranchName."
231
+ }
232
+
233
+ [boolean]$rc = $false
234
+ if ($(Test-Path GitVersion.yml)) {
235
+ # Update the GitVersion number to the target release version.
236
+ Write-Host "# GitVersion.yml exists. Update the file with the next version $Version."
237
+ $versionFileContent = $(Get-Content GitVersion.yml -Raw)
238
+ if ($versionFileContent -match ".*next-version.*") {
239
+ $versionFileContent = $versionFileContent -replace "next-version.*(\r\n)?", "next-version: $Version`r`n"
240
+ } else {
241
+ $versionFileContent = "next-version: $Version`r`n" + $versionFileContent
242
+ }
243
+ $rc = [FileHandler]::SetContent("GitVersion.yml", $versionFileContent)
244
+ } else {
245
+ Write-Host "# GitVersion.yml does not exist. Create one."
246
+ $rc = [FileHandler]::SetContent("GitVersion.yml", "next-version: $Version")
247
+ }
248
+
249
+ if (!$rc) {
250
+ Write-Host "# ERROR: Failed to update the content of GitVersion.yml"
251
+ Pop-Location
252
+ return $false
253
+ }
254
+
255
+ # Stage the changes
256
+ Write-Host "# Stage GitVersion.yml"
257
+ if (![GitHandler]::Add("GitVersion.yml")) {
258
+ Write-Host "# ERROR: Failed to stage GitVersion.yml"
259
+ return $false
260
+ }
261
+
262
+ # Commit the changes
263
+ Write-Host "# Commit changes"
264
+ if (![GitHandler]::Commit("BUILD: Bump GitVersion next-version to $Version.")) {
265
+ Write-Host "# ERROR: Failed to commit change."
266
+ Pop-Location
267
+ return $false
268
+ }
269
+
270
+ # Push the changes
271
+ Write-Host "# Push changes"
272
+ if (![GitHandler]::Push($null)) {
273
+ Write-Host "# ERROR: Failed to push to remote."
274
+ Pop-Location
275
+ return $false
276
+ }
277
+
278
+ Pop-Location
279
+ } else {
280
+ Write-Host "# ERROR: Failed to clone repository $RepositoryName."
281
+ return $false
282
+ }
283
+ } else {
284
+ Write-Host "# ERROR: No remote url found for repository $RepositoryName."
285
+ return $false
286
+ }
287
+ Write-Host "# OK"
288
+ return $true
289
+ }
290
+
291
+ <#
292
+ .Description
293
+ Initialise the script variables
294
+
295
+ .Parameter Configuration
296
+ Configuration object obtained from a configration file
297
+ #>
298
+ function Initialize-GlobalVariables {
299
+ param (
300
+ [Parameter(Mandatory)]
301
+ [object]$Configuration
302
+ )
303
+
304
+ # Obtain the config file content. Initialise the script variables
305
+ $script:releaseConfig = $Configuration
306
+ $script:repositories = $script:releaseConfig.repositories | Get-Member -MemberType NoteProperty
307
+ $script:actionTable = @{} # key is repository name, value is true or false
308
+ $script:traveledTable = @{} # key is repository name, value is true or false
309
+ Write-Host "# Repositories found: $($script:repositories)"
310
+ }
311
+
312
+ <#
313
+ .Description
314
+ Get the action table. This is mainly for the purpose of testing.
315
+
316
+ .Outputs
317
+ script scoped action table
318
+ #>
319
+ function Get-ActionTable() {
320
+ return $script:actionTable
321
+ }
322
+
323
+ <#
324
+ .Description
325
+ Get the traveled table. This is mainly for the purpose of testing.
326
+
327
+ .Outputs
328
+ script scoped traveled table
329
+ #>
330
+ function Get-TraveledTable() {
331
+ return $script:traveledTable
332
+ }
333
+
334
+ <#
335
+ .Description
336
+ Main function. Trigger the release process.
337
+
338
+ .Parameter ConfigFile
339
+ Path to the configration file
340
+
341
+ .Parameter TeamProjectName
342
+ Name ofthe repository team project
343
+
344
+ .Outputs
345
+ True or False
346
+ #>
347
+ function Start-Release {
348
+ param (
349
+ [Parameter(Mandatory)]
350
+ [string]$ConfigFile,
351
+ [Parameter(Mandatory)]
352
+ [string]$TeamProjectName
353
+ )
354
+
355
+ # Reinitialise the script variables.
356
+ $configuration = Get-Content $ConfigFile | Out-String | ConvertFrom-Json
357
+ Initialize-GlobalVariables -Configuration $configuration
358
+
359
+ # Loop through all repositories and determine the ones that need further action.
360
+ Write-Host ""
361
+ Write-Host "Check repositories for required actions."
362
+ Write-Host "================================="
363
+ foreach ($repository in $script:repositories) {
364
+ Write-Host "# Check action for repository $($repository.Name)."
365
+ # Assign output to log no none will be captured for return value
366
+ $log = Get-Action `
367
+ -RepositoryName $repository.Name `
368
+ -TeamProjectName $TeamProjectName
369
+ }
370
+
371
+ # Perform actions on the repositories that require.
372
+ Write-Host ""
373
+ if ($script:actionTable.keys.count -gt 0) {
374
+ Write-Host "# List of repositories that require actions"
375
+ Write-Host $script:actionTable.keys
376
+ foreach ($repository in $script:actionTable.keys) {
377
+ Write-Host ""
378
+ Write-Host "Take action on repository: $repository."
379
+ Write-Host "================================="
380
+ $version = $script:releaseConfig.repositories."$repository".version
381
+ $releaseBranch = Get-ReleaseBranchRef `
382
+ -RepositoryName $repository `
383
+ -Version $version `
384
+ -TeamProjectName $TeamProjectName
385
+ if ($releaseBranch -ne $null) {
386
+ Write-Host "# Process pull request on branch $releaseBranch."
387
+ if (!$(Start-ProcessPullRequest `
388
+ -RepositoryName $repository `
389
+ -ReleaseBranch $releaseBranch `
390
+ -TeamProjectName $TeamProjectName)) {
391
+ Write-Host "# ERROR: Failed to process pull request."
392
+ return $false
393
+ }
394
+ } else {
395
+ Write-Host "# Bump the release version to $version."
396
+ if (!$(Update-Version -RepositoryName $repository -Version $version)) {
397
+ Write-Host "# ERROR: Failed to bump version."
398
+ return $false
399
+ }
400
+ }
401
+ }
402
+ } else {
403
+ Write-Host "# All target release versions have been tagged. No actions is required."
404
+ }
405
+ return $true
406
+ }
407
+
408
+ <#
409
+ .Description
410
+ This work on the current directory, performing updating of
411
+ submodule references, updating package dependencies, commit
412
+ the changes and create a pull request if needed.
413
+
414
+ .Parameter Configuration
415
+ A configuration object from a configuration file.
416
+
417
+ .Parameter DepTeamProjectName
418
+ Name of the repository team project to be used for
419
+ dependency updates.
420
+
421
+ .Parameter PrTeamProjectName
422
+ Name of the repository team project to be used for
423
+ creating pull request to main.
424
+
425
+ .Outputs
426
+ true or false
427
+ #>
428
+ function Update-CommitPushPullSub {
429
+ param(
430
+ [Parameter(Mandatory)]
431
+ [object]$Configuration,
432
+ [Parameter(Mandatory)]
433
+ [string]$DepTeamProjectName,
434
+ [Parameter(Mandatory)]
435
+ [string]$PrTeamProjectName
436
+ )
437
+
438
+ Initialize-GlobalVariables -Configuration $Configuration
439
+
440
+ # Check if the repository is part of the release
441
+ $repoName = Get-RepositoryName
442
+ $targetVersion = $script:releaseConfig.repositories."$repoName".version
443
+ if ($targetVersion -eq $null) {
444
+ Write-Host "# No release version is specified for $repoName. Stop."
445
+ Write-Host "# Available repositories: $($script:repositories)"
446
+ return $false
447
+ }
448
+
449
+ # If a tag already exists, don't update submodule or packages.
450
+ if ($(Test-TagExist `
451
+ -RepositoryName $repoName `
452
+ -Version $targetVersion `
453
+ -TeamProjectName $PrTeamProjectName)) {
454
+ Write-Host "# ERROR: A tag for the target version $targetVersion already exists."
455
+ return $false
456
+ }
457
+
458
+ # Checkout release branch to update
459
+ Write-Host ""
460
+ Write-Host "# Checkout release branch for version $targetVersion"
461
+ if (!$(Get-ReleaseBranch `
462
+ -Version $targetVersion `
463
+ -TeamProjectName $PrTeamProjectName)) {
464
+ return $false
465
+ }
466
+
467
+ # Update the submodule references
468
+ Write-Host ""
469
+ Write-Host "# Updating submodule references"
470
+ $result = $(Update-SubmoduleReferences -Configuration $Configuration)
471
+ Write-Host "Updated submodules: $result"
472
+ if (!$result) {
473
+ return $false
474
+ }
475
+
476
+ # Update the package dependencies
477
+ Write-Host ""
478
+ Write-Host "# Updating package dependencies"
479
+ if (!$(Update-PackageDependencies `
480
+ -Configuration $Configuration `
481
+ -TeamProjectName $DepTeamProjectName)) {
482
+ return $false
483
+ }
484
+
485
+ # Commit and push any changes.
486
+ Write-Host ""
487
+ Write-Host "# Start commit and push changes"
488
+ if (!$(Start-CommitAndPush)) {
489
+ return $false
490
+ }
491
+
492
+ Write-Host ""
493
+ Write-Host "Create Pull Request if one doesn't exist"
494
+ Write-Host "================"
495
+ $targetBranch = Get-TargetBranch -Version $targetVersion
496
+ $pullRequest = Get-PullRequestToMain `
497
+ -RepositoryName $repoName `
498
+ -ReleaseBranch "refs/heads/$targetBranch" `
499
+ -TeamProjectName $PrTeamProjectName
500
+ if ($pullRequest -eq $null) {
501
+ if (!(New-PullRequestToMain `
502
+ -RepositoryName $repoName `
503
+ -SourceBranchRef "refs/heads/$targetBranch" `
504
+ -TeamProjectName $PrTeamProjectName)) {
505
+ return $false
506
+ }
507
+ } else {
508
+ Write-Host "# A pull request to 'main' already exists. No need to create a new one."
509
+ }
510
+ return $true
511
+ }
512
+
513
+ <#
514
+ .Description
515
+ This work on the current directory, performing updating of
516
+ submodule references, updating package dependencies, commit
517
+ the changes and create a pull request if needed.
518
+
519
+ .Parameter ConfigFile
520
+ Full path to the configuration file.
521
+
522
+ .Parameter DepTeamProjectName
523
+ Name of the repository team project to be used for
524
+ dependency updates.
525
+
526
+ .Parameter PrTeamProjectName
527
+ Name of the repository team project to be used for
528
+ creating pull request to main.
529
+
530
+ .Outputs
531
+ true or false
532
+ #>
533
+ function Update-CommitPushPull {
534
+ param (
535
+ [Parameter(Mandatory)]
536
+ [string]$ConfigFile,
537
+ [Parameter(Mandatory)]
538
+ [string]$DepTeamProjectName,
539
+ [Parameter(Mandatory)]
540
+ [string]$PrTeamProjectName
541
+ )
542
+
543
+ # Reinitialise the script variables.
544
+ $configuration = Get-Content $ConfigFile | Out-String | ConvertFrom-Json
545
+
546
+ return Update-CommitPushPullSub `
547
+ -Configuration $configuration `
548
+ -DepTeamProjectName $DepTeamProjectName `
549
+ -PrTeamProjectName $PrTeamProjectName
550
+ }
551
+
552
+ Export-ModuleMember -Function Start-Release
553
+ Export-ModuleMember -Function Update-CommitPushPullSub
554
+ Export-ModuleMember -Function Update-CommitPushPull