fiftyone.geolocation 4.3.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.
- package/ci/common-ci/.github/labels.yml +24 -1
- package/ci/common-ci/.github/workflows/sync-labels.yml +2 -0
- package/ci/common-ci/CiTips.md +30 -1
- package/ci/common-ci/README.md +73 -12
- package/ci/common-ci/build-and-test.yml +6 -1
- package/ci/common-ci/cloud-release-config.json +51 -0
- package/ci/common-ci/dotnet/shared-extract-and-publish-packages.yml +1 -5
- package/ci/common-ci/go/shared-go-list-stage.yml +64 -0
- package/ci/common-ci/java/readme.md +15 -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 +50 -1
- package/ci/common-ci/release-config.json +47 -189
- package/ci/common-ci/scripts/azure/checkSlot.ps1 +28 -0
- package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.psm1 +12 -5
- package/ci/common-ci/scripts/modules/51DDeployModule/51DDeployModule.psm1 +66 -0
- package/ci/common-ci/scripts/modules/51DDownloadDataFileModule/51DDownloadDataFileModule.psm1 +58 -0
- package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.psm1 +8 -8
- package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.Tests.ps1 +347 -9
- package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.psm1 +285 -54
- package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.Tests.ps1 +9 -8
- package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.psm1 +30 -13
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.Tests.ps1 +342 -97
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.psm1 +36 -2
- package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/SharedVariables.psm1 +2 -2
- 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/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 +16 -3
- package/ci/common-ci/shared-create-tag-job.yml +9 -0
- 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-version-job.yml +17 -2
- package/ci/common-ci/shared-publish-github-stage.yml +54 -51
- package/ci/common-ci/shared-submodule-trigger-stage.yml +56 -4
- package/ci/shared-build-and-test-stage.yml +5 -2
- package/examples/examples.test.js +3 -3
- package/geoLocationPipelineBuilder.js +9 -16
- package/package.json +11 -7
- package/setup.js +1 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<#
|
|
2
|
+
==================== TrafficManager =====================
|
|
3
|
+
.Description
|
|
4
|
+
This module contains functions for managing the Azure Traffic Manager profiles
|
|
5
|
+
#>
|
|
6
|
+
|
|
7
|
+
# function to add or udpate a traffic manager endpoint with a type of
|
|
8
|
+
# AzureEndpoint
|
|
9
|
+
function Update-TrafficManagerAzureEndpoint {
|
|
10
|
+
|
|
11
|
+
param(
|
|
12
|
+
[Parameter(Mandatory=$true)]
|
|
13
|
+
[Object]$webapp,
|
|
14
|
+
|
|
15
|
+
[Parameter(Mandatory=$true)]
|
|
16
|
+
[string]$trafficManagerProfile,
|
|
17
|
+
|
|
18
|
+
[Parameter(Mandatory=$true)]
|
|
19
|
+
[string]$trafficManagerResourceGroup
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
$EndpointType = "AzureEndpoints"
|
|
23
|
+
|
|
24
|
+
# Get exisiting traffic manager endpoint.
|
|
25
|
+
$trafficManagerEndpoint = $null
|
|
26
|
+
try {
|
|
27
|
+
$trafficManagerEndpoint = Get-AzTrafficManagerEndpoint `
|
|
28
|
+
-Name $webapp.Name `
|
|
29
|
+
-ProfileName $trafficManagerProfile `
|
|
30
|
+
-ResourceGroupName $trafficManagerResourceGroup `
|
|
31
|
+
-Type $EndpointType `
|
|
32
|
+
-ErrorAction SilentlyContinue
|
|
33
|
+
} catch {}
|
|
34
|
+
|
|
35
|
+
# Check if traffic manager endpoint already exists.
|
|
36
|
+
if ($trafficManagerEndpoint) {
|
|
37
|
+
# If traffic manager endpoint exists then update the existing endpoint
|
|
38
|
+
# target, leave other settings the same.
|
|
39
|
+
Write-Host "Updating endpoint in traffic manager"
|
|
40
|
+
$trafficManagerEndpoint.TargetResourceId = $webapp.Id
|
|
41
|
+
|
|
42
|
+
Set-AzTrafficManagerEndpoint -TrafficManagerEndpoint $trafficManagerEndpoint
|
|
43
|
+
} else {
|
|
44
|
+
# If traffic manager endpoint does not exist then add App Service to
|
|
45
|
+
# traffic manager (as a disabled endpoint).
|
|
46
|
+
Write-Host ("Adding endpoint to traffic manager, endpoint will be added as " +
|
|
47
|
+
"disabled. The endpoint should only be enabled when the cloud "+
|
|
48
|
+
"application has been tested on the new App Service")
|
|
49
|
+
|
|
50
|
+
New-AzTrafficManagerEndpoint `
|
|
51
|
+
-Name $webapp.Name `
|
|
52
|
+
-ProfileName $trafficManagerProfile `
|
|
53
|
+
-ResourceGroupName $trafficManagerResourceGroup `
|
|
54
|
+
-Type $EndpointType `
|
|
55
|
+
-TargetResourceId $webapp.Id `
|
|
56
|
+
-EndpointStatus Disabled
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -2,6 +2,13 @@ parameters:
|
|
|
2
2
|
- name: stageDependencies
|
|
3
3
|
type: object
|
|
4
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'
|
|
5
12
|
|
|
6
13
|
stages:
|
|
7
14
|
# This stage check if current branch runs on a pull request merge branch,
|
|
@@ -26,10 +33,16 @@ stages:
|
|
|
26
33
|
- checkout: self
|
|
27
34
|
submodules: recursive
|
|
28
35
|
persistCredentials: true
|
|
29
|
-
# Check out to access the latest release info.
|
|
30
|
-
- checkout: 'git://$(System.TeamProject)/common-ci'
|
|
31
|
-
|
|
32
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
|
+
|
|
33
46
|
- powershell: |
|
|
34
47
|
# Install all modules
|
|
35
48
|
$Env:PSModulePath += ";$($(Get-Location).Path)\common-ci\scripts\modules"
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
parameters:
|
|
2
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'
|
|
3
10
|
|
|
4
11
|
jobs:
|
|
5
12
|
# Determine the version of the current commit.
|
|
6
13
|
- template: shared-git-version-job.yml
|
|
7
14
|
parameters:
|
|
8
15
|
imageName: ${{ parameters.imageName }}
|
|
16
|
+
commonCiRef: ${{ parameters.commonCiRef }}
|
|
17
|
+
project: ${{ parameters.project }}
|
|
9
18
|
|
|
10
19
|
# Tag using the version from the gitversion job
|
|
11
20
|
- template: shared-git-tag-job.yml
|
|
@@ -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()
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
parameters:
|
|
2
2
|
- name: imageName # Name of the image to run the job on
|
|
3
|
-
|
|
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
|
+
|
|
4
11
|
jobs:
|
|
5
12
|
- job: Versioning
|
|
6
13
|
|
|
@@ -16,7 +23,13 @@ jobs:
|
|
|
16
23
|
|
|
17
24
|
# Checkout the common-ci repo so the GitVersion config file can
|
|
18
25
|
# be used.
|
|
19
|
-
|
|
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 }}'
|
|
20
33
|
|
|
21
34
|
# NOTE: This task can be used on both Windows and Linux machine so make sure to use
|
|
22
35
|
# '\' instead '/', and everything is case sensitive.
|
|
@@ -52,5 +65,7 @@ jobs:
|
|
|
52
65
|
- powershell: |
|
|
53
66
|
Write-Host "##vso[task.setvariable variable=GitVersionSemVer;isOutput=true]$(GitVersion.SemVer)"
|
|
54
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)"
|
|
55
70
|
name: SetGitVersionVars
|
|
56
71
|
displayName: 'Export GitVersion variables'
|
|
@@ -38,60 +38,64 @@ stages:
|
|
|
38
38
|
retryCount: 5
|
|
39
39
|
|
|
40
40
|
- bash: |
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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)'."
|
|
57
76
|
exit 1
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
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'
|
|
92
93
|
|
|
93
94
|
- ${{ if eq(parameters.skipTagging, false) }}:
|
|
94
95
|
- bash: |
|
|
96
|
+
# Move to checkout directory in previous task.
|
|
97
|
+
cd source
|
|
98
|
+
|
|
95
99
|
export tagName="`git tag --points-at $(Build.SourceBranchName)`"
|
|
96
100
|
|
|
97
101
|
echo "Pushing tag '$tagName' to GitHub"
|
|
@@ -101,4 +105,3 @@ stages:
|
|
|
101
105
|
exit 1
|
|
102
106
|
fi
|
|
103
107
|
displayName: 'Push tags to GitHub'
|
|
104
|
-
failOnStderr: true
|
|
@@ -1,3 +1,24 @@
|
|
|
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
|
+
|
|
1
22
|
stages:
|
|
2
23
|
- stage: UpdateReference
|
|
3
24
|
displayName: 'Update Reference'
|
|
@@ -15,8 +36,38 @@ stages:
|
|
|
15
36
|
- checkout: self
|
|
16
37
|
submodules: recursive
|
|
17
38
|
persistCredentials: true
|
|
39
|
+
|
|
18
40
|
# Checkout the common-ci to access the latest release configuration.
|
|
19
|
-
|
|
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
|
|
20
71
|
|
|
21
72
|
- powershell: |
|
|
22
73
|
# Install all modules
|
|
@@ -24,7 +75,7 @@ stages:
|
|
|
24
75
|
Write-Host "Module Path: $($Env:PsModulePath)"
|
|
25
76
|
|
|
26
77
|
# Get release-config.json path
|
|
27
|
-
$configFile = "$($(Get-Location).Path)\common-ci
|
|
78
|
+
$configFile = "$($(Get-Location).Path)\common-ci\${{ parameters.releaseConfigFile }}"
|
|
28
79
|
|
|
29
80
|
# Cancel any previous builds
|
|
30
81
|
Write-Host ""
|
|
@@ -37,7 +88,7 @@ stages:
|
|
|
37
88
|
-PipelineName $Env:BUILD_DEFINITIONNAME `
|
|
38
89
|
-Branch $Env:BUILD_SOURCEBRANCH `
|
|
39
90
|
-CurrentBuildId $Env:BUILD_BUILDID `
|
|
40
|
-
-TeamProjectName $
|
|
91
|
+
-TeamProjectName $(prTeamProjectName))) {
|
|
41
92
|
Write-Host "# ERROR: Failed to cancel the previous builds."
|
|
42
93
|
exit 1
|
|
43
94
|
}
|
|
@@ -47,7 +98,8 @@ stages:
|
|
|
47
98
|
Write-Host "# Try to update repository $Env:BUILD_REPOSITORY_NAME."
|
|
48
99
|
if (!$(Update-CommitPushPull `
|
|
49
100
|
-ConfigFile $configFile `
|
|
50
|
-
-
|
|
101
|
+
-DepTeamProjectName $(depTeamProjectName) `
|
|
102
|
+
-PrTeamProjectName $(prTeamProjectName))) {
|
|
51
103
|
Write-Host "# ERROR: Failed to update submodule references and package dependencies."
|
|
52
104
|
exit 1
|
|
53
105
|
}
|
|
@@ -28,6 +28,8 @@ stages:
|
|
|
28
28
|
node_version: 12.x
|
|
29
29
|
node_14_x:
|
|
30
30
|
node_version: 14.x
|
|
31
|
+
node_16_x:
|
|
32
|
+
node_version: 16.x
|
|
31
33
|
maxParallel: 1
|
|
32
34
|
|
|
33
35
|
steps:
|
|
@@ -59,13 +61,14 @@ stages:
|
|
|
59
61
|
# in 'InternalKeys' group
|
|
60
62
|
# 2. Install dependencies.
|
|
61
63
|
# 3. Run tests.
|
|
64
|
+
# TODO: Remove specific device detection version once 4.3.3 released
|
|
62
65
|
- bash: |
|
|
63
66
|
echo "Resource key for testing = $(SuperResourceKey)"
|
|
64
67
|
export RESOURCE_KEY="$(SuperResourceKey)"
|
|
65
68
|
echo "Cloud endpoint for testing = $(FOD_CLOUD_API_URL)"
|
|
66
69
|
export FOD_CLOUD_API_URL="$(FOD_CLOUD_API_URL)"
|
|
67
70
|
npm install
|
|
68
|
-
npm install fiftyone.devicedetection
|
|
71
|
+
npm install fiftyone.devicedetection@4.3.3-beta.1
|
|
69
72
|
npm test
|
|
70
73
|
displayName: 'Build and Test'
|
|
71
74
|
|
|
@@ -105,7 +108,7 @@ stages:
|
|
|
105
108
|
echo $eslint
|
|
106
109
|
echo $eslint > .eslintrc
|
|
107
110
|
npm install -g eslint@6.8.0
|
|
108
|
-
eslint **/*.js
|
|
111
|
+
eslint '**/*.js'
|
|
109
112
|
displayName: "Set up and run eslint"
|
|
110
113
|
condition: ne(variables['node_version'], '6.x')
|
|
111
114
|
failOnStderr: true
|
|
@@ -61,17 +61,17 @@ try {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (isAsync) {
|
|
64
|
-
test('cloud getting started', (done) => {
|
|
64
|
+
test('cloud getting started', async (done) => {
|
|
65
65
|
setTimeout(done, 1000);
|
|
66
66
|
|
|
67
67
|
testExample({ file: (__dirname) + '/gettingStarted.js' });
|
|
68
68
|
});
|
|
69
|
-
test('combining services', (done) => {
|
|
69
|
+
test('combining services', async (done) => {
|
|
70
70
|
setTimeout(done, 1000);
|
|
71
71
|
|
|
72
72
|
testExample({ file: (__dirname) + '/combiningServices.js' });
|
|
73
73
|
});
|
|
74
|
-
test('configure from file', (done) => {
|
|
74
|
+
test('configure from file', async (done) => {
|
|
75
75
|
setTimeout(done, 1000);
|
|
76
76
|
|
|
77
77
|
testExample({ file: (__dirname) + '/configureFromFile.js' });
|
|
@@ -20,14 +20,6 @@
|
|
|
20
20
|
* such notice(s) shall fulfill the requirements of that article.
|
|
21
21
|
* ********************************************************************* */
|
|
22
22
|
|
|
23
|
-
const require51 = (requestedPackage) => {
|
|
24
|
-
try {
|
|
25
|
-
return require(__dirname + '/../' + requestedPackage);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
return require(requestedPackage);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
23
|
const GeoLocationCloud = require('./geoLocationCloud');
|
|
32
24
|
const CloudRequestEngine = require('fiftyone.pipeline.cloudrequestengine').CloudRequestEngine;
|
|
33
25
|
const PipelineBuilder = require('fiftyone.pipeline.core').PipelineBuilder;
|
|
@@ -40,16 +32,17 @@ class GeoLocationPipelineBuilder extends PipelineBuilder {
|
|
|
40
32
|
* @param {Boolean} options.shareUsage // include share usage element?
|
|
41
33
|
* @param {String} options.resourceKey // resourceKey for cloud
|
|
42
34
|
* @param {String} options.locationProvider // the provider to request data from. Either "fiftyonedegrees" or "digitalelement".
|
|
43
|
-
* @param {string} options.cloudRequestOrigin The value to set the
|
|
35
|
+
* @param {string} options.cloudRequestOrigin The value to set the
|
|
44
36
|
* Origin header to when making requests to the cloud service
|
|
45
37
|
*
|
|
46
38
|
*/
|
|
47
|
-
constructor ({
|
|
48
|
-
shareUsage = true,
|
|
49
|
-
resourceKey = null,
|
|
50
|
-
locationProvider = 'fiftyonedegrees',
|
|
39
|
+
constructor ({
|
|
40
|
+
shareUsage = true,
|
|
41
|
+
resourceKey = null,
|
|
42
|
+
locationProvider = 'fiftyonedegrees',
|
|
51
43
|
baseURL = null,
|
|
52
|
-
cloudRequestOrigin = null
|
|
44
|
+
cloudRequestOrigin = null
|
|
45
|
+
}) {
|
|
53
46
|
super(...arguments);
|
|
54
47
|
|
|
55
48
|
// Check if share usage enabled and add it to the pipeline if so
|
|
@@ -60,9 +53,9 @@ class GeoLocationPipelineBuilder extends PipelineBuilder {
|
|
|
60
53
|
|
|
61
54
|
// First we need the cloudRequestEngine
|
|
62
55
|
|
|
63
|
-
const cloudRequestEngineOptions = {
|
|
56
|
+
const cloudRequestEngineOptions = {
|
|
64
57
|
resourceKey: resourceKey,
|
|
65
|
-
cloudRequestOrigin: cloudRequestOrigin
|
|
58
|
+
cloudRequestOrigin: cloudRequestOrigin
|
|
66
59
|
};
|
|
67
60
|
if (baseURL !== null) {
|
|
68
61
|
cloudRequestEngineOptions.baseURL = baseURL;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiftyone.geolocation",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "Geo-location services for the 51Degrees Pipeline API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"Joseph Dix <joseph@51degrees.com> (https://51degrees.com)"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"fiftyone.pipeline.cloudrequestengine": "^4.3.
|
|
21
|
-
"fiftyone.pipeline.core": "^4.3.
|
|
22
|
-
"fiftyone.pipeline.engines": "^4.3.
|
|
23
|
-
"fiftyone.pipeline.engines.fiftyone": "^4.3.
|
|
20
|
+
"fiftyone.pipeline.cloudrequestengine": "^4.3.5",
|
|
21
|
+
"fiftyone.pipeline.core": "^4.3.5",
|
|
22
|
+
"fiftyone.pipeline.engines": "^4.3.5",
|
|
23
|
+
"fiftyone.pipeline.engines.fiftyone": "^4.3.5"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^15.12.2",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"eslint-plugin-node": "^11.1.0",
|
|
31
31
|
"eslint-plugin-promise": "^4.2.1",
|
|
32
32
|
"eslint-plugin-standard": "^4.0.1",
|
|
33
|
-
"jest": "^
|
|
33
|
+
"jest": "^27.0.6",
|
|
34
34
|
"jest-expect-message": "^1.0.2",
|
|
35
35
|
"jest-junit": "^9.0.0"
|
|
36
36
|
},
|
|
@@ -42,7 +42,11 @@
|
|
|
42
42
|
"outputName": "test_results.xml"
|
|
43
43
|
},
|
|
44
44
|
"jest": {
|
|
45
|
-
"
|
|
45
|
+
"testRunner": "jest-jasmine2",
|
|
46
|
+
"setupFilesAfterEnv": [
|
|
47
|
+
"./setup.js",
|
|
48
|
+
"jest-expect-message"
|
|
49
|
+
],
|
|
46
50
|
"globals": {
|
|
47
51
|
"resourceKey": "!!YOUR_RESOURCE_KEY!!"
|
|
48
52
|
}
|
package/setup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jest.setTimeout(10000); // in milliseconds
|