Skip to content

Commit

Permalink
Deploying AL-Go from main (91a563be484eeff8ccde7f39b3622991cc8931f0) …
Browse files Browse the repository at this point in the history
…to main (#37)

Deploying AL-Go from main (91a563be484eeff8ccde7f39b3622991cc8931f0) to
main

Co-authored-by: microsoft <[email protected]>
  • Loading branch information
bcbuild-github-agent and microsoft authored Oct 17, 2023
1 parent 01fbe1e commit f33f8f6
Show file tree
Hide file tree
Showing 21 changed files with 186 additions and 157 deletions.
35 changes: 19 additions & 16 deletions .AL-Go/cloudDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@ Param(
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0

try {
$webClient = New-Object System.Net.WebClient
$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore)
$webClient.Encoding = [System.Text.Encoding]::UTF8
Write-Host "Downloading GitHub Helper module"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v3.3/Github-Helper.psm1', $GitHubHelperPath)
Write-Host "Downloading AL-Go Helper script"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v3.3/AL-Go-Helper.ps1', $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local

$baseFolder = GetBaseFolder -folder $PSScriptRoot
$project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot

Clear-Host
Write-Host
Write-Host -ForegroundColor Yellow @'
Expand All @@ -40,7 +24,26 @@ Write-Host -ForegroundColor Yellow @'
'@

$webClient = New-Object System.Net.WebClient
$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore)
$webClient.Encoding = [System.Text.Encoding]::UTF8
$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v4.0/Github-Helper.psm1'
Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath)
$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v4.0/AL-Go-Helper.ps1'
Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local

$baseFolder = GetBaseFolder -folder $PSScriptRoot
$project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot

Write-Host @'
This script will create a cloud based development environment (Business Central SaaS Sandbox) for your project.
All apps and test apps will be compiled and published to the environment in the development scope.
The script will also modify launch.json to have a "Cloud Sandbox (<name>)" configuration point to your environment.
Expand Down
43 changes: 23 additions & 20 deletions .AL-Go/localDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,13 @@ Param(
[string] $auth = "",
[pscredential] $credential = $null,
[string] $licenseFileUrl = "",
[string] $insiderSasToken = "",
[switch] $fromVSCode
[switch] $fromVSCode,
[switch] $accept_insiderEula
)

$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0

try {
$webClient = New-Object System.Net.WebClient
$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore)
$webClient.Encoding = [System.Text.Encoding]::UTF8
Write-Host "Downloading GitHub Helper module"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v3.3/Github-Helper.psm1', $GitHubHelperPath)
Write-Host "Downloading AL-Go Helper script"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v3.3/AL-Go-Helper.ps1', $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local

$baseFolder = GetBaseFolder -folder $PSScriptRoot
$project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot

Clear-Host
Write-Host
Write-Host -ForegroundColor Yellow @'
Expand All @@ -43,7 +27,26 @@ Write-Host -ForegroundColor Yellow @'
'@

$webClient = New-Object System.Net.WebClient
$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore)
$webClient.Encoding = [System.Text.Encoding]::UTF8
$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v4.0/Github-Helper.psm1'
Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath)
$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go-Actions/v4.0/AL-Go-Helper.ps1'
Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local

$baseFolder = GetBaseFolder -folder $PSScriptRoot
$project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot

Write-Host @'
This script will create a docker based local development environment for your project.
NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work.
Expand All @@ -54,7 +57,7 @@ The script will also modify launch.json to have a Local Sandbox configuration po
'@

$settings = ReadSettings -baseFolder $baseFolder -project $project -userName $env:USERNAME
$settings = ReadSettings -baseFolder $baseFolder -project $project -userName $env:USERNAME -workflowName 'localDevEnv'

Write-Host "Checking System Requirements"
$dockerProcess = (Get-Process "dockerd" -ErrorAction Ignore)
Expand Down Expand Up @@ -131,7 +134,7 @@ CreateDevEnv `
-auth $auth `
-credential $credential `
-licenseFileUrl $licenseFileUrl `
-insiderSasToken $insiderSasToken
-accept_insiderEula:$accept_insiderEula
}
catch {
Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"
Expand Down
24 changes: 24 additions & 0 deletions .github/RELEASENOTES.copy.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## v4.0

### Removal of the InsiderSasToken

As of October 1st 2023, Business Central insider builds are now publicly available. When creating local containers with the insider builds, you will have to accept the insider EULA (https://go.microsoft.com/fwlink/?linkid=2245051) in order to continue.

AL-Go for GitHub allows you to build and test using insider builds without any explicit approval, but please note that the insider artifacts contains the insider Eula and you automatically accept this when using the builds.

### Issues
- Issue 730 Support for external rulesets.
- Issue 739 Workflow specific KeyVault settings doesn't work for localDevEnv
- Using self-hosted runners while using Azure KeyVault for secrets or signing might fail with C:\Modules doesn't exist
- PullRequestHandler wasn't triggered if only .md files where changes. This lead to PRs which couldn't be merged if a PR status check was mandatory.
- Artifacts names for PR Builds were using the merge branch instead of the head branch.

### New Settings
- `enableExternalRulesets`: set this setting to true if you want to allow AL-Go to automatically download external references in rulesets.
- `deliverTo<deliveryTarget>`: is not really new, but has new properties and wasn't documented. The complete list of properties is here (note that some properties are deliveryTarget specific):
- **Branches** = an array of branch patterns, which are allowed to deliver to this deliveryTarget. (Default [ "main" ])
- **CreateContainerIfNotExist** = *[Only for DeliverToStorage]* Create Blob Storage Container if it doesn't already exist. (Default false)

### Deployment
Environment URL is now displayed underneath the environment being deployed to in the build summary. For Custom Deployment, the script can set the GitHub Output variable `environmentUrl` in order to show a custom URL.

## v3.3

### Issues
Expand Down
2 changes: 1 addition & 1 deletion .github/Test Next Major.settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"artifact": "////nextmajor/{INSIDERSASTOKEN}",
"artifact": "////nextmajor",
"cacheImageName": "",
"versioningStrategy": 15
}
2 changes: 1 addition & 1 deletion .github/Test Next Minor.settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"artifact": "////nextminor/{INSIDERSASTOKEN}",
"artifact": "////nextminor",
"cacheImageName": "",
"versioningStrategy": 15
}
10 changes: 5 additions & 5 deletions .github/workflows/AddExistingAppOrTestApp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ jobs:

- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@v3.3
uses: microsoft/AL-Go-Actions/WorkflowInitialize@v4.0
with:
shell: powershell
eventId: "DO0090"

- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@v3.3
uses: microsoft/AL-Go-Actions/ReadSettings@v4.0
with:
shell: powershell

- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go-Actions/ReadSecrets@v3.3
uses: microsoft/AL-Go-Actions/ReadSecrets@v4.0
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'TokenForPush'
useGhTokenWorkflowForPush: '${{ github.event.inputs.useGhTokenWorkflow }}'

- name: Add existing app
uses: microsoft/AL-Go-Actions/AddExistingApp@v3.3
uses: microsoft/AL-Go-Actions/AddExistingApp@v4.0
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
Expand All @@ -72,7 +72,7 @@ jobs:

- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@v3.3
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@v4.0
with:
shell: powershell
eventId: "DO0090"
Expand Down
36 changes: 19 additions & 17 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:

- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@v3.3
uses: microsoft/AL-Go-Actions/WorkflowInitialize@v4.0
with:
shell: powershell
eventId: "DO0091"

- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go-Actions/ReadSettings@v3.3
uses: microsoft/AL-Go-Actions/ReadSettings@v4.0
with:
shell: powershell
get: type
Expand All @@ -64,30 +64,30 @@ jobs:
- name: Determine Projects To Build
id: determineProjectsToBuild
uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@v3.3
uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@v4.0
with:
shell: powershell
maxBuildDepth: ${{ env.workflowDepth }}

- name: Determine Delivery Target Secrets
id: DetermineDeliveryTargetSecrets
uses: microsoft/AL-Go-Actions/DetermineDeliveryTargets@v3.3
uses: microsoft/AL-Go-Actions/DetermineDeliveryTargets@v4.0
with:
shell: powershell
projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}'
checkContextSecrets: 'N'

- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go-Actions/ReadSecrets@v3.3
uses: microsoft/AL-Go-Actions/ReadSecrets@v4.0
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: ${{ steps.DetermineDeliveryTargetSecrets.outputs.ContextSecrets }}

- name: Determine Delivery Targets
id: DetermineDeliveryTargets
uses: microsoft/AL-Go-Actions/DetermineDeliveryTargets@v3.3
uses: microsoft/AL-Go-Actions/DetermineDeliveryTargets@v4.0
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
Expand All @@ -97,7 +97,7 @@ jobs:

- name: Determine Deployment Environments
id: DetermineDeploymentEnvironments
uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@v3.3
uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@v4.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
Expand All @@ -113,13 +113,13 @@ jobs:
uses: actions/checkout@v3

- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@v3.3
uses: microsoft/AL-Go-Actions/ReadSettings@v4.0
with:
shell: powershell
get: templateUrl

- name: Check for updates to AL-Go system files
uses: microsoft/AL-Go-Actions/CheckForUpdates@v3.3
uses: microsoft/AL-Go-Actions/CheckForUpdates@v4.0
with:
shell: powershell
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Expand All @@ -143,7 +143,7 @@ jobs:
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString'
secrets: 'licenseFileUrl,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString'
publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }}
publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }}
signArtifacts: true
Expand All @@ -157,6 +157,7 @@ jobs:
name: Deploy to ${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
url: ${{ steps.Deploy.outputs.environmentUrl }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -167,7 +168,7 @@ jobs:
path: '.artifacts'

- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@v3.3
uses: microsoft/AL-Go-Actions/ReadSettings@v4.0
with:
shell: powershell

Expand All @@ -180,14 +181,15 @@ jobs:
- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go-Actions/ReadSecrets@v3.3
uses: microsoft/AL-Go-Actions/ReadSecrets@v4.0
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: Deploy
uses: microsoft/AL-Go-Actions/[email protected]
id: Deploy
uses: microsoft/AL-Go-Actions/[email protected]
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
Expand Down Expand Up @@ -216,20 +218,20 @@ jobs:
path: '.artifacts'

- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@v3.3
uses: microsoft/AL-Go-Actions/ReadSettings@v4.0
with:
shell: powershell

- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go-Actions/ReadSecrets@v3.3
uses: microsoft/AL-Go-Actions/ReadSecrets@v4.0
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: '${{ matrix.deliveryTarget }}Context'

- name: Deliver
uses: microsoft/AL-Go-Actions/Deliver@v3.3
uses: microsoft/AL-Go-Actions/Deliver@v4.0
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
Expand All @@ -249,7 +251,7 @@ jobs:

- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@v3.3
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@v4.0
with:
shell: powershell
eventId: "DO0091"
Expand Down
Loading

0 comments on commit f33f8f6

Please sign in to comment.