diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index efd769a75b..82829f4875 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1462,7 +1462,7 @@ function CreateDevEnv { } if ($settings.versioningStrategy -eq -1) { - if ($kind -eq "cloud") { throw "Versioningstrategy -1 cannot be used on cloud" } + if ($kind -eq "cloud") { throw "versioningStrategy -1 cannot be used on cloud" } $artifactVersion = [Version]$settings.artifact.Split('/')[4] $runAlPipelineParams += @{ "appVersion" = "$($artifactVersion.Major).$($artifactVersion.Minor)" @@ -1471,13 +1471,24 @@ function CreateDevEnv { } } else { + $appBuild = 0 + $appRevision = 0 if (($settings.versioningStrategy -band 16) -eq 16) { + # For versioningStrategy +16, the version number is taken from repoVersion setting + $repoVersion = [System.Version]$settings.repoVersion + if (($settings.versioningStrategy -band 15) -eq 3) { + # For versioning strategy 3, we need to get the build number from repoVersion setting + if ($repoVersion.Build -eq -1) { + Write-Host "WARNING: RepoVersion setting only contains Major.Minor version. When using versioningStrategy 3, it should contain 3 digits" + } + else { + $appBuild = $repoVersion.Build + } + } $runAlPipelineParams += @{ - "appVersion" = $settings.repoVersion + "appVersion" = "$($repoVersion.Major).$($repoVersion.Minor)" } } - $appBuild = 0 - $appRevision = 0 switch ($settings.versioningStrategy -band 15) { 2 { # USE DATETIME diff --git a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 index f459532cda..52d0cd6e6c 100644 --- a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 +++ b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 @@ -26,7 +26,7 @@ $settings = $env:Settings | ConvertFrom-Json if ($versionNumber.StartsWith('+')) { # Handle incremental version number $allowedIncrementalVersionNumbers = @('+1', '+0.1') - if ($settings.versioningStrategy -eq 3) { + if (($settings.versioningStrategy -band 15) -eq 3) { # Allow increment build $allowedIncrementalVersionNumbers += '+0.0.1' } @@ -38,7 +38,7 @@ else { # Handle absolute version number $versionNumberFormat = '^\d+\.\d+$' # Major.Minor $correctFormatMsg = 'Major.Minor (e.g. 1.0 or 1.2)' - if ($settings.versioningStrategy -eq 3) { + if (($settings.versioningStrategy -band 15) -eq 3) { $versionNumberFormat = '^\d+\.\d+\.\d+$' # Major.Minor.Build $correctFormatMsg = 'Major.Minor.Build (e.g. 1.0, 1.2 or 1.2.3)' } diff --git a/Actions/RunPipeline/RunPipeline.ps1 b/Actions/RunPipeline/RunPipeline.ps1 index 9593f33b31..b039bdfebd 100644 --- a/Actions/RunPipeline/RunPipeline.ps1 +++ b/Actions/RunPipeline/RunPipeline.ps1 @@ -310,8 +310,18 @@ try { $appRevision = $artifactVersion.Revision } elseif (($settings.versioningStrategy -band 16) -eq 16) { + # For versioningStrategy +16, the version number is taken from repoVersion setting + $repoVersion = [System.Version]$settings.repoVersion + if (($settings.versioningStrategy -band 15) -eq 3) { + # For versioning strategy 3, we need to get the build number from repoVersion setting + $appBuild = $repoVersion.Build + if ($appBuild -eq -1) { + Write-Warning "RepoVersion setting only contains Major.Minor version. When using versioningStrategy 3, it should contain 3 digits" + $appBuild = 0 + } + } $runAlPipelineParams += @{ - "appVersion" = $settings.repoVersion + "appVersion" = "$($repoVersion.Major).$($repoVersion.Minor)" } } diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 609ba6b45e..3c7cd00000 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,8 +1,9 @@ ### Issues +- Issue 2055 When using versioningStrategy 3+16, you get an error when building - AL-Go repositories with large amounts of projects may run into issues with too large environment variables -## AL-Go Telemetry updates +### AL-Go Telemetry updates AL-Go telemetry now includes test results so you can more easily see how many AL tests, Page Scripting tests and BCPT tests ran in your workflows across all your repositories. Documentation for this can be found on [this article](https://github.com/microsoft/AL-Go/blob/main/Scenarios/EnablingTelemetry.md) on enabling telemetry. diff --git a/Scenarios/settings.md b/Scenarios/settings.md index 193e548780..c650107348 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -37,7 +37,7 @@ When running a workflow or a local script, the settings are applied by reading s | Name | Description | Default value | | :-- | :-- | :-- | | country | Specifies which country this app is built against. | us | -| repoVersion | RepoVersion is the project version number. The Repo Version number consists of \.\ only and is used for naming build artifacts in the CI/CD workflow. Build artifacts are named **\-Apps-\.\.\** and can contain multiple apps. The Repo Version number is used as major.minor for individual apps if versioningStrategy is +16. | 1.0 | +| repoVersion | RepoVersion is the project version number. The Repo Version number consists of \.\ (or \.\.\ when versioningStrategy is 3 or 3+16) and is used for naming build artifacts in the CI/CD workflow. Build artifacts are named **\-Apps-\.\.\** and can contain multiple apps. The Repo Version number is used as major.minor for individual apps if versioningStrategy is +16. | 1.0 | | projectName | Friendly name for an AL-Go project to be used in the UI for various workflows (CICD, Pull Request Build, etc.). If not set, the name for the project will be the relative path from the root of the repository. | '' | | appFolders | appFolders should be an array of folders (relative to project root), which contains apps for this project. Apps in these folders are sorted based on dependencies and built and published in that order.
If appFolders are not specified, AL-Go for GitHub will try to locate appFolders in the root of the project. | [ ] | | testFolders | testFolders should be an array of folders (relative to project root), which contains test apps for this project. Apps in these folders are sorted based on dependencies and built, published and tests are run in that order.
If testFolders are not specified, AL-Go for GitHub will try to locate testFolders in the root of the project. | [ ] | @@ -95,7 +95,7 @@ The repository settings are only read from the repository settings file (.github | updateDependencies | Setting updateDependencies to true causes AL-Go to build your app against the first compatible Business Central build and set the dependency version numbers in the app.json accordingly during build. All version numbers in the built app will be set to the version number used during compilation.
⚠️ **Warning:** When the `updateDependencies` setting is enabled, the application versions from the BC Artifact are stamped into the `app.json`. However, not all app versions available in BC Artifacts are shipped in BC SaaS, which can lead to dependency resolution failures during AppSource validation. Therefore, it is not recommended to use this setting if you intend on deploying the build to AppSource. | false | | generateDependencyArtifact | When this repository setting is true, CI/CD pipeline generates an artifact with the external dependencies used for building the apps in this repo. | false | | companyName | Company name selected in the database, used for running the CI/CD workflow. Default is to use the default company in the selected Business Central localization. | | -| versioningStrategy | The versioning strategy determines how versioning is performed in this project. The version number of an app consists of 4 segments: **Major**.**Minor**.**Build**.**Revision**. **Major** and **Minor** are read from the app.json file for each app. **Build** and **Revision** are calculated. Currently 3 versioning strategies are supported:
**0** = **Build** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** for the CI/CD workflow, increased by the **runNumberOffset** setting value (if specified). **Revision** is the **github [run_attempt](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** subtracted 1.
**2** = **Build** is the current date as **yyyyMMdd**. **Revision** is the current time as **hhmmss**. Date and time are always **UTC** timezone to avoid problems during daylight savings time change. Note that if two CI/CD workflows are started within the same second, this could yield to identical version numbers from two different runs.
**3** = **Build** is taken from **app.json** (like Major and Minor) and **Revision** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** of the workflow run
**15** = **Build** is max value and **Revision** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** of the workflow run. **Note**: use this strategy with caution. We recommend using it only when producing non-official artifacts (e.g. from PR builds or test workflows).
**+16** use **repoVersion** setting as **appVersion** for all apps | 0 | +| versioningStrategy | The versioning strategy determines how versioning is performed in this project. The version number of an app consists of 4 segments: **Major**.**Minor**.**Build**.**Revision**. **Major** and **Minor** are read from the app.json file for each app. **Build** and **Revision** are calculated. Currently 3 versioning strategies are supported:
**0** = **Build** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** for the CI/CD workflow, increased by the **runNumberOffset** setting value (if specified). **Revision** is the **github [run_attempt](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** subtracted 1.
**2** = **Build** is the current date as **yyyyMMdd**. **Revision** is the current time as **hhmmss**. Date and time are always **UTC** timezone to avoid problems during daylight savings time change. Note that if two CI/CD workflows are started within the same second, this could yield to identical version numbers from two different runs.
**3** = **Build** is taken from **app.json** (like Major and Minor) and **Revision** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** of the workflow run
**15** = **Build** is max value and **Revision** is the **github [run_number](https://go.microsoft.com/fwlink/?linkid=2217416&clcid=0x409)** of the workflow run. **Note**: use this strategy with caution. We recommend using it only when producing non-official artifacts (e.g. from PR builds or test workflows).

**+16** when adding 16 to the above versioning strategies, all builds will use **repoVersion** setting instead of the *Major.Minor* found inside app.json (and also *build* if versioningStrategy is 3+16) | 0 | | additionalCountries | This property can be set to an additional number of countries to compile, publish and test your app against during workflows. Note that this setting can be different in NextMajor and NextMinor workflows compared to the CI/CD workflow, by specifying a different value in a workflow settings file. | [ ] | | keyVaultName | When using Azure KeyVault for the secrets used in your workflows, the KeyVault name needs to be specified in this setting if it isn't specified in the AZURE_CREDENTIALS secret. Read [this](UseAzureKeyVault.md) for more information. | | | licenseFileUrlSecretName | Specify the name (**NOT the secret**) of the LicenseFileUrl secret. Default is LicenseFileUrl. AL-Go for GitHub will look for a secret with this name in GitHub Secrets or Azure KeyVault to use as LicenseFileUrl. A LicenseFileUrl is required when building AppSource apps for Business Central prior to version 22. Read [this](SetupCiCdForExistingAppSourceApp.md) for more information. | LicenseFileUrl |