fiftyone.geolocation 4.3.0 → 4.3.5
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.
- package/ci/build-and-test.yml +21 -0
- package/ci/common-ci/.github/labels.yml +80 -0
- package/ci/common-ci/.github/workflows/sync-labels.yml +52 -0
- package/ci/common-ci/CiTips.md +30 -1
- package/ci/common-ci/GitVersion.yml +18 -0
- package/ci/common-ci/README.md +155 -17
- package/ci/common-ci/build-and-test.yml +65 -0
- package/ci/common-ci/check-merge-commit-format.yml +56 -0
- package/ci/common-ci/cloud-release-config.json +51 -0
- package/ci/common-ci/create-tag.yml +41 -0
- package/ci/common-ci/deploy.yml +16 -2
- package/ci/common-ci/dotnet/shared-code-signing-steps.yml +20 -0
- package/ci/common-ci/dotnet/shared-extract-and-publish-packages.yml +29 -0
- package/ci/common-ci/go/shared-go-list-stage.yml +64 -0
- package/ci/common-ci/java/readme.md +22 -0
- package/ci/common-ci/java/shared-package-signing-steps.yml +17 -0
- package/ci/{shared-extract-and-publish-packages.yml → common-ci/node/shared-extract-and-publish-packages.yml} +7 -1
- package/ci/common-ci/php/readme.md +15 -0
- package/ci/common-ci/release-config-schema.json +52 -0
- package/ci/common-ci/release-config-template.json +310 -0
- package/ci/common-ci/release-config.json +89 -0
- package/ci/common-ci/release-process.drawio +165 -0
- package/ci/common-ci/release-process.png +0 -0
- package/ci/common-ci/scripts/azure/checkSlot.ps1 +28 -0
- package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.Tests.ps1 +1 -0
- package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.psm1 +16 -0
- package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.Tests.ps1 +3 -0
- package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.psm1 +200 -0
- package/ci/common-ci/scripts/modules/51DDeployModule/51DDeployModule.psm1 +66 -0
- package/ci/common-ci/scripts/modules/51DDownloadDataFileModule/51DDownloadDataFileModule.psm1 +74 -0
- package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.Tests.ps1 +25 -0
- package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.psm1 +22 -0
- package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.Tests.ps1 +1 -0
- package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.psm1 +41 -0
- package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.Tests.ps1 +5 -0
- package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.psm1 +702 -0
- package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.Tests.ps1 +842 -0
- package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.psm1 +926 -0
- package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.Tests.ps1 +1 -0
- package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.psm1 +87 -0
- package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.Tests.ps1 +194 -0
- package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.psm1 +653 -0
- package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.Tests.ps1 +277 -0
- package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.psm1 +554 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.Tests.ps1 +1141 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psd1 +0 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psm1 +1465 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.Tests.ps1 +318 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.psm1 +344 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.Tests.ps1 +1186 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.psm1 +900 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/SharedVariables.psm1 +139 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/c-test-env-config.json +268 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-deploy-test-env-config.json +700 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-test-env-config.json +533 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-deploy-test-env-config.json +290 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-test-env-config.json +260 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-deploy-test-env-config.json +511 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-test-env-config.json +388 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-deploy-test-env-config.json +419 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-test-env-config.json +329 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/php-test-env-config.json +540 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-deploy-test-env-config.json +411 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-test-env-config.json +321 -0
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/test-env-config.json +457 -0
- package/ci/common-ci/scripts/modules/51DRestModule/51DRestModule.psm1 +38 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DApplicationInsightsModule/51DApplicationInsightsModule.psm1 +104 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DChecksModule/51DChecksModule.psm1 +68 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DCloudModule/51DCloudModule.psm1 +155 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DConnectAzureModule/51DConnectAzureModule.psm1 +45 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DSSLBindingsModule/51DSSLBIndingsModule.psm1 +100 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DStagingSlotModule/51DStagingSlotModule.psm1 +50 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DStorageAccountModule/51DStorageAccountModule.psm1 +248 -0
- package/ci/common-ci/scripts/modules/AzurePortalModules/51DTrafficManagerModule/51DTrafficManagerModule.psm1 +58 -0
- package/ci/common-ci/shared-auto-complete-pr-stage.yml +61 -0
- package/ci/common-ci/shared-create-tag-job.yml +19 -30
- package/ci/common-ci/shared-docker-build-steps.yml +34 -0
- package/ci/common-ci/shared-docker-push-steps.yml +32 -0
- package/ci/common-ci/shared-docker-test-http-steps.yml +69 -0
- package/ci/common-ci/shared-git-tag-job.yml +38 -0
- package/ci/common-ci/shared-git-version-job.yml +71 -0
- package/ci/common-ci/shared-publish-github-stage.yml +69 -60
- package/ci/common-ci/shared-submodule-trigger-stage.yml +110 -0
- package/ci/common-ci/shared-variables.yml +3 -0
- package/ci/common-ci/trigger-release-apis.yml +39 -0
- package/ci/create-packages.yml +24 -36
- package/ci/deploy-external.yml +55 -0
- package/ci/{deploy.yml → deploy-internal.yml} +3 -29
- package/ci/shared-build-and-test-platforms.yml +7 -1
- package/ci/shared-build-and-test-stage.yml +9 -2
- package/ci/submodule-trigger.yml +12 -0
- package/examples/examples.test.js +3 -3
- package/geoLocationPipelineBuilder.js +13 -10
- package/package.json +11 -7
- package/setup.js +1 -0
package/ci/build-and-test.yml
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
trigger: none
|
|
2
2
|
|
|
3
|
+
# Schedule to run overnight
|
|
4
|
+
schedules:
|
|
5
|
+
- cron: "0 20 * * *"
|
|
6
|
+
displayName: Daily overnight build
|
|
7
|
+
branches:
|
|
8
|
+
include:
|
|
9
|
+
- develop
|
|
10
|
+
|
|
3
11
|
# Include the shared variables
|
|
4
12
|
variables:
|
|
5
13
|
- template: shared-variables.yml
|
|
14
|
+
- group: CIAutomation
|
|
15
|
+
|
|
16
|
+
resources:
|
|
17
|
+
repositories:
|
|
18
|
+
- repository: ciTemplates # Id of the repository used to reference to in this script
|
|
19
|
+
type: git
|
|
20
|
+
name: common-ci # Name of the actual repository
|
|
6
21
|
|
|
7
22
|
stages:
|
|
8
23
|
- template: shared-build-and-test-platforms.yml
|
|
@@ -10,4 +25,10 @@ stages:
|
|
|
10
25
|
windowsImage: $(windowsImage)
|
|
11
26
|
linuxImage: $(linuxImage)
|
|
12
27
|
macImage: $(macImage)
|
|
28
|
+
runTests: variables['RunTests']
|
|
13
29
|
|
|
30
|
+
# Try to complete the corresponding pull request if
|
|
31
|
+
# this is triggered by one.
|
|
32
|
+
- template: shared-auto-complete-pr-stage.yml@ciTemplates
|
|
33
|
+
parameters:
|
|
34
|
+
stageDependencies: [Windows,Linux,MacOS]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Type labels
|
|
2
|
+
- name: "type: feature-request"
|
|
3
|
+
description: New feature
|
|
4
|
+
color: 0eced4
|
|
5
|
+
- name: "type: bug"
|
|
6
|
+
description: Something isn't working
|
|
7
|
+
color: d73a4a
|
|
8
|
+
- name: "type: documentation"
|
|
9
|
+
description: Improvements or additions to documentation
|
|
10
|
+
color: 0075ca
|
|
11
|
+
- name: "type: question"
|
|
12
|
+
description: Further information is requested
|
|
13
|
+
color: d876e3
|
|
14
|
+
|
|
15
|
+
# Status Labels
|
|
16
|
+
- name: "status: to be scheduled"
|
|
17
|
+
description: This item has not been scheduled for a particular release
|
|
18
|
+
color: c2e0c6
|
|
19
|
+
- name: "status: assigned"
|
|
20
|
+
description: This item has been assigned to an engineer
|
|
21
|
+
color: 6ff076
|
|
22
|
+
- name: "status: duplicate"
|
|
23
|
+
description: This issue or pull request already exists
|
|
24
|
+
color: cfd3d7
|
|
25
|
+
- name: "status: awaiting external input"
|
|
26
|
+
description: This item is awaiting for external input
|
|
27
|
+
color: 6699ff
|
|
28
|
+
- name: "status: will not fix"
|
|
29
|
+
description: This item will not be fixed
|
|
30
|
+
color: 6392fa
|
|
31
|
+
- name: "status: released/4.3.0"
|
|
32
|
+
description: This change was released in the specified version
|
|
33
|
+
color: a8d131
|
|
34
|
+
- name: "status: released/4.3.1"
|
|
35
|
+
description: This change was released in the specified version
|
|
36
|
+
color: 6dcc16
|
|
37
|
+
- name: "status: released/4.3.2"
|
|
38
|
+
description: This change was released in the specified version
|
|
39
|
+
color: 87a457
|
|
40
|
+
- name: "status: released/4.3.3"
|
|
41
|
+
description: This change was released in the specified version
|
|
42
|
+
color: 006b75
|
|
43
|
+
- name: "status: released/4.3.4"
|
|
44
|
+
description: This change was released in the specified version
|
|
45
|
+
color: 99ccff
|
|
46
|
+
- name: "status: released/4.3.5"
|
|
47
|
+
description: This change was released in the specified version
|
|
48
|
+
color: ccccff
|
|
49
|
+
- name: "status: released/4.3.6"
|
|
50
|
+
description: This change was released in the specified version
|
|
51
|
+
color: cc88ff
|
|
52
|
+
- name: "status: released/4.4.0"
|
|
53
|
+
description: This change was released in the specified version
|
|
54
|
+
color: 376842
|
|
55
|
+
|
|
56
|
+
# Scheduled Labels
|
|
57
|
+
- name: "scheduled: 6th Oct 2021"
|
|
58
|
+
description: This item has been scheduled for 6th Oct 2021 release
|
|
59
|
+
color: 6ff076
|
|
60
|
+
- name: "scheduled: 20th Oct 2021"
|
|
61
|
+
description: This item has been scheduled for 20th Oct 2021 release
|
|
62
|
+
color: 6ff076
|
|
63
|
+
- name: "scheduled: 3rd Nov 2021"
|
|
64
|
+
description: This item has been scheduled for 3rd Nov 2021 release
|
|
65
|
+
color: 6ff076
|
|
66
|
+
- name: "scheduled: 17th Nov 2021"
|
|
67
|
+
description: This item has been scheduled for 17th Nov 2021 release
|
|
68
|
+
color: 6ff076
|
|
69
|
+
- name: "scheduled: 1st Dec 2021"
|
|
70
|
+
description: This item has been scheduled for 1st Dec 2021 release
|
|
71
|
+
color: 6ff076
|
|
72
|
+
- name: "scheduled: 15th Dec 2021"
|
|
73
|
+
description: This item has been scheduled for 15th Dec 2021 release
|
|
74
|
+
color: 6ff076
|
|
75
|
+
- name: "scheduled: 12th Jan 2022"
|
|
76
|
+
description: This item has been scheduled for 12th Jan 2022 release
|
|
77
|
+
color: d49233
|
|
78
|
+
- name: "scheduled: 19th Jan 2022"
|
|
79
|
+
description: This item has been scheduled for 19th Jan 2022 release
|
|
80
|
+
color: d49291
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# This script will automatically synchronize the labels defined in the labels.yml file in this repository
|
|
2
|
+
# to all other repositories.
|
|
3
|
+
# Note that labels that are removed or renamed in label.yml will be deleted from all repositories.
|
|
4
|
+
# Issues and PRs that are tagged with that label will have the label removed.
|
|
5
|
+
name: Sync labels
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
paths:
|
|
11
|
+
- .github/labels.yml
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- uses: micnncim/action-label-syncer@v1
|
|
18
|
+
with:
|
|
19
|
+
manifest: .github/labels.yml
|
|
20
|
+
repository: |
|
|
21
|
+
51Degrees/caching-dotnet
|
|
22
|
+
51Degrees/cloud-issues
|
|
23
|
+
51Degrees/common-ci
|
|
24
|
+
51Degrees/common-cxx
|
|
25
|
+
51Degrees/data-file-tool
|
|
26
|
+
51Degrees/device-detection-cxx
|
|
27
|
+
51Degrees/device-detection-data
|
|
28
|
+
51Degrees/device-detection-dotnet
|
|
29
|
+
51Degrees/device-detection-go
|
|
30
|
+
51Degrees/device-detection-examples-go
|
|
31
|
+
51Degrees/device-detection-java
|
|
32
|
+
51Degrees/device-detection-nginx
|
|
33
|
+
51Degrees/device-detection-node
|
|
34
|
+
51Degrees/device-detection-php
|
|
35
|
+
51Degrees/device-detection-php-onpremise
|
|
36
|
+
51Degrees/device-detection-python
|
|
37
|
+
51Degrees/device-detection-varnish
|
|
38
|
+
51Degrees/location-dotnet
|
|
39
|
+
51Degrees/location-java
|
|
40
|
+
51Degrees/location-node
|
|
41
|
+
51Degrees/location-php
|
|
42
|
+
51Degrees/location-python
|
|
43
|
+
51Degrees/pipeline-dotnet
|
|
44
|
+
51Degrees/pipeline-java
|
|
45
|
+
51Degrees/pipeline-node
|
|
46
|
+
51Degrees/pipeline-php-cloudrequestengine
|
|
47
|
+
51Degrees/pipeline-php-core
|
|
48
|
+
51Degrees/pipeline-php-engines
|
|
49
|
+
51Degrees/pipeline-python
|
|
50
|
+
51Degrees/pipeline-specification
|
|
51
|
+
51Degrees/Renderer
|
|
52
|
+
token: ${{ secrets.LABEL_SYNC_TOKEN }}
|
package/ci/common-ci/CiTips.md
CHANGED
|
@@ -2,4 +2,33 @@
|
|
|
2
2
|
## Writing Script
|
|
3
3
|
When writing script to perform a batch job, a common bug that happens often is not verifying if a step has successfully completed. There are many instances where an error code is not caught and is subsequently overwritten by the following steps, resulting in a false positive result. Therefore, when writing a script task, the following tips would help to minimize this risk:
|
|
4
4
|
1. Always verify that the result of the script is as expected. Such as checking error code or checking if a certain conditions have been met. This can be done at a number of places in the script where a certain change could impact the final outcome.
|
|
5
|
-
2. Where a required condition was not met, log a message and exit with an appropriate non zero code. This will make sure the exit code will always be caught by the script task.
|
|
5
|
+
2. Where a required condition was not met, log a message and exit with an appropriate non zero code. This will make sure the exit code will always be caught by the script task.
|
|
6
|
+
|
|
7
|
+
## Using variables from other jobs
|
|
8
|
+
|
|
9
|
+
When a variable in a separate job, in a separate template is required you may need to output it manually depending on the task that sets the variable.
|
|
10
|
+
|
|
11
|
+
For example the GitVersion task does not output variables it produces to the pipeline, you must create a separate script task to echo the variable like so:
|
|
12
|
+
|
|
13
|
+
```yml
|
|
14
|
+
- job: Tagging
|
|
15
|
+
steps:
|
|
16
|
+
|
|
17
|
+
# GitVersion task here.
|
|
18
|
+
|
|
19
|
+
# Output the GitVersion.SemVer variable so it can be used in other jobs.
|
|
20
|
+
- script: echo "##vso[task.setvariable variable=GitVersionSemVer;isOutput=true]$(GitVersion.SemVer)"
|
|
21
|
+
name: setvarStep
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then you can access the variable in a separate job like:
|
|
25
|
+
|
|
26
|
+
```yml
|
|
27
|
+
- job: Build
|
|
28
|
+
dependsOn: Tagging
|
|
29
|
+
variables:
|
|
30
|
+
# map the output variable from A into this job
|
|
31
|
+
varFromTagJob: $[ dependencies.Tagging.outputs['setvarStep.GitVersionSemVer'] ]
|
|
32
|
+
steps:
|
|
33
|
+
- script: echo $(varFromTagJob) # this step uses the mapped-in variable
|
|
34
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
next-version: 0.1.0
|
|
2
|
+
ignore:
|
|
3
|
+
sha: []
|
|
4
|
+
merge-message-formats:
|
|
5
|
+
# Allow the prefix which is automatically added by DevOps.
|
|
6
|
+
devops: ^Merged (?:PR (?<PullRequestNumber>\d+))(:) Merge branch '(?<SourceBranch>.+)'
|
|
7
|
+
devopsToMain: ^Merge pull request (?<PullRequestNumber>\d+) from (?<SourceBranch>.+) into (?<TargetBranch>.+)
|
|
8
|
+
branches:
|
|
9
|
+
main:
|
|
10
|
+
regex: ^master$|^main$
|
|
11
|
+
mode: ContinuousDelivery
|
|
12
|
+
tag: ''
|
|
13
|
+
increment: Patch
|
|
14
|
+
prevent-increment-of-merged-branch-version: true
|
|
15
|
+
track-merge-target: false
|
|
16
|
+
tracks-release-branches: false
|
|
17
|
+
is-release-branch: false
|
|
18
|
+
source-branches: ['main']
|
package/ci/common-ci/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Common-CI
|
|
2
2
|
Common-CI project contains a guideline for creation of continuous integration scripts and describes a general approach to continuous integration within 51Degrees. This readme should provide a comprehensive overview of rules and conventions to be expected from existing jobs and which should be followed when new jobs are created.
|
|
3
3
|
|
|
4
|
+
**NOTE**: A Release Engineer following this guide should first check the `internal-ci` readme to understand the 51Degrees release process.
|
|
5
|
+
|
|
4
6
|
# Table of content
|
|
5
7
|
- [Common-CI](#common-ci)
|
|
6
8
|
- [Table of content](#table-of-content)
|
|
@@ -9,7 +11,7 @@ Common-CI project contains a guideline for creation of continuous integration sc
|
|
|
9
11
|
- [Approach](#approach)
|
|
10
12
|
- [Overview](#overview)
|
|
11
13
|
- [Build and test](#build-and-test)
|
|
12
|
-
- [
|
|
14
|
+
- [Create packages](#create-packages)
|
|
13
15
|
- [Naming convention](#naming-convention)
|
|
14
16
|
- [Azure DevOps Pipelines](#azure-devops-pipelines)
|
|
15
17
|
- [Development guideline](#development-guideline)
|
|
@@ -25,6 +27,15 @@ Common-CI project contains a guideline for creation of continuous integration sc
|
|
|
25
27
|
- [Release process](#release-process)
|
|
26
28
|
- [Packages release](#packages-release)
|
|
27
29
|
- [External package managers and public repositories](#external-package-managers-and-public-repositories)
|
|
30
|
+
- [Automation](#automation)
|
|
31
|
+
- [Fully automated release process](#fully-automated-release-process)
|
|
32
|
+
- [Additional pipelines:](#additional-pipelines)
|
|
33
|
+
- [Updating the Release Configuration](#updating-the-release-configuration)
|
|
34
|
+
- [Fully automated deployment trigger procedure:](#fully-automated-deployment-trigger-procedure)
|
|
35
|
+
- [Automated Release Scripts](#automated-release-scripts)
|
|
36
|
+
- [Flow Chart](#flow-chart)
|
|
37
|
+
- [Naming convention](#naming-convention-1)
|
|
38
|
+
- [Azure DevOps Pipelines](#azure-devops-pipelines-1)
|
|
28
39
|
- [License](#license)
|
|
29
40
|
|
|
30
41
|
# Reasoning
|
|
@@ -47,7 +58,7 @@ As an internal repository management system 51Degrees is using the Azure DevOps
|
|
|
47
58
|
|
|
48
59
|
At least two main continuous integration jobs should be provided for each software project/repository:
|
|
49
60
|
- “[Build and test](#build-and-test)”, and
|
|
50
|
-
- “[
|
|
61
|
+
- “[Create packages](#create-packages)”
|
|
51
62
|
|
|
52
63
|
Binaries built by continuous integration should be configured to perform a release built by default. If debug build configuration is required, additional, explicit jobs should be created to clearly indicate that pipeline output will be in debug mode.
|
|
53
64
|
|
|
@@ -80,14 +91,12 @@ General guideline for selecting the approach is to keep the `yml` file in a cons
|
|
|
80
91
|
|
|
81
92
|
<i>Note: Build and test job should be configured in a separate `yml` file to allow performing the set of tasks defined in this job as a part of "Build, test and publish" job.</i>
|
|
82
93
|
|
|
83
|
-
###
|
|
84
|
-
|
|
94
|
+
### Create packages
|
|
95
|
+
Create packages job should be used for creation of packages or tagging the repository and continuous integration system should be configured to automatically execute this job whenever pull request from `release` or `hotfix` branch is merged to `main` branch (as described in [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)).
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
Create packages job performs any tasks required for creation of packages and/or repository version tag. This job usually runs a sequence of tasks which differ for creating the packages and tagging the repository. <br />
|
|
87
98
|
|
|
88
99
|
Typical tasks for packages creation:<br />
|
|
89
|
-
- Build and test<br />
|
|
90
|
-
As described in [Build and test](#build-and-test) section.
|
|
91
100
|
- Package creation<br />
|
|
92
101
|
Language and project specific task generating the packages for given language and/or platform. This task should be documented in project specific `ci/readme.md` file.
|
|
93
102
|
- Digital signing<br />
|
|
@@ -96,26 +105,23 @@ This task should digitally sign the generated binaries or packages to assure a h
|
|
|
96
105
|
Packages or binaries produced by [Build, test and publish](#build,-test-and-publish) job should be published as artifacts of the Azure DevOps Pipeline execution. This task is important to support a smooth release process where the product of this step is used as the final release package.
|
|
97
106
|
|
|
98
107
|
Typical tasks for creating a repository tag:<br />
|
|
99
|
-
- Build and test<br />
|
|
100
|
-
As described in [Build and test](#build-and-test) section.
|
|
101
108
|
- Determine repository version number<br />
|
|
102
109
|
This step should determine the version number to be used for repository tagging. 51Degrees is using [GitVersion](https://gitversion.readthedocs.io/en/latest/input/docs/build-server-support/build-server/azure-devops/) Azure DevOps plugin to identify the repository version based on the [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow).
|
|
103
110
|
- Tag the repository<br />
|
|
104
111
|
Perform `git tag` operation on the repository using the version number determined in the previous step and `push` the newly created tag to remote.
|
|
105
112
|
|
|
106
113
|
Job <b>must</b> indicate a <b>fail state</b> if any of the following occurs:
|
|
107
|
-
- Build and test step fails as described in [build and test](#build-and-test) section.
|
|
108
114
|
- Package creation fails
|
|
109
115
|
- Digital signature process fails
|
|
110
116
|
- Artifacts cannot be found or published
|
|
111
117
|
|
|
112
118
|
## Naming convention
|
|
113
119
|
### Azure DevOps Pipelines
|
|
114
|
-
There are two main jobs per pipeline: `build and test`, and `
|
|
120
|
+
There are two main jobs per pipeline: `build and test`, and `create packages` the common naming convention is as follows:
|
|
115
121
|
- For “build and test” job:<br />
|
|
116
122
|
`<package-name>-test` where `<package-name>` represents dash-separated repository name; for example for repository `pipeline-python`, “build and test” job name should be configured as `pipeline-python-test`.
|
|
117
|
-
- For “
|
|
118
|
-
- For “
|
|
123
|
+
- For “create packages” job when packages are created:<br /> `<package-name>-create-packages`, where `<package-name>` represents dash-separated repository name; for example for repository `pipeline-python`, “build, test and publish” job name should be configured as `pipeline-python-create-packages`.
|
|
124
|
+
- For “create packages” job when repository is only tagged:<br />
|
|
119
125
|
`<package-name>-tag-repository`, where `<package-name>` represents dash-separated repository name; for example for repository `location-php`, “build, test and publish” job name should be configured as `location-php-tag-repository`.
|
|
120
126
|
- For jobs in debug configuration:<br />
|
|
121
127
|
`<package-name>-<job>-debug`, where `<package-name>` represents dash-separated repository name, `<job>` represents job suffix selected above; for example for repository `device-detection-dotnet`, “build, test and publish” job in `debug` the name should be configured as `device-detection-dotnet-create-packages-debug`.
|
|
@@ -173,6 +179,17 @@ This guideline covers high-level overview and basic principles for continuous in
|
|
|
173
179
|
\build-and-test.yml
|
|
174
180
|
\build-and-publish.yml
|
|
175
181
|
```
|
|
182
|
+
Language specific configuration should be documented in a `readme.md` file stored under the corresponding folder of the repository `common-ci`. Example directory tree of `common-ci` for `readme.md` files:
|
|
183
|
+
```
|
|
184
|
+
\common-ci
|
|
185
|
+
\readme.md
|
|
186
|
+
\java
|
|
187
|
+
\readme.md
|
|
188
|
+
\dotnet
|
|
189
|
+
\readme.md
|
|
190
|
+
...
|
|
191
|
+
...
|
|
192
|
+
```
|
|
176
193
|
### APIs common templates
|
|
177
194
|
When tasks are replicated across APIs, they should be made as templates and kept in the `common-ci` repository. Templates that are shared across languages are kept at the root directory of `common-ci` and templates which are only shared within a language APIs should be kept in its distinct folder, named with the language name. Below is an illustration of the of `common-ci` directory structure:
|
|
178
195
|
```
|
|
@@ -201,8 +218,11 @@ All of the packages for daily continuous deployment are created based on the lat
|
|
|
201
218
|
Deployment to internal package managers is performed daily (overnightly) based on changes applied to `develop` branches of the source code repositories.
|
|
202
219
|
|
|
203
220
|
## Release process
|
|
221
|
+
|
|
222
|
+
Refer to the `internal-ci` readme for instruction on 51Degrees release process.
|
|
223
|
+
|
|
204
224
|
### Packages release
|
|
205
|
-
Packages release process in 51Degrees is handled through Azure DevOps and the deployment to the public repositories is performed manually using packages generated by [
|
|
225
|
+
Packages release process in 51Degrees is handled through Azure DevOps and the deployment to the public repositories is performed manually using packages generated by [Create packages](#create-packages) continuous integration job. As explained in “[Create packages](#create-packages)” section, process of creating the packages is automatically triggered by completion of pull request to the `main` branch of the repository. Created packages are stored as artifacts in Azure DevOps Artifacts and are used in internal release pipelines in order to upload them to the public package managers/repositories.
|
|
206
226
|
|
|
207
227
|
API release process steps:
|
|
208
228
|
- PR completed to the `main` branch.
|
|
@@ -213,6 +233,7 @@ API release process steps:
|
|
|
213
233
|
|
|
214
234
|
### External package managers and public repositories
|
|
215
235
|
51Degrees provides APIs for a selection of programming languages and packages are available on the following public package managers:
|
|
236
|
+
|
|
216
237
|
- [NuGet](https://www.nuget.org/profiles/51Degrees)
|
|
217
238
|
- [Maven](https://mvnrepository.com/artifact/com.51degrees)
|
|
218
239
|
- [Packagist](https://packagist.org/packages/51degrees/)
|
|
@@ -220,8 +241,125 @@ API release process steps:
|
|
|
220
241
|
- [PyPi](https://pypi.org/search/?q=51degrees) (and [TestPyPi](https://test.pypi.org/search/?q=51degrees))
|
|
221
242
|
- Source code on [Github](https://github.com/51Degrees/)
|
|
222
243
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
244
|
+
## Automation
|
|
245
|
+
|
|
246
|
+
### Fully automated release process
|
|
247
|
+
|
|
248
|
+
The release process uses the following flow:
|
|
249
|
+
1. Changes are prepared in `release|hotfix` branches.
|
|
250
|
+
2. Switch `AutomatedRelease` variable in `CIAutomation` variable group to `On`.
|
|
251
|
+
3. `Trigger release` job starts; or all `leaf submodules` are manually or automatically merged to `main|master`.
|
|
252
|
+
1. Since `common-ci` is a submodule of all APIs, this is normally done by having `common-ci` `release|hotfix` branch merged to `main`.
|
|
253
|
+
2. To merge `common-ci` `release|hotfix` branch to `main`, creating a pull request to `main` is enough since the pull request will be automatically completed at the end of the pull request `build-and-test` check. This is done by a task that calls a set of APIs in `Release` modules.
|
|
254
|
+
4. All `leaf submodules` `release|hotfix` branches are merged to `main`.
|
|
255
|
+
1. NOTE: `leaf submodules` are modules which do not have any dependencies.
|
|
256
|
+
5. Completion of submodule merging triggers tag and packages deployment of the submodules. If module does not generate packages, then it will be the tag creation step.
|
|
257
|
+
6. Tag and package deployment (or creation) completion triggers `submodule_trigger` pipelines of the parent APIs, which will then update submodule references, package dependencies versions and create a pull request to `main` if one does not exist.
|
|
258
|
+
7. The pull request of parent APIs will then again be completed once the `build_and_test` check passes.
|
|
259
|
+
8. Completion of merging `release|hotfix` branches to `main` will also trigger `deployment` of packages both internally and externally in the same way that the submodules were done.
|
|
260
|
+
9. At the end of the `release` process, packages are available to be collected internally; and `deployment` to external repositories are left to be approved by `release engineer`.
|
|
261
|
+
10. Switch `AutomatedRelease` variable in `CIAutomation` variable group to `Off` to prevent any accidental references update or pull request completion after this stage.
|
|
262
|
+
|
|
263
|
+
The fully automated release process is controlled by a `release-config.json` file, located in the `common-ci` repository. There also exists a `release-config-template.json` which contains all settings and APIs that can be included in a `release-config.json`. The automated release process can also be enabled or disabled by a global variable `AutomatedRelease` as part of the Azure Devops variable group `CIAutomation`. To support automating the deployment process, powershell scripts and additional pipelines are required. These scripts are located under `common-ci` repository, and are grouped into modules. The additional pipelines are required per API, but shared templated can be reused from `common-ci`.
|
|
264
|
+
|
|
265
|
+
### Additional pipelines:
|
|
266
|
+
- The `submodule trigger` pipeline is required for each API to pick up the package deployment from each of its submodules. Since a module can have multiple submodules, multiple triggers might happen at the same time. Thus, this pipeline should cancel all previous builds and only run one at a single time.
|
|
267
|
+
- This must be triggered only by a submodule deployment that happened on the 'main' branch.
|
|
268
|
+
- This pipeline, will then perform update of all submodule references and package dependencies, using the versions specified in the `release-config.json`.
|
|
269
|
+
- The `pull request completion` job is required to be done at the end of each `build and test` pipeline.
|
|
270
|
+
- This will check if the current build is triggered by a pull request from `release|hotfix` branch to the `main` branch. If it is and the following conditions have been met, it then proceed to complete the corresponding pull request.
|
|
271
|
+
- The `AutomatedRelease` variable has been enabled.
|
|
272
|
+
- All submodule references and package dependencies have been updated.
|
|
273
|
+
- The pull request has been approved and comments have been left unresolved; or approval is not required.
|
|
274
|
+
- Both of the above pipelines will not proceed if a tag already exists for a release version.
|
|
275
|
+
|
|
276
|
+
### Updating the Release Configuration
|
|
277
|
+
|
|
278
|
+
The release configuration files must be updated to configure which repositories will be released. Each repository can be configured with the following fields:
|
|
279
|
+
|
|
280
|
+
**Files to update:**
|
|
281
|
+
|
|
282
|
+
- `release-config.json`
|
|
283
|
+
- `cloud-release-config.json`
|
|
284
|
+
|
|
285
|
+
Property|Type|Description
|
|
286
|
+
-|-|-
|
|
287
|
+
version|string|The target version of this repository, e.g. the version to release or the current version if a release version does not exist. Should be a valid Semantic Version e.g. `4.3.1`
|
|
288
|
+
packageName|string|The name of the package that this repository contains code for. E.g. FiftyOne.Pipeline
|
|
289
|
+
versionVariableName|string|The variable name used in pipelines to update dependencies.
|
|
290
|
+
isLeaf|boolean|Is this a leaf of the dependency tree, i.e. does this repository have no dependencies?
|
|
291
|
+
dependencies|string[]|A list of dependencies, these are the names of the repositories that this one is dependent on or contains dependencies of the contained projects.
|
|
292
|
+
|
|
293
|
+
While the cloud release **is not** triggered by the automated API release, the `cloud-release-config.json` file will also need to be updated in preparation for the cloud release the following week. Only the version numbers must be updated in this file.
|
|
294
|
+
|
|
295
|
+
A `release-config-template.json` file is provided which contains configurations for all the repos with a release pipeline, this should be used as a reference to modify the release config files. Only edit this file if adding a new repo configuration and updating dependencies.
|
|
296
|
+
|
|
297
|
+
**Rules**
|
|
298
|
+
|
|
299
|
+
There are some **rules** that a release engineer will need to pay attention to when updating the file:
|
|
300
|
+
1. `packageName`: This name is used to search for matching package reference in a package file of a target language. This is used as part of a regular expression search so regex syntax can also be used. Most of the time, the value will just be a prefix of the package name since an API usually uses unique prefix such as `FiftyOne.DeviceDetection`. However, there are APIs which use more than one prefixes such as `license-dotnet`, where `FiftyOne.License` and `FiftyOne.Resource` are used. In this specific case, the value of a `packageName` can be `FiftyOne.(License|Resource)`. Currently `DotNet` is only one which tests and supports regex `packageName`. Others language APIs have unique package `prefix` so regex is not required.
|
|
301
|
+
2. `dependencies`: When specify dependencies, make sure the definition of the dependencies are also specified, so that the release process can detect what tag to update to for submodule reference or what version to be updated for package dependencies. Failing to include the dependency definition will result in submodule references and package dependencies not being updated.
|
|
302
|
+
1. A `dependency` can be either a submodule or a package dependency.
|
|
303
|
+
|
|
304
|
+
**Validation**
|
|
305
|
+
|
|
306
|
+
Once the files have been updated, they can be validated by running the following PowerShell commands:
|
|
307
|
+
|
|
308
|
+
- `Get-Content release-config.json | Out-String | ConvertFrom-Json` - Test JSON is valid
|
|
309
|
+
- `Test-Json -Json "$(Get-Content .\release-config.json)" -SchemaFile .\release-config-schema.json` - Test the file matches the release-config schema.
|
|
310
|
+
|
|
311
|
+
Steps to make changes and update the release config in common-ci repo:
|
|
312
|
+
1. create new hotfix / release branch in common-ci and push to the remote -
|
|
313
|
+
1. When determining the branch name for the common-ci hotfix or release branch, typically the version should be the same MAJOR and MINOR version of the API releases however the PATCH version does not need to match and should simply be incremented from the previous version in common-ci. See [validating branch names](#validate-the-release--hotfix-branch-names).
|
|
314
|
+
2. create new feature branch for release config in common-ci and push to the remote
|
|
315
|
+
3. update release config with repos, deps and versions for both
|
|
316
|
+
4. commit modified release config to feature branch and create a pr from the feature branch into the release / hotfix branch.
|
|
317
|
+
|
|
318
|
+
### Fully automated deployment trigger procedure:
|
|
319
|
+
1. At the start, `release engineer` will need to update the `release-config.json` to specify all release packages and their target release version. Any additional details should also be specified.
|
|
320
|
+
1. NOTE: There is a `release-config-template.json` available for references.
|
|
321
|
+
2. Once the `release-config.json` is ready in one of the `release|hotfix` branch of `common-ci`, either the following should trigger the release process:
|
|
322
|
+
1. Complete the pull request that contains the updated `release-config.json` changes to the `main` branch. This will only work based on the assumption that the `common-ci` is specified as submodule of all release APIs.
|
|
323
|
+
1. This pull request can be completed manually or automatically by the `build-and-test.yml` auto completion pull request task. The automatic completion is only enabled if the global variable `AutomatedRelease` specified in the variables group `CIAutomation` is set to `On`.
|
|
324
|
+
2. Trigger the `trigger-release` pipeline of the `common-ci` against the hotfix or release branch.
|
|
325
|
+
|
|
326
|
+
### Automated Release Scripts
|
|
327
|
+
As briefly mentioned, the automated release process requires powershell scripts to support tasks that have been done manually. These scripts are located in the directory `scripts/modules` of the `common-ci` repository.
|
|
328
|
+
|
|
329
|
+
Testing of the release process is done using both script tests and manual testing.
|
|
330
|
+
1. Each module has a set of tests. Since it is the nature of the powershell script to contain many call to utility tools which make it difficult to mock and test effectively. Therefore, where it is not possible to test, the `test` file is left empty as a place holder for the future usage.
|
|
331
|
+
1. To run the tests, firstly `Pester` module is required. `Pester` is included in powershell environment by default. However it is recommended to install the latest version.
|
|
332
|
+
2. Updated the environment variables and authorization string as mentioned in the `Manual testing` section below.
|
|
333
|
+
3. Set the environment `$Env:51D_ENVIRONMENT` to `Test` to ensure that no tests is writing or changing the production environment.
|
|
334
|
+
4. Load the modules by setting `$Env:PSModulePath` ( and using `Import-Module` command if it is needed) in a powershell terminal.
|
|
335
|
+
5. Navigate to `scripts/modules` path and run the following command:
|
|
336
|
+
1. ``` Invoke-Pester ```
|
|
337
|
+
2. To run each module test, run the above command in each module folder.
|
|
338
|
+
2. Manual testing involves creation of test environment so that the release process can be completed and examined without effecting the production environment.
|
|
339
|
+
1. To create a test environment, use the `New-TestEnvironment` function provided in the `51DReleaseTestEnvModule` with an input configuration file. There are many example of how a configuration file looks like in the `51DReleaseTestEnvModule` `config` folder.
|
|
340
|
+
1. The module is mainly used locally but can also be integrated as part of the `Azure Devops` pipelines yaml. However, since the configuration file might be adjusted often to provide a test environment that is suitable for certain scenarios, it is the best to use the script locally.
|
|
341
|
+
2. To use the module locally, the `$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI` and `$env:SYSTEM_TEAMPROJECTID` as guided in the `SharedVariables.psm1` of `51DReleaseTestEnvModule` should be updated accordingly. The `AuthorizationString` of the `51DAuthorizationModule` is also required to be updated. More details can be found in each module file.
|
|
342
|
+
3. The test environment also requires a separate `artifact` feed. Creation of test `artifact` feed is done manually. Once it is created, the `InternalFeedName` and `InternalFeedId` of the variables group `CIAutomation` should be updated accordingly.
|
|
343
|
+
4. Once the release process has completed in a test environment, the `release-config.json` used for the release process can be fed into the `Test-Release` function to verify if the output has successfully completed correctly.
|
|
344
|
+
5. To delete the test environment, use the `Clear-TestEnvironment` function of the `51DReleaseTestEnvModule`. The test artifact feed should be deleted manually. As deletion is a dangerous task, be cautious when performing them. The `Clear-TestEnvironment` will prompt to ask for your confirmation together with the target environment before proceed.
|
|
345
|
+
|
|
346
|
+
### Flow Chart
|
|
347
|
+
The following Flow Chart can be edited and updated by changing the `release-process.drawio` file.
|
|
348
|
+

|
|
226
349
|
|
|
350
|
+
## Naming convention
|
|
351
|
+
### Azure DevOps Pipelines
|
|
352
|
+
There are two main jobs per pipeline: `deploy internally`, and `deploy externally`. The common naming convention is as follows:
|
|
353
|
+
- For “deploy internally” job:<br />
|
|
354
|
+
`<package-name>-deploy-internal` where `<package-name>` represents dash-separated repository name; for example for repository `pipeline-python`, “deploy internally” job name should be configured as `pipeline-python-deploy-internal`.
|
|
355
|
+
- For “deploy externally” job:<br />
|
|
356
|
+
`<package-name>-deploy-external`, where `<package-name>` represents dash-separated repository name; for example for repository `pipeline-python`, “deploy externally” job name should be configured as `pipeline-python-create-packages`.
|
|
357
|
+
- For “deploy” job there is no internal or external package repository:<br />
|
|
358
|
+
`<package-name>-deploy`, where `<package-name>` represents dash-separated repository name; for example for repository `location-php`, “deploy” job name should be configured as `location-php-deploy`. This normally happens when there is no package management for a target language; or the only package management supported for a language is via publishing the source code to a public Git repository.
|
|
359
|
+
|
|
360
|
+
There are other jobs required to support the automated deployment process: `submodule trigger`, and `pull request completion`. The `pull request completion` is required as part of the `build and test` pipeline. Thus, the only required common naming convention is for `submodule trigger` pipeline.
|
|
361
|
+
- For “submodule trigger” job:<br />
|
|
362
|
+
`<package-name>-submodule-trigger` where `<package-name>` represents dash-separated repository name; for example for repository `pipeline-python`, “submodule trigger” job name should be configured as `pipeline-python-submodule-trigger`.
|
|
227
363
|
|
|
364
|
+
# License
|
|
365
|
+
License information can be found in the `LICENSE` file available in this repository.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Common-ci only contains document, build script and yaml templates
|
|
2
|
+
# so no tests is run. However, it is depended by other apis so
|
|
3
|
+
# make it complete pull request and trigger modules like other.
|
|
4
|
+
|
|
5
|
+
trigger: none
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
# Try to complete the corresponding pull request if
|
|
9
|
+
# this is triggered by one.
|
|
10
|
+
- stage: Test
|
|
11
|
+
displayName: "Test, Check and complete corresponding pull request"
|
|
12
|
+
|
|
13
|
+
variables:
|
|
14
|
+
- group: CIAutomation # Required to access CI variables
|
|
15
|
+
|
|
16
|
+
pool:
|
|
17
|
+
vmImage: 'windows-2019'
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
- job: Test
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- checkout: self
|
|
24
|
+
submodules: recursive
|
|
25
|
+
persistCredentials: true
|
|
26
|
+
|
|
27
|
+
- powershell: |
|
|
28
|
+
# Install all modules
|
|
29
|
+
$Env:PSModulePath += ";$($(Get-Location).Path)\scripts\modules"
|
|
30
|
+
Write-Host "Module Path: $($Env:PsModulePath)"
|
|
31
|
+
|
|
32
|
+
# Make sure all modules are loaded
|
|
33
|
+
cd scripts\modules
|
|
34
|
+
Get-ChildItem -Directory | ForEach-Object {
|
|
35
|
+
if($(Get-ChildItem $_.FullName | Where-Object {($_ -like '*.psm1') -or ($_ -like '*.psd1')}).length -gt 0) {
|
|
36
|
+
Write-Output $_.Name
|
|
37
|
+
Import-Module $_.Name -Force
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Run all tests
|
|
42
|
+
# Enable test environment so that production environment is not impacted
|
|
43
|
+
$Env:51D_ENVIRONMENT = "Test"
|
|
44
|
+
|
|
45
|
+
Write-Host "# Run all Pester tests."
|
|
46
|
+
Invoke-Pester
|
|
47
|
+
displayName: 'Run tests'
|
|
48
|
+
env:
|
|
49
|
+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
50
|
+
|
|
51
|
+
- powershell: |
|
|
52
|
+
# Install all modules
|
|
53
|
+
$Env:PSModulePath += ";$($(Get-Location).Path)\scripts\modules"
|
|
54
|
+
Write-Host "Module Path: $($Env:PsModulePath)"
|
|
55
|
+
|
|
56
|
+
# Complete the corresponding pull request
|
|
57
|
+
Write-Host "# Try to complete pull request for repository $Env:BUILD_REPOSITORY_NAME."
|
|
58
|
+
if (!$(Complete-CorrespondingPullRequest -ConfigFile "$($(Get-Location).Path)\release-config.json")) {
|
|
59
|
+
Write-Host "# FAILED"
|
|
60
|
+
exit 1
|
|
61
|
+
}
|
|
62
|
+
displayName: 'Complete Pull Request'
|
|
63
|
+
env:
|
|
64
|
+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
65
|
+
condition: and(succeeded(), eq(variables['AutomatedRelease'], 'On'))
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
trigger: none
|
|
2
|
+
|
|
3
|
+
# Don't trigger for a pull request
|
|
4
|
+
pr: none
|
|
5
|
+
|
|
6
|
+
stages:
|
|
7
|
+
|
|
8
|
+
- stage: Merge_Message
|
|
9
|
+
jobs:
|
|
10
|
+
- job: Merge_Message
|
|
11
|
+
|
|
12
|
+
variables:
|
|
13
|
+
# Access token for the git repository. Used by the git tag task.
|
|
14
|
+
- name: system_accesstoken
|
|
15
|
+
value: $(System.AccessToken)
|
|
16
|
+
|
|
17
|
+
pool:
|
|
18
|
+
vmImage: 'windows-latest'
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
# The lines below are needed to allow the pipeline access to the
|
|
22
|
+
# OAuth access token that controls write access to the git repository.
|
|
23
|
+
# (Required for GitTag task)
|
|
24
|
+
- checkout: self
|
|
25
|
+
persistCredentials: true
|
|
26
|
+
|
|
27
|
+
- task: PowerShell@2
|
|
28
|
+
inputs:
|
|
29
|
+
targetType: 'inline'
|
|
30
|
+
script: |
|
|
31
|
+
# Get the name of the repo from the PR.
|
|
32
|
+
$repoUrl = "$(System.PullRequest.SourceRepositoryURI)"
|
|
33
|
+
$repoUrlParts = $repoUrl.Split("/")
|
|
34
|
+
$repoName = $repoUrlParts[$repoUrlParts.Length - 1]
|
|
35
|
+
$url = "https://dev.azure.com/51degrees/pipeline/_apis/git/repositories/$repoName/pullrequests/$(System.PullRequest.PullRequestId)?api-version=6.0"
|
|
36
|
+
# Get the PR.
|
|
37
|
+
$pr = Invoke-RestMethod -Uri $url `
|
|
38
|
+
-Headers @{
|
|
39
|
+
Authorization = "Bearer $(System.AccessToken)"
|
|
40
|
+
}
|
|
41
|
+
# Get the title of the PR and check that it matches the expected format.
|
|
42
|
+
$title = $pr.title
|
|
43
|
+
$found = $title -match "Merge branch '.*'"
|
|
44
|
+
if ( $found -eq $false) {
|
|
45
|
+
# The format does not match, so fail the build.
|
|
46
|
+
$errMsg = ("The expected format for the title should be either of the following:`n" +
|
|
47
|
+
"`tMerge branch '[source branch name]'`n" +
|
|
48
|
+
"`tMerge branch '[source branch name]' into '[target branch name]'`n" +
|
|
49
|
+
"`n" +
|
|
50
|
+
"Any other format will not be accepted, including:`n" +
|
|
51
|
+
"`tMerge branch [source branch name]`n" +
|
|
52
|
+
"`tMerge branch `"[source branch name]`"")
|
|
53
|
+
Write-Error $errMsg
|
|
54
|
+
exit 1
|
|
55
|
+
}
|
|
56
|
+
failOnStderr: true
|