Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/data-file-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
data-key: ${{ secrets.DEVICE_DETECTION_KEY }}
data-url: ${{ secrets.DEVICE_DETECTION_URL }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/example-assets-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ jobs:
with:
repo-name: ${{ github.event.repository.name }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/monthly-copyright-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ jobs:
repo-name: ${{ github.event.repository.name }}
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
37 changes: 5 additions & 32 deletions .github/workflows/nightly-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
data-key: ${{ secrets.DEVICE_DETECTION_KEY }}
data-url: ${{ secrets.DEVICE_DETECTION_URL }}
secrets: inherit

PackageUpdate:
name: Nightly Package Update
Expand All @@ -34,8 +31,7 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit

SubmoduleUpdate:
name: Nightly Submodule Update
Expand All @@ -45,8 +41,7 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit

PullRequests:
if: ${{ !cancelled() }}
Expand All @@ -59,13 +54,7 @@ jobs:
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
DeviceDetectionUrl: ${{ secrets.DEVICE_DETECTION_URL }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
secrets: inherit

Publish:
if: ${{ !cancelled() }}
Expand All @@ -78,20 +67,4 @@ jobs:
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
DeviceDetectionUrl: ${{ secrets.DEVICE_DETECTION_URL }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
MavenSettings: ${{ secrets.MAVEN_SETTINGS }}
JavaGpgKeyPassphrase: ${{ secrets.JAVA_GPG_KEY_PASSPHRASE }}
JavaPGP: ${{ secrets.JAVA_KEY_PGP_FILE }}
CodeSigningKeyVaultName: ${{ secrets.CODE_SIGNING_KEY_VAULT_NAME }}
CodeSigningKeyVaultUrl: ${{ secrets.CODE_SIGNING_KEY_VAULT_URL }}
CodeSigningKeyVaultClientId: ${{ secrets.CODE_SIGNING_KEY_VAULT_CLIENT_ID }}
CodeSigningKeyVaultTenantId: ${{ secrets.CODE_SIGNING_KEY_VAULT_TENANT_ID }}
CodeSigningKeyVaultClientSecret: ${{ secrets.CODE_SIGNING_KEY_VAULT_CLIENT_SECRET }}
CodeSigningKeyVaultCertificateName: ${{ secrets.CODE_SIGNING_KEY_VAULT_CERTIFICATE_NAME }}
CodeSigningKeyVaultCertificateData: ${{ secrets.CODE_SIGNING_KEY_VAULT_CERTIFICATE_DATA }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/package-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
18 changes: 1 addition & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,4 @@ jobs:
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
DeviceDetectionUrl: ${{ secrets.DEVICE_DETECTION_URL }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
MavenSettings: ${{ secrets.MAVEN_SETTINGS }}
JavaGpgKeyPassphrase: ${{ secrets.JAVA_GPG_KEY_PASSPHRASE }}
JavaPGP: ${{ secrets.JAVA_KEY_PGP_FILE }}
CodeSigningKeyVaultName: ${{ secrets.CODE_SIGNING_KEY_VAULT_NAME }}
CodeSigningKeyVaultUrl: ${{ secrets.CODE_SIGNING_KEY_VAULT_URL }}
CodeSigningKeyVaultClientId: ${{ secrets.CODE_SIGNING_KEY_VAULT_CLIENT_ID }}
CodeSigningKeyVaultTenantId: ${{ secrets.CODE_SIGNING_KEY_VAULT_TENANT_ID }}
CodeSigningKeyVaultClientSecret: ${{ secrets.CODE_SIGNING_KEY_VAULT_CLIENT_SECRET }}
CodeSigningKeyVaultCertificateName: ${{ secrets.CODE_SIGNING_KEY_VAULT_CERTIFICATE_NAME }}
CodeSigningKeyVaultCertificateData: ${{ secrets.CODE_SIGNING_KEY_VAULT_CERTIFICATE_DATA }}
secrets: inherit
8 changes: 1 addition & 7 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@ jobs:
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
cache-assets: true
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
DeviceDetection: ${{ secrets.DEVICE_DETECTION_KEY }}
DeviceDetectionUrl: ${{ secrets.DEVICE_DETECTION_URL }}
IpIntelligence: ${{ secrets.IP_INTELLIGENCE_KEY }}
IpIntelligenceUrl: ${{ secrets.IPI_DATA_FILE_URL }}
TestResourceKey: ${{ secrets._51DEGREES_RESOURCE_KEY_BESPOKE }}
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/submodule-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ jobs:
org-name: ${{ github.event.repository.owner.login }}
dryrun: ${{ inputs.dryrun || false }}
common-ci-ref: ${{ inputs.common-ci-ref || '' }}
secrets:
token: ${{ secrets.ACCESS_TOKEN }}
secrets: inherit
18 changes: 10 additions & 8 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ repositories used to do for one package tree each.

## Secrets

The workflows pass the secrets to the shared workflows with
`secrets: inherit`, and each job exports the secrets it uses under their own
names. The signing secrets reach only the job that builds the packages, and
`MAVEN_SETTINGS` only the job that publishes.

Required:

- `ACCESS_TOKEN`: GitHub
- `CI_ACCESS_TOKEN`: GitHub
[access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#about-personal-access-tokens)
for cloning repositories and creating pull requests.

To run the on-premise tests:

- `DEVICE_DETECTION_KEY`: [license key](https://51degrees.com/pricing?utm_source=github&utm_medium=readme&utm_campaign=51degrees-java&utm_content=ci-readme.md&utm_term=secrets)
for the Device Detection TAC data file and the data file update example.
- `IP_INTELLIGENCE_KEY`: license key for the IP Intelligence Enterprise data
file.
- `IPI_DATA_FILE_URL`: URL of the IP Intelligence Enterprise data file. The
IP Intelligence examples and benchmark are skipped without it.
- `DEVICE_DETECTION_URL` (optional): URL of the Device Detection TAC data file.
- `LICENSE_KEY_V4TAC_IPIV4ENTERPRISE`: [license key](https://51degrees.com/pricing?utm_source=github&utm_medium=readme&utm_campaign=51degrees-java&utm_content=ci-readme.md&utm_term=secrets)
for the Device Detection TAC and IP Intelligence Enterprise data files and
the data file update example, which common-ci gives the steps that need it
as `_51DEGREES_LICENSE_KEY`.

To run the cloud tests:

Expand Down
13 changes: 2 additions & 11 deletions ci/build-package.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
param(
[Parameter(Mandatory)][string]$RepoName,
[Parameter(Mandatory)][string]$Version,
[Parameter(Mandatory)][Hashtable]$Keys,
[string]$Name
)
$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -39,20 +38,12 @@ $examples = foreach ($package in $Packages | Where-Object { -not $_.Publish }) {
# tree, the examples included, so the whole repository carries the version
# being released. The publishing plugin writes the one bundle for the whole
# reactor under the first tree that publishes, and common-ci finds it there.
# It reads the signing keys from the environment of the job that signs.
./java/build-package.ps1 `
-RepoName $RepoName `
-Name $Name `
-Version $Version `
-VersionPaths $Packages.Path `
-ExtraArgs "-DskipNativeBuild=true", "-pl", ($examples -join ',') `
-JavaGpgKeyPassphrase $Keys['JavaGpgKeyPassphrase'] `
-JavaPGP $Keys['JavaPGP'] `
-CodeSigningKeyVaultName: $Keys['CodeSigningKeyVaultName'] `
-CodeSigningKeyVaultUrl $Keys['CodeSigningKeyVaultUrl'] `
-CodeSigningKeyVaultClientId $Keys['CodeSigningKeyVaultClientId'] `
-CodeSigningKeyVaultTenantId $Keys['CodeSigningKeyVaultTenantId'] `
-CodeSigningKeyVaultClientSecret $Keys['CodeSigningKeyVaultClientSecret'] `
-CodeSigningKeyVaultCertificateName $Keys['CodeSigningKeyVaultCertificateName'] `
-CodeSigningKeyVaultCertificateData $Keys['CodeSigningKeyVaultCertificateData']
-ExtraArgs "-DskipNativeBuild=true", "-pl", ($examples -join ',')

exit $LASTEXITCODE
16 changes: 7 additions & 9 deletions ci/fetch-assets.ps1
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
param (
[string]$DeviceDetection,
[string]$DeviceDetectionUrl,
[string]$IpIntelligence,
[string]$IpIntelligenceUrl
)
$ErrorActionPreference = "Stop"

# common-ci's step downloads the TAC and Enterprise data files from the
# Distributor with the license key in _51DEGREES_LICENSE_KEY, which it
# exports before this runs.

# Tests and examples find data files by searching below the repository root,
# so every asset is linked into the folders of the data repository, which is
# the data submodule of cxx.
$data = "$PSScriptRoot/../cxx/data"
$deviceDetectionData = "$data/device-detection"
$ipIntelligenceData = "$data/ip-intelligence"

$deviceDetectionAssets = 'TAC-HashV41.hash', '51Degrees-LiteV4.1.hash', '20000 Evidence Records.yml', '20000 User Agents.csv'
./steps/fetch-assets.ps1 -DeviceDetection:$DeviceDetection -DeviceDetectionUrl:$DeviceDetectionUrl -Assets $deviceDetectionAssets
$deviceDetectionAssets = 'TAC-HashV41.hash', '51Degrees-LiteV4.1.hash', '20000 Evidence Records.yml'
./steps/fetch-assets.ps1 -Assets $deviceDetectionAssets
foreach ($asset in $deviceDetectionAssets) {
New-Item -ItemType SymbolicLink -Force -Target "$PWD/assets/$asset" -Path "$deviceDetectionData/$asset"
}

./steps/fetch-assets.ps1 -IpIntelligence:$IpIntelligence -IpIntelligenceUrl:$IpIntelligenceUrl -Assets '51Degrees-EnterpriseIpiV41.ipi', '51Degrees-LiteIpiV41.ipi', '51Degrees-IPIV4AsnIpiV41.ipi'
./steps/fetch-assets.ps1 -Assets '51Degrees-EnterpriseIpiV41.ipi', '51Degrees-LiteIpiV41.ipi', '51Degrees-IPIV4AsnIpiV41.ipi'
New-Item -ItemType SymbolicLink -Force -Target "$PWD/assets/51Degrees-EnterpriseIpiV41.ipi" -Path "$ipIntelligenceData/51Degrees-EnterpriseIpiV41.ipi"
# The asset is fetched under the blob name, but the tests, DataFileHelper and
# the data repository scripts use the unpacked name 51Degrees-LiteV41.ipi, so
Expand Down
6 changes: 3 additions & 3 deletions ci/publish-package.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
param(
[Parameter(Mandatory)][string]$RepoName,
[Parameter(Mandatory)][string]$Version,
[Parameter(Mandatory)][Hashtable]$Keys,
[bool]$DryRun = $false
)

# Uploads the one publishing bundle build-package.ps1 made, which holds the
# packages of every tree that publishes.
./java/publish-package-maven.ps1 -RepoName $RepoName -MavenSettings $Keys['MavenSettings'] -Version $Version -DryRun $DryRun
# packages of every tree that publishes. common-ci's script reads the Central
# Portal token from the environment of the job that publishes.
./java/publish-package-maven.ps1 -RepoName $RepoName -Version $Version -DryRun $DryRun

exit $LASTEXITCODE
23 changes: 10 additions & 13 deletions ci/run-integration-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ param(
[string]$Name,
# Set by the publish workflow to the version it built and installed. Not
# set when a pull request is tested, which builds the reactor itself.
[string]$Version,
[string]$TestResourceKey,
[string]$DeviceDetection,
[string]$IpIntelligence,
[string]$IpIntelligenceUrl
[string]$Version
)
$ErrorActionPreference = "Stop"

# The shared workflow exports each secret under its own name before this runs.
# The tests take the resource key that carries every property, and the data
# license, which the Enterprise data files were fetched with.
$TestResourceKey = $env:_51DEGREES_RESOURCE_KEY_BESPOKE
$LicenseKey = $env:_51DEGREES_LICENSE_KEY

# Each part's exit code is checked below, so one failing part does not stop
# the others from running.
$PSNativeCommandUseErrorActionPreference = $false
Expand Down Expand Up @@ -48,16 +51,10 @@ Write-Host "::endgroup::"
# against the reactor, so they are run here only against a published version.
if ($Version) {
$examples = @(
@{ Path = 'examples/device-detection'; LicenseKey = $DeviceDetection; Run = $true }
# The IP Intelligence examples need the Enterprise data file, which is
# only fetched when its URL is given.
@{ Path = 'examples/ip-intelligence'; LicenseKey = $IpIntelligence; Run = [bool]$IpIntelligenceUrl }
@{ Path = 'examples/device-detection'; LicenseKey = $LicenseKey }
@{ Path = 'examples/ip-intelligence'; LicenseKey = $LicenseKey }
)
foreach ($example in $examples) {
if (-not $example.Run) {
Write-Host "::warning title=Examples skipped::Skipping '$($example.Path)', as IpIntelligenceUrl was not provided."
continue
}
Write-Host "::group::$($example.Path) against $Version"
Push-Location "$RepoName/$($example.Path)"
try {
Expand Down
13 changes: 3 additions & 10 deletions ci/run-performance-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ param(
[Parameter(Mandatory)][string]$Name,
# Set by the publish workflow to the version it built and installed. Not
# set when a pull request is tested, which builds the reactor itself.
[string]$Version,
[string]$IpIntelligenceUrl
[string]$Version
)
$ErrorActionPreference = "Stop"
# Each product's exit code is checked below, so one failing product does not
Expand Down Expand Up @@ -103,25 +102,19 @@ $benchmarks = @(
Output = 'console/target/surefire-reports/fiftyone.devicedetection.examples.console.PerformanceBenchmarkTest-output.txt'
ProfileHeader = "MaxPerformance AllProperties: (true|false), performanceGraph: (true|false), predictiveGraph (true|false)"
ProfileName = 'MaxPerformance-false-true-false'
Run = $true
}
# Measured with the Enterprise data file, which fetch-assets.ps1 fetched
# with the data license.
@{
Product = 'IpIntelligence'
Path = 'examples/ip-intelligence'
Output = 'console/target/surefire-reports/fiftyone.ipintelligence.examples.console.PerformanceBenchmarkTest-output.txt'
ProfileHeader = "MaxPerformance AllProperties: (true|false)"
ProfileName = 'MaxPerformance-false'
# Measured with the Enterprise data file, which is only fetched when
# its URL is given.
Run = [bool]$IpIntelligenceUrl
}
)

foreach ($benchmark in $benchmarks) {
if (-not $benchmark.Run) {
Write-Host "::warning title=Performance skipped::Skipping the $($benchmark.Product) benchmark, as IpIntelligenceUrl was not provided."
continue
}
Write-Host "::group::$($benchmark.Product)"
Push-Location "$RepoName/$($benchmark.Path)"
try {
Expand Down
12 changes: 8 additions & 4 deletions ci/run-unit-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
param(
[Parameter(Mandatory)][string]$RepoName,
[string]$Name,
[string]$TestResourceKey,
[string]$DeviceDetection
[string]$Name
)
$ErrorActionPreference = "Stop"

# The shared workflow exports each secret under its own name before this runs.
# The tests take the resource key that carries every property, and the data
# license.
$TestResourceKey = $env:_51DEGREES_RESOURCE_KEY_BESPOKE
$LicenseKey = $env:_51DEGREES_LICENSE_KEY

# One run of every test in the reactor that build-project.ps1 built, the
# examples included. common-ci runs Surefire from the root, copies the reports
# of every module at any depth into test-results/unit, leaving out the example
Expand All @@ -18,7 +22,7 @@ $ErrorActionPreference = "Stop"
'-Pdev'
"-DTestResourceKey=$TestResourceKey"
"-DSuperResourceKey=$TestResourceKey"
"-DLicenseKey=$DeviceDetection"
"-DLicenseKey=$LicenseKey"
)

exit $LASTEXITCODE
Loading