Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated AL-Go System Files #24412

Closed
wants to merge 1 commit into from
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
29 changes: 29 additions & 0 deletions .github/RELEASENOTES.copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,38 @@ Issue 558 CI/CD attempts to deploy from feature branch
Issue 559 Changelog includes wrong commits
Publish to AppSource fails if publisher name or app name contains national or special characters
Issue 598 Cleanup during flush if build pipeline doesn't cleanup properly
Issue 608 When creating a release, throw error if no new artifacts have been added
Issue 528 Give better error messages when uploading to storage accounts
Create Online Development environment workflow failed in AppSource template unless AppSourceCopMandatoryAffixes is defined in repository settings file
Create Online Development environment workflow didn't have a project parameter and only worked for single project repositories
Create Online Development environment workflow didn't work if runs-on was set to Linux
Special characters are not supported in RepoName, Project names or other settings - Use UTF8 encoding to handle special characters in GITHUB_OUTPUT and GITHUB_ENV

### Issue 555
AL-Go contains several workflows, which create a Pull Request or pushes code directly.
All (except Update AL-Go System Files) earlier used the GITHUB_TOKEN to create the PR or commit.
The problem using GITHUB_TOKEN is that is doesn't trigger a pull request build or a commit build.
This is by design: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
Now, you can set the checkbox called Use GhTokenWorkflow to allowing you to use the GhTokenWorkflow instead of the GITHUB_TOKEN - making sure that workflows are triggered

### New Settings
- `keyVaultCodesignCertificateName`: With this setting you can delegate the codesigning to an Azure Key Vault. This can be useful if your certificate has to be stored in a Hardware Security Module
- `PullRequestTrigger`: With this setting you can set which trigger to use for Pull Request Builds. By default AL-Go will use pull_request_target.

### New Actions
- `DownloadProjectDependencies`: Downloads the dependency apps for a given project and build mode.

### Settings and Secrets in AL-Go for GitHub
In earlier versions of AL-Go for GitHub, all settings were available as individual environment variables to scripts and overrides, this is no longer the case.
Settings were also available as one compressed JSON structure in env:Settings, this is still the case.
Settings can no longer contain line breaks. It might have been possible to use line breaks earlier, but it would likely have unwanted consequences.
Use `$settings = $ENV:Settings | ConvertFrom-Json` to get all settings in PowerShell.

In earlier versions of AL-Go for GitHub, all secrets requested by AL-Go for GitHub were available as individual environment variables to scripts and overrides, this is no longer the case.
As described in bug 647, all secrets available to the workflow were also available in env:_Secrets, this is no longer the case.
All requested secrets were also available (base64 encoded) as one compressed JSON structure in env:Secrets, this is still the case.
Use `$secrets = $ENV:Secrets | ConvertFrom-Json` to get all requested secrets in PowerShell.
You cannot get to any secrets that weren't requested by AL-Go for GitHub.

## v3.1

Expand Down
133 changes: 64 additions & 69 deletions .github/workflows/CICD.yaml

Large diffs are not rendered by default.

43 changes: 40 additions & 3 deletions .github/workflows/IncrementVersionNumber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
description: Direct COMMIT (Y/N)
required: false
default: 'N'
useGhTokenWorkflow:
description: Use GhTokenWorkflow for Pull Request/COMMIT
type: boolean

permissions:
contents: write
Expand All @@ -38,23 +41,57 @@ jobs:

- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@preview
uses: microsoft/AL-Go/Actions/WorkflowInitialize@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0096"

- name: Read settings
uses: microsoft/AL-Go/Actions/ReadSettings@d15c25e25c4b0033da9f99970e3a420e231f7fbc
if: github.event.inputs.useGhTokenWorkflow == 'true'
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}

- name: Read secrets
uses: microsoft/AL-Go/Actions/ReadSecrets@d15c25e25c4b0033da9f99970e3a420e231f7fbc
if: github.event.inputs.useGhTokenWorkflow == 'true'
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'

- name: CalculateToken
id: CalculateToken
env:
useGhTokenWorkflow: ${{ github.event.inputs.useGhTokenWorkflow }}
run: |
$ghToken = '${{ secrets.GITHUB_TOKEN }}'
if ($env:useGhTokenWorkflow -eq 'true') {
$secrets = $env:Secrets | ConvertFrom-Json
if ($secrets.GHTOKENWORKFLOW) {
$ghToken = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.GHTOKENWORKFLOW))
}
else {
Write-Host "::Warning::GHTOKENWORKFLOW secret not found. Using GITHUB_TOKEN."
}
}
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ghToken=$ghToken"

- name: Increment Version Number
uses: microsoft/AL-Go-Actions/IncrementVersionNumber@preview
uses: microsoft/AL-Go/Actions/IncrementVersionNumber@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
token: ${{ steps.CalculateToken.outputs.ghToken }}
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
versionNumber: ${{ github.event.inputs.versionNumber }}
directCommit: ${{ github.event.inputs.directCommit }}

- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@preview
uses: microsoft/AL-Go/Actions/WorkflowPostProcess@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0096"
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/PullRequestHandler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,22 @@ env:

jobs:
PregateCheck:
if: github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
if: (github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name) && (github.event_name != 'pull_request')
runs-on: [ windows-latest ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: refs/pull/${{ github.event.number }}/merge

- uses: microsoft/AL-Go-Actions/VerifyPRChanges@preview
with:
baseSHA: ${{ github.event.pull_request.base.sha }}
headSHA: ${{ github.event.pull_request.head.sha }}
prbaseRepository: ${{ github.event.pull_request.base.repo.full_name }}
- uses: microsoft/AL-Go/Actions/VerifyPRChanges@d15c25e25c4b0033da9f99970e3a420e231f7fbc

Initialization:
needs: [ PregateCheck ]
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settings: ${{ steps.ReadSettings.outputs.SettingsJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
Expand All @@ -62,14 +57,14 @@ jobs:

- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@preview
uses: microsoft/AL-Go/Actions/WorkflowInitialize@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0104"

- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go-Actions/ReadSettings@preview
uses: microsoft/AL-Go/Actions/ReadSettings@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
Expand All @@ -78,11 +73,11 @@ jobs:
- name: Determine Workflow Depth
id: DetermineWorkflowDepth
run: |
Add-Content -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)"

- name: Determine Projects To Build
id: determineProjectsToBuild
uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@preview
uses: microsoft/AL-Go/Actions/DetermineProjectsToBuild@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
maxBuildDepth: ${{ env.workflowDepth }}
Expand All @@ -105,7 +100,7 @@ jobs:
project: ${{ matrix.project }}
buildMode: ${{ matrix.buildMode }}
projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext'
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString'
publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }}

Build:
Expand All @@ -126,7 +121,7 @@ jobs:
project: ${{ matrix.project }}
buildMode: ${{ matrix.buildMode }}
projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext'
secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString'
publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }}

PostProcess:
Expand All @@ -142,7 +137,7 @@ jobs:

- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@preview
uses: microsoft/AL-Go/Actions/WorkflowPostProcess@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0104"
Expand Down
30 changes: 13 additions & 17 deletions .github/workflows/UpdateGitHubGoSystemFiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,68 +32,64 @@ jobs:

- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/WorkflowInitialize@preview
uses: microsoft/AL-Go/Actions/WorkflowInitialize@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0098"

- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@preview
uses: microsoft/AL-Go/Actions/ReadSettings@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
get: keyVaultName,ghTokenWorkflowSecretName,templateUrl
get: templateUrl

- name: Read secrets
uses: microsoft/AL-Go-Actions/ReadSecrets@preview
env:
secrets: ${{ toJson(secrets) }}
uses: microsoft/AL-Go/Actions/ReadSecrets@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settingsJson: ${{ env.Settings }}
secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}'
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'

- name: Override templateUrl
env:
templateUrl: ${{ github.event.inputs.templateUrl }}
run: |
$ErrorActionPreference = "STOP"
Set-StrictMode -version 2.0
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$templateUrl = $ENV:templateUrl
if ($templateUrl) {
Write-Host "Using Template Url: $templateUrl"
Add-Content -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
}

- name: Calculate DirectCommit
env:
directCommit: ${{ github.event.inputs.directCommit }}
eventName: ${{ github.event_name }}
run: |
$ErrorActionPreference = "STOP"
Set-StrictMode -version 2.0
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$directCommit = $ENV:directCommit
Write-Host $ENV:eventName
if ($ENV:eventName -eq 'schedule') {
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit = Y"
$directCommit = 'Y'
}
Add-Content -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit"

- name: Update AL-Go system files
uses: microsoft/AL-Go-Actions/CheckForUpdates@preview
uses: microsoft/AL-Go/Actions/CheckForUpdates@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
token: ${{ env.ghTokenWorkflow }}
token: ${{ fromJson(env.Secrets).ghTokenWorkflow }}
Update: Y
templateUrl: ${{ env.templateUrl }}
directCommit: ${{ env.directCommit }}

- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@preview
uses: microsoft/AL-Go/Actions/WorkflowPostProcess@d15c25e25c4b0033da9f99970e3a420e231f7fbc
with:
shell: powershell
eventId: "DO0098"
Expand Down
Loading
Loading