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,61 @@
1
+ parameters:
2
+ - name: stageDependencies
3
+ type: object
4
+ default: []
5
+ - name: commonCiRef # The common-ci repo reference to checkout.
6
+ type: string
7
+ default: main
8
+ - name: project # The DevOps project executing this template.
9
+ displayName: 'Calling project is cloud or non-cloud'
10
+ type: string
11
+ default: 'non-cloud'
12
+
13
+ stages:
14
+ # This stage check if current branch runs on a pull request merge branch,
15
+ # then try to complete the pull request if it is true.
16
+ # WARNINGS: This stage should be run at the end of a pipeline, because upon
17
+ # completing a pull request the pipeline will be canceled and no stage
18
+ # or tasks will be run after this.
19
+ - stage: Complete_PR
20
+ displayName: "Check and complete corresponding pull request"
21
+ dependsOn: ${{ parameters.stageDependencies }}
22
+
23
+ variables:
24
+ - group: CIAutomation # Required to access CI variables
25
+
26
+ pool:
27
+ vmImage: 'windows-2019'
28
+
29
+ jobs:
30
+ - job: Complete_PR
31
+
32
+ steps:
33
+ - checkout: self
34
+ submodules: recursive
35
+ persistCredentials: true
36
+
37
+ # Checkout the common-ci to access the latest release configuration.
38
+ # Special consideration is given to the cloud project as when executing
39
+ # this template the git url would resolve to git://Cloud/common-ci
40
+ # which is not valid.
41
+ - ${{ if eq(parameters.project, 'cloud') }}:
42
+ - checkout: 'git://Pipeline/common-ci@${{ parameters.commonCiRef }}'
43
+ - ${{ if ne(parameters.project, 'cloud') }}:
44
+ - checkout: 'git://$(System.TeamProject)/common-ci@${{ parameters.commonCiRef }}'
45
+
46
+ - powershell: |
47
+ # Install all modules
48
+ $Env:PSModulePath += ";$($(Get-Location).Path)\common-ci\scripts\modules"
49
+ Write-Host "Module Path: $($Env:PsModulePath)"
50
+
51
+ # Complete the corresponding pull request
52
+ cd $Env:BUILD_REPOSITORY_NAME
53
+ Write-Host "# Try to complete pull request for repository $Env:BUILD_REPOSITORY_NAME."
54
+ if (!$(Complete-CorrespondingPullRequest -ConfigFile "$($(Get-Location).Path)\..\common-ci\release-config.json")) {
55
+ Write-Host "# FAILED"
56
+ exit 1
57
+ }
58
+ displayName: 'Complete Pull Request'
59
+ env:
60
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
61
+ condition: and(succeeded(), eq(variables['AutomatedRelease'], 'On'))
@@ -0,0 +1,23 @@
1
+ parameters:
2
+ - name: imageName # Name of the image to run the job on
3
+ - name: commonCiRef # The common-ci repo reference to checkout.
4
+ type: string
5
+ default: main
6
+ - name: project # The DevOps project executing this template.
7
+ displayName: 'Calling project is cloud or non-cloud'
8
+ type: string
9
+ default: 'non-cloud'
10
+
11
+ jobs:
12
+ # Determine the version of the current commit.
13
+ - template: shared-git-version-job.yml
14
+ parameters:
15
+ imageName: ${{ parameters.imageName }}
16
+ commonCiRef: ${{ parameters.commonCiRef }}
17
+ project: ${{ parameters.project }}
18
+
19
+ # Tag using the version from the gitversion job
20
+ - template: shared-git-tag-job.yml
21
+ parameters:
22
+ imageName: ${{ parameters.imageName }}
23
+ jobDependencies: [Versioning]
@@ -0,0 +1,34 @@
1
+ # Steps to build a Docker container.
2
+
3
+ parameters:
4
+ - name: imageRepository # Name of the repository.
5
+ - name: dockerfilePath # Path to the Dockerfile.
6
+ - name: dockerRegistryServiceConnection # A Docker registry service connection.
7
+ - name: tag # A list of tags in separate lines. e.g. beta1.1, latest
8
+
9
+ steps:
10
+ # Login to the Docker registry
11
+ - task: Docker@2
12
+ displayName: Docker Login
13
+ inputs:
14
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
15
+ command: 'login'
16
+
17
+ # Build the docker container
18
+ - task: Docker@2
19
+ displayName: Docker Build
20
+ inputs:
21
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
22
+ repository: '${{ parameters.imageRepository }}'
23
+ command: 'build'
24
+ Dockerfile: '${{ parameters.dockerfilePath }}'
25
+ tags: |
26
+ ${{ parameters.tag }}
27
+ latest
28
+
29
+ # Logout of the Docker registry
30
+ - task: Docker@2
31
+ displayName: Docker Logout
32
+ inputs:
33
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
34
+ command: 'logout'
@@ -0,0 +1,32 @@
1
+ # Steps to push a Docker container to a Docker repository.
2
+
3
+ parameters:
4
+ - name: imageRepository # Name of the repository.
5
+ - name: dockerRegistryServiceConnection # A Docker registry service connection.
6
+ - name: tag # A list of tags in separate lines. e.g. beta1.1, latest
7
+
8
+ steps:
9
+ # Login to the Docker registry
10
+ - task: Docker@2
11
+ displayName: Docker Login
12
+ inputs:
13
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
14
+ command: 'login'
15
+
16
+ # Push the docker container to the registy
17
+ - task: Docker@2
18
+ displayName: Docker Push
19
+ inputs:
20
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
21
+ repository: '${{ parameters.imageRepository }}'
22
+ command: 'push'
23
+ tags: |
24
+ ${{ parameters.tag }}
25
+ latest
26
+
27
+ # Logout of the Docker registry
28
+ - task: Docker@2
29
+ displayName: Docker Logout
30
+ inputs:
31
+ containerRegistry: '${{ parameters.dockerRegistryServiceConnection }}'
32
+ command: 'logout'
@@ -0,0 +1,69 @@
1
+ # Steps to test a Docker container image which exposes an http interface.
2
+
3
+ parameters:
4
+ - name: imageRepository # Name of the repository.
5
+ - name: tag # A list of tags in separate lines. e.g. beta1.1, latest
6
+ - name: containerPort # A tcp port for http connections exposed by the container.
7
+ type: number
8
+ default: 80
9
+ - name: machinePort # The port to open on the machine.
10
+ type: number
11
+ default: 8080
12
+ - name: scheme # The HTTP scheme to use when testing endpoints.
13
+ type: string
14
+ default: http
15
+ - name: endpoints # A list of URIs to test against the docker container, these should exclude the base URL, e.g. '/api/info/name'
16
+ type: object
17
+ default: []
18
+ - name: additionalDockerArguments # Additional arguments to pass to the docker run command
19
+ type: string
20
+ default: ''
21
+ - name: project # The DevOps project executing this template.
22
+ displayName: 'Calling project is cloud or non-cloud'
23
+ type: string
24
+ default: 'non-cloud'
25
+ - name: commonCiRef # The common-ci repo reference to checkout.
26
+ type: string
27
+ default: 'main'
28
+ - name: instanceName # Name of docker instance to create.
29
+ type: string
30
+ default: 'cloudInstance'
31
+
32
+ steps:
33
+ # Checkout the common-ci repo which contains the checkSlot script.
34
+ # Special consideration is given to the Cloud project as when executing
35
+ # this template the, git url would resolve to git://Cloud/common-ci
36
+ # which is not valid.
37
+ - ${{ if eq(parameters.project, 'cloud') }}:
38
+ - checkout: 'git://Pipeline/common-ci@${{ parameters.commonCiRef }}'
39
+ - ${{ if ne(parameters.project, 'cloud') }}:
40
+ - checkout: 'git://$(System.TeamProject)/common-ci@${{ parameters.commonCiRef }}'
41
+
42
+ # Run the docker container in detached mode with provided ports and any additional arguments provided in the parameters.
43
+ - task: CmdLine@2
44
+ inputs:
45
+ script: 'docker run -d ${{ format(''-p {0}:{1}'', parameters.machinePort, parameters.containerPort) }} ${{ parameters.additionalDockerArguments }} --name ${{ parameters.instanceName }} ${{ parameters.imageRepository }}:${{ parameters.tag }} '
46
+ displayName: Run docker container
47
+
48
+ # List all active docker container instances
49
+ - task: CmdLine@2
50
+ inputs:
51
+ script: 'docker ps'
52
+ displayName: List docker containers
53
+
54
+ # Check the provided endpoints against the running container.
55
+ - ${{ each endpoint in parameters.endpoints }}:
56
+ - task: PowerShell@2
57
+ displayName: 'Test ${{ parameters.scheme }}://localhost:${{ parameters.machinePort }}${{ endpoint }}'
58
+ inputs:
59
+ filePath: '$(Build.SourcesDirectory)/common-ci/scripts/azure/checkSlot.ps1'
60
+ arguments: '-ModulePath $(Build.SourcesDirectory)/common-ci/scripts/modules -Uri ''${{ parameters.scheme }}://localhost:${{ parameters.machinePort }}${{ endpoint }}'''
61
+ failOnStderr: true
62
+
63
+ # Output the logs from container instance.
64
+ - task: CmdLine@2
65
+ inputs:
66
+ script: 'docker logs ${{ parameters.instanceName }}'
67
+ displayName: Output logs
68
+ # Always run this to make sure logs are available in failure instances.
69
+ condition: always()
@@ -0,0 +1,38 @@
1
+ parameters:
2
+ - name: imageName # Name of the image to run the job on
3
+ - name: jobDependencies
4
+ type: object
5
+ default: []
6
+ - name: publishConfig # This indicates where a 'Release' or 'Debug' publish is being used.
7
+ type: string
8
+ default: 'Release'
9
+
10
+ jobs:
11
+ - job: Tagging
12
+ dependsOn: ${{ parameters.jobDependencies }}
13
+ condition: and(not(failed()), not(canceled()), eq('${{ parameters.publishConfig }}', 'Release'))
14
+
15
+ variables:
16
+ # Access token for the git repository. Used by the git tag task.
17
+ - name: SYSTEM_ACCESSTOKEN
18
+ value: $(System.AccessToken)
19
+ - name: GitVersionSemVer
20
+ value: $[ dependencies.Versioning.outputs['SetGitVersionVars.GitVersionSemVer'] ]
21
+
22
+ pool:
23
+ vmImage: ${{ parameters.imageName }}
24
+
25
+ steps:
26
+ # The lines below are needed to allow the pipeline access to the
27
+ # OAuth access token that controls write access to the git repository.
28
+ # (Required for GitTag task)
29
+ - checkout: self
30
+ persistCredentials: true
31
+
32
+ # Add a tag to the git repository with the version number.
33
+ - task: ATP.ATP-GitTag.GitTag.GitTag@5
34
+ displayName: 'Tag Repo With Version Number'
35
+ inputs:
36
+ tagUser: 'Azure DevOps'
37
+ tagEmail: 'CIUser@51Degrees.com'
38
+ tag: '$(GitVersionSemVer)'
@@ -0,0 +1,71 @@
1
+ parameters:
2
+ - name: imageName # Name of the image to run the job on
3
+ - name: commonCiRef # The common-ci repo reference to checkout.
4
+ type: string
5
+ default: main
6
+ - name: project # The DevOps project executing this template.
7
+ displayName: 'Calling project is cloud or non-cloud'
8
+ type: string
9
+ default: 'non-cloud'
10
+
11
+ jobs:
12
+ - job: Versioning
13
+
14
+ pool:
15
+ vmImage: ${{ parameters.imageName }}
16
+
17
+ steps:
18
+ # The lines below are needed to allow the pipeline access to the
19
+ # OAuth access token that controls write access to the git repository.
20
+ # (Required for GitTag task)
21
+ - checkout: self
22
+ persistCredentials: true
23
+
24
+ # Checkout the common-ci repo so the GitVersion config file can
25
+ # be used.
26
+ # Special consideration is given to the Cloud project as when executing
27
+ # this template the, git url would resolve to git://Cloud/common-ci
28
+ # which is not valid.
29
+ - ${{ if eq(parameters.project, 'cloud') }}:
30
+ - checkout: 'git://Pipeline/common-ci@${{ parameters.commonCiRef }}'
31
+ - ${{ if ne(parameters.project, 'cloud') }}:
32
+ - checkout: 'git://$(System.TeamProject)/common-ci@${{ parameters.commonCiRef }}'
33
+
34
+ # NOTE: This task can be used on both Windows and Linux machine so make sure to use
35
+ # '\' instead '/', and everything is case sensitive.
36
+ - powershell: |
37
+ Write-Host "Check if $($Env:BUILD_REPOSITORY_NAME)/GitVersion.yml exists."
38
+ if ($(Test-Path $Env:BUILD_REPOSITORY_NAME/GitVersion.yml)) {
39
+ Write-Host "GitVersion.yml exists in current location."
40
+ $gitVersionPath = "$($(Get-Location).Path)/$Env:BUILD_REPOSITORY_NAME/GitVersion.yml"
41
+ } else {
42
+ Write-Host "Use GitVersion.yml in common-ci."
43
+ $gitVersionPath = "$($(Get-Location).Path)/common-ci/GitVersion.yml"
44
+ }
45
+ Write-Host "# Using GitVersion.yml at $gitVersionPath"
46
+ Write-Host "##vso[task.setvariable variable=GitVersionPath]$gitVersionPath"
47
+ name: SetGitVersionPath
48
+ displayName: 'Determine GitVersion.yml file to use.'
49
+
50
+ # GitVersion needs to be 5.6. The standard 5.0 breaks on Ubuntu 20.
51
+ - task: gitversion/setup@0
52
+ inputs:
53
+ versionSpec: '5.6.0'
54
+
55
+ - task: gitversion/execute@0
56
+ inputs:
57
+ preferBundledVersion: true
58
+ # As two repos have been checked out, the default path will not
59
+ # work. So it is specified here.
60
+ targetPath: '$(Build.Repository.LocalPath)/$(Build.Repository.Name)'
61
+ useConfigFile: true
62
+ configFilePath: '$(GitVersionPath)'
63
+ failOnStderr: true
64
+
65
+ - powershell: |
66
+ Write-Host "##vso[task.setvariable variable=GitVersionSemVer;isOutput=true]$(GitVersion.SemVer)"
67
+ Write-Host "##vso[task.setvariable variable=GitVersionNuGetVer;isOutput=true]$(GitVersion.NuGetVersion)"
68
+ Write-Host "##vso[task.setvariable variable=GitVersionAssemblyVer;isOutput=true]$(GitVersion.AssemblySemVer)"
69
+ Write-Host "##vso[task.setvariable variable=GitVersionAssemblyFileVer;isOutput=true]$(GitVersion.AssemblySemFileVer)"
70
+ name: SetGitVersionVars
71
+ displayName: 'Export GitVersion variables'
@@ -0,0 +1,107 @@
1
+ parameters:
2
+ - name: imageName # Name of the platform to run on
3
+ - name: branchName # Name of the branch which is allowed to be published to GitHub
4
+ - name: skipTagging # True if tagging should be skipped for the repository
5
+ type: boolean
6
+ default: false
7
+
8
+ stages:
9
+ - stage: publish_github
10
+ displayName: Publish to GitHub
11
+ condition: eq(variables['build.sourceBranch'], '${{ parameters.branchName }}')
12
+ jobs:
13
+ - deployment: deploy_github
14
+ displayName: Deploy to GitHub
15
+ pool:
16
+ vmImage: ${{ parameters.imageName }}
17
+ workspace:
18
+ clean: all
19
+ environment: github
20
+ strategy:
21
+ runOnce:
22
+ deploy:
23
+ steps:
24
+
25
+ - task: DownloadSecureFile@1
26
+ displayName: 'Download ssh private key'
27
+ name: githubsshkey
28
+ inputs:
29
+ secureFile: 'gihhub-ssh-key'
30
+ retryCount: 5
31
+ steps:
32
+
33
+ - task: DownloadSecureFile@1
34
+ displayName: 'Download ssh public key'
35
+ name: githubsshkeypublic
36
+ inputs:
37
+ secureFile: 'gihhub-ssh-key-public'
38
+ retryCount: 5
39
+
40
+ - bash: |
41
+ # Copy ssh keys to expected location
42
+ mkdir ~/.ssh
43
+ mv $(githubsshkey.secureFilePath) ~/.ssh/id_rsa
44
+ mv $(githubsshkeypublic.secureFilePath) ~/.ssh/id_rsa.pub
45
+ if [ ! -f ~/.ssh/id_rsa ] && [ ! -f ~/.ssh/id_rsa ]; then
46
+ echo "Failed to obtain ssh keys."
47
+ exit 1
48
+ fi
49
+
50
+ # Have to change permissions on key files in order for SSH to work with them.
51
+ chmod 600 ~/.ssh/id_rsa
52
+ chmod 600 ~/.ssh/id_rsa.pub
53
+ export id_rsa_perm=`stat -c '%a' ~/.ssh/id_rsa`
54
+ export id_rsa_pub_perm=`stat -c '%a' ~/.ssh/id_rsa.pub`
55
+ if [ "$id_rsa_perm" != "600" ] && [ "$id_rsa_pub_perm" != "600" ]; then
56
+ echo "Failed to change permission on key files."
57
+ exit 1
58
+ fi
59
+
60
+ # Uncomment the line below to debug issues with SSH
61
+ #ssh -vT git@github.com
62
+
63
+ echo "Cloning git repository"
64
+ git clone https://a:$(System.AccessToken)@dev.azure.com/51degrees/$(System.TeamProject)/_git/$(Build.Repository.Name) source
65
+ if [ ! -d source ]; then
66
+ echo "Failed to checkout repository."
67
+ exit 1
68
+ fi
69
+
70
+ cd source
71
+
72
+ echo "Checking out branch '$(Build.SourceBranchName)'"
73
+ git checkout $(Build.SourceBranchName)
74
+ if [ $? != 0 ]; then
75
+ echo "Failed to checkout branch '$(Build.SourceBranchName)'."
76
+ exit 1
77
+ fi
78
+
79
+ echo "Adding GitHub remote"
80
+ git remote add github git@github.com:51Degrees/$(Build.Repository.Name).git
81
+ if [ $? != 0 ]; then
82
+ echo "Failed to add GitHub remote."
83
+ exit 1
84
+ fi
85
+
86
+ echo "Pushing branch '$(Build.SourceBranchName)' to GitHub"
87
+ git push github $(Build.SourceBranchName)
88
+ if [ $? != 0 ]; then
89
+ echo "Failed to push branch '$(Build.SourceBranchName)' to GitHub."
90
+ exit 1
91
+ fi
92
+ displayName: 'Push branch to Github'
93
+
94
+ - ${{ if eq(parameters.skipTagging, false) }}:
95
+ - bash: |
96
+ # Move to checkout directory in previous task.
97
+ cd source
98
+
99
+ export tagName="`git tag --points-at $(Build.SourceBranchName)`"
100
+
101
+ echo "Pushing tag '$tagName' to GitHub"
102
+ git push github $tagName
103
+ if [ $? != 0 ]; then
104
+ echo "Failed to push tag '$tagName' to GitHub."
105
+ exit 1
106
+ fi
107
+ displayName: 'Push tags to GitHub'
@@ -0,0 +1,110 @@
1
+ parameters:
2
+ - name: commonCiRef # The common-ci repo reference to checkout.
3
+ type: string
4
+ default: main
5
+ - name: releaseConfigFile # The release config file to load.
6
+ displayName: 'Release Config File'
7
+ type: string
8
+ default: release-config.json
9
+ - name: project # The DevOps project executing this template.
10
+ displayName: 'Calling project is cloud or non-cloud'
11
+ type: string
12
+ default: 'non-cloud'
13
+ - name: depTeamProjectName # The DevOps project containing the dependencies.
14
+ displayName: 'Release Config File'
15
+ type: string
16
+ default: ''
17
+ - name: prTeamProjectName # The project containing the repo to update.
18
+ displayName: 'Release Config File'
19
+ type: string
20
+ default: ''
21
+
22
+ stages:
23
+ - stage: UpdateReference
24
+ displayName: 'Update Reference'
25
+
26
+ pool:
27
+ vmImage: windows-2019
28
+
29
+ variables:
30
+ - group: CIAutomation # Required to access CI variables
31
+
32
+ jobs:
33
+ - job:
34
+
35
+ steps:
36
+ - checkout: self
37
+ submodules: recursive
38
+ persistCredentials: true
39
+
40
+ # Checkout the common-ci to access the latest release configuration.
41
+ # Special consideration is given to the Cloud project as when executing
42
+ # this template the, git url would resolve to git://Cloud/common-ci
43
+ # which is not valid.
44
+ - ${{ if eq(parameters.project, 'cloud') }}:
45
+ - checkout: 'git://Pipeline/common-ci@${{ parameters.commonCiRef }}'
46
+ - ${{ if ne(parameters.project, 'cloud') }}:
47
+ - checkout: 'git://$(System.TeamProject)/common-ci@${{ parameters.commonCiRef }}'
48
+
49
+ - task: PowerShell@2
50
+ inputs:
51
+ targetType: 'inline'
52
+ script: |
53
+ # Get the project names or IDs from parameters
54
+ $depTeamProjectName = "${{ parameters.depTeamProjectName }}"
55
+ $prTeamProjectName = "${{ parameters.prTeamProjectName }}"
56
+
57
+ # If the parameters are not set then use the default which should be
58
+ # the current project.
59
+ if(-not $depTeamProjectName -or '' -eq $depTeamProjectName){
60
+ $depTeamProjectName = "$(System.TeamProjectId)"
61
+ }
62
+
63
+ if(-not $prTeamProjectName -or '' -eq $prTeamProjectName){
64
+ $prTeamProjectName = "$(System.TeamProjectId)"
65
+ }
66
+
67
+ # Set project name variables for use in later steps
68
+ echo "##vso[task.setvariable variable=depTeamProjectName]$depTeamProjectName"
69
+ echo "##vso[task.setvariable variable=prTeamProjectName]$prTeamProjectName"
70
+ name: DefaultProjectNames
71
+
72
+ - powershell: |
73
+ # Install all modules
74
+ $Env:PSModulePath += ";$($(Get-Location).Path)\common-ci\scripts\modules"
75
+ Write-Host "Module Path: $($Env:PsModulePath)"
76
+
77
+ # Get release-config.json path
78
+ $configFile = "$($(Get-Location).Path)\common-ci\${{ parameters.releaseConfigFile }}"
79
+
80
+ # Cancel any previous builds
81
+ Write-Host ""
82
+ Write-Host "# Cancel the previous builds"
83
+ Write-Host "============================"
84
+ Write-Host "Pipeline: " + $Env:BUILD_DEFINITIONNAME
85
+ Write-Host "Branch: " + $Env:BUILD_SOURCEBRANCH
86
+ Write-Host "Current Build ID: " + $Env:BUILD_BUILDID
87
+ if (!$(Stop-PreviousBuilds `
88
+ -PipelineName $Env:BUILD_DEFINITIONNAME `
89
+ -Branch $Env:BUILD_SOURCEBRANCH `
90
+ -CurrentBuildId $Env:BUILD_BUILDID `
91
+ -TeamProjectName $(prTeamProjectName))) {
92
+ Write-Host "# ERROR: Failed to cancel the previous builds."
93
+ exit 1
94
+ }
95
+
96
+ # Update all submodule.
97
+ cd $Env:BUILD_REPOSITORY_NAME
98
+ Write-Host "# Try to update repository $Env:BUILD_REPOSITORY_NAME."
99
+ if (!$(Update-CommitPushPull `
100
+ -ConfigFile $configFile `
101
+ -DepTeamProjectName $(depTeamProjectName) `
102
+ -PrTeamProjectName $(prTeamProjectName))) {
103
+ Write-Host "# ERROR: Failed to update submodule references and package dependencies."
104
+ exit 1
105
+ }
106
+ displayName: 'Submodule trigger'
107
+ workingDirectory: $(build.sourcesDirectory)
108
+ env:
109
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
110
+ condition: and(succeeded(), eq(variables['AutomatedRelease'], 'On'))
@@ -0,0 +1,3 @@
1
+ variables:
2
+ - name: linuxImage
3
+ value: 'ubuntu-18.04'
@@ -0,0 +1,39 @@
1
+ trigger: none
2
+
3
+ pr: none
4
+
5
+ variables:
6
+ - group: CIAutomation # Required to access CI variables
7
+
8
+ stages:
9
+ - stage: Trigger_Release
10
+
11
+ jobs:
12
+ - job: Trigger_Release
13
+
14
+ pool:
15
+ vmImage: 'windows-2019'
16
+
17
+ steps:
18
+ - checkout: self
19
+ submodules: recursive
20
+ persistCredentials: true
21
+
22
+ # This step should only be triggered if 'AutomatedRelease'
23
+ # variable is set to 'On'.
24
+ - powershell: |
25
+ # Install all modules
26
+ $Env:PSModulePath += ";$($(Get-Location).Path)\scripts\modules"
27
+ Write-Host "Module Path: $($Env:PsModulePath)"
28
+
29
+ # Trigger the release
30
+ if (!$(Start-Release `
31
+ -ConfigFile "$($(Get-Location).Path)\release-config.json" `
32
+ -TeamProjectName $Env:SYSTEM_TEAMPROJECTID)) {
33
+ Write-Host "# Failed to trigger release of all apis."
34
+ exit 1
35
+ }
36
+ displayName: 'Trigger release'
37
+ env:
38
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
39
+ condition: and(succeeded(), eq(variables['AutomatedRelease'], 'On'))