From 78365a57f441dbe471d90aa60a3696c7fa2c1152 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 4 Aug 2023 08:50:51 +0200 Subject: [PATCH] New way of saving Environment variable space (#640) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a different approach to solve the flooding of ENV This PR will do the following changes: - The ReadSettings action will always return Settings in ENV:Settings and will NOT add settings to output - Only specific settings specifĂ­ed in get: to the ReadSettings action will be emitted as separate ENV variables (for use in yaml files) - Settings are not transferred to actions in with: - but instead just taken from $ENV:Settings in the action.yaml - settings will ever only exist once. - SettingsJson input is still available in action.yaml to ensure that people on preview can upgrade. Still needed (will be done as separate PR's after this one is merged) - Do not re-write settings in ReadSecrets and DetermineArtifactUrl - ReadSettings should be the only one. - Split AnalyzeRepo into specific functions (instead of one function with some -doNot's) - A few actions will call ReadSettings instead of using $ENV:Settings - we should always use the same $ENV:Settings pattern - Remove SettingsJson from action.yaml 1 month after we ship - Make Update AL.-Go System Files independent of the "old" repo. --------- Co-authored-by: freddydk --- Actions/AddExistingApp/README.md | 37 +++++----- Actions/AnalyzeTests/README.md | 40 ++++++++--- .../CalculateArtifactNames.ps1 | 5 +- Actions/CalculateArtifactNames/README.md | 59 ++++++++++++---- Actions/CalculateArtifactNames/action.yaml | 6 +- Actions/CheckForUpdates/README.md | 35 ++++++---- Actions/CreateApp/README.md | 44 +++++++----- .../CreateDevelopmentEnvironment/README.md | 35 ++++++---- Actions/CreateReleaseNotes/README.md | 39 +++++++---- Actions/Deliver/Deliver.ps1 | 8 +-- Actions/Deliver/README.md | 43 ++++++------ Actions/Deploy/README.md | 33 +++++---- ...rl.Action.ps1 => DetermineArtifactUrl.ps1} | 17 ++--- Actions/DetermineArtifactUrl/README.md | 36 ++++++---- Actions/DetermineArtifactUrl/action.yaml | 19 +---- Actions/DetermineProjectsToBuild/README.md | 34 ++++++--- Actions/DownloadProjectDependencies/README.md | 36 ++++++---- Actions/IncrementVersionNumber/README.md | 31 +++++--- Actions/PipelineCleanup/README.md | 18 ++++- Actions/README.md | 70 ++++++++----------- Actions/ReadSecrets/README.md | 34 +++++++-- Actions/ReadSecrets/ReadSecrets.ps1 | 22 +++--- Actions/ReadSecrets/action.yaml | 7 +- Actions/ReadSettings/README.md | 46 +++++++++--- Actions/ReadSettings/ReadSettings.ps1 | 65 +++++++++-------- Actions/ReadSettings/action.yaml | 3 - Actions/RunPipeline/README.md | 47 ++++++++----- Actions/RunPipeline/RunPipeline.ps1 | 4 +- Actions/RunPipeline/action.yaml | 7 +- Actions/SUPPORT.md | 6 +- Actions/Sign/README.md | 39 ++++++----- Actions/Sign/Sign.ps1 | 14 ++-- Actions/Sign/action.yaml | 19 ++--- Actions/VerifyPRChanges/README.md | 27 ++++--- Actions/WorkflowInitialize/README.md | 29 ++++++-- Actions/WorkflowPostProcess/README.md | 27 ++++--- .../workflows/AddExistingAppOrTestApp.yaml | 3 +- .../AppSource App/.github/workflows/CICD.yaml | 4 -- .../.github/workflows/CreateApp.yaml | 3 +- .../CreateOnlineDevelopmentEnvironment.yaml | 3 +- .../workflows/CreatePerformanceTestApp.yaml | 3 +- .../.github/workflows/CreateRelease.yaml | 4 +- .../.github/workflows/CreateTestApp.yaml | 3 +- .../.github/workflows/Current.yaml | 1 - .../workflows/IncrementVersionNumber.yaml | 3 +- .../.github/workflows/NextMajor.yaml | 1 - .../.github/workflows/NextMinor.yaml | 1 - .../.github/workflows/PublishToAppSource.yaml | 1 - .../workflows/PublishToEnvironment.yaml | 3 - .../.github/workflows/PullRequestHandler.yaml | 1 - .../workflows/UpdateGitHubGoSystemFiles.yaml | 3 +- .../.github/workflows/_BuildALGoProject.yaml | 14 ++-- Templates/AppSource App/README.md | 11 ++- Templates/AppSource App/SUPPORT.md | 3 +- .../workflows/AddExistingAppOrTestApp.yaml | 3 +- .../.github/workflows/CICD.yaml | 4 -- .../.github/workflows/CreateApp.yaml | 3 +- .../CreateOnlineDevelopmentEnvironment.yaml | 3 +- .../workflows/CreatePerformanceTestApp.yaml | 3 +- .../.github/workflows/CreateRelease.yaml | 4 +- .../.github/workflows/CreateTestApp.yaml | 3 +- .../.github/workflows/Current.yaml | 1 - .../workflows/IncrementVersionNumber.yaml | 3 +- .../.github/workflows/NextMajor.yaml | 1 - .../.github/workflows/NextMinor.yaml | 1 - .../workflows/PublishToEnvironment.yaml | 3 - .../.github/workflows/PullRequestHandler.yaml | 1 - .../workflows/UpdateGitHubGoSystemFiles.yaml | 3 +- .../.github/workflows/_BuildALGoProject.yaml | 14 ++-- Templates/Per Tenant Extension/README.md | 13 ++-- Templates/Per Tenant Extension/SUPPORT.md | 3 +- Tests/CalculateArtifactNames.Test.ps1 | 7 +- Tests/DetermineArtifactUrl.Test.ps1 | 22 ++++++ Tests/ReadSettings.Action.Test.ps1 | 1 - Tests/TestActionsHelper.psm1 | 15 +++- Tests/WorkflowInitialize.Test.ps1 | 2 + 76 files changed, 704 insertions(+), 515 deletions(-) rename Actions/DetermineArtifactUrl/{DetermineArtifactUrl.Action.ps1 => DetermineArtifactUrl.ps1} (80%) diff --git a/Actions/AddExistingApp/README.md b/Actions/AddExistingApp/README.md index 6107706ea..8b1a6b27c 100644 --- a/Actions/AddExistingApp/README.md +++ b/Actions/AddExistingApp/README.md @@ -1,17 +1,22 @@ # Add existing app -Add an existing app to a AL-Go repository -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### project -Project name if the repository is setup for multiple projects -### type (required) -Type of apps in the repository (Per Tenant Extension, AppSource App) -### url (required) -Direct Download Url of .app or .zip file -### directCommit (default N) -Direct Commit (Y/N) +Add an existing app to an AL-Go for GitHub repository + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | +| url | Yes | Direct Download Url of .app or .zip file to add to the repository | | +| updateBranch | | Which branch should the app be added to | github.ref_name | +| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N | + +## OUTPUT +none \ No newline at end of file diff --git a/Actions/AnalyzeTests/README.md b/Actions/AnalyzeTests/README.md index 6e4b65c4b..5ff446dcc 100644 --- a/Actions/AnalyzeTests/README.md +++ b/Actions/AnalyzeTests/README.md @@ -1,11 +1,29 @@ -# Analyze Tests -Analyze results of tests -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### projet (required) -Project to analyze +# Analyze Tests +Analyze results of tests from the RunPipeline action + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | Yes | Name of project to analyze or . if the repository is setup for single project | | + +## OUTPUT + +### ENV variables +none + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| TestResultMD | MarkDown of the test result with \n instead of line breaks | + +### SUMMARY +This function will set the test result markdown in the GITHUB_STEP_SUMMARY section diff --git a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 index 2afc62cb1..d7e684d6d 100644 --- a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 +++ b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 @@ -1,6 +1,4 @@ Param( - [Parameter(HelpMessage = "Settings from repository in compressed Json format", Mandatory = $true)] - [string] $settingsJson, [Parameter(HelpMessage = "Name of the built project", Mandatory = $true)] [string] $project, [Parameter(HelpMessage = "Build mode used when building the artifacts", Mandatory = $true)] @@ -19,8 +17,7 @@ function Set-EnvVariable([string] $name, [string] $value) { $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 -Write-Host $settingsJson -$settings = $settingsJson | ConvertFrom-Json +$settings = $env:Settings | ConvertFrom-Json if ($project -eq ".") { $project = $settings.repoName diff --git a/Actions/CalculateArtifactNames/README.md b/Actions/CalculateArtifactNames/README.md index 0d02e65fb..637b31f09 100644 --- a/Actions/CalculateArtifactNames/README.md +++ b/Actions/CalculateArtifactNames/README.md @@ -1,15 +1,48 @@ # Calculate Artifact Names Calculate Artifact Names for AL-Go workflows -## Parameters -### settingsJson -Settings from repository in compressed Json format -### project -Name of the built project -### buildMode -Build mode used when building the artifacts -### branchName -Name of the branch the workflow is running on -### suffix -A suffix to add to artifacts names -Note: if a suffix is specified, the current date will be added extra -Default suffix is the current build version + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| project | Yes | Name of the built project or . if the repository is setup for single project | | +| buildMode | Yes |Build mode used when building the artifacts | | +| branchName | Yes | Name of the branch the workflow is running on | | +| suffix | | A suffix to add to artifacts names. **Note:** if a suffix is specified, the current date will be added extra | Build version | + +## OUTPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| ThisBuildAppsArtifactsName | Artifact name for apps being built in the current workflow run | +| ThisBuildTestAppsArtifactsName | Artifact name for test apps being built in the current workflow run | +| AppsArtifactsName | Artifacts name for Apps | +| DependenciesArtifactsName | Artifacts name for Dependencies | +| TestAppsArtifactsName | Artifacts name for TestApps | +| TestResultsArtifactsName | Artifacts name for TestResults | +| BcptTestResultsArtifactsName | Artifacts name for BcptTestResults | +| BuildOutputArtifactsName | Artifacts name for BuildOutput | +| ContainerEventLogArtifactsName | Artifacts name for ContainerEventLog | +| BuildMode | Build mode used when building the artifacts | + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| ThisBuildAppsArtifactsName | Artifact name for apps being built in the current workflow run | +| ThisBuildTestAppsArtifactsName | Artifact name for test apps being built in the current workflow run | +| AppsArtifactsName | Artifacts name for Apps | +| DependenciesArtifactsName | Artifacts name for Dependencies | +| TestAppsArtifactsName | Artifacts name for TestApps | +| TestResultsArtifactsName | Artifacts name for TestResults | +| BcptTestResultsArtifactsName | Artifacts name for BcptTestResults | +| BuildOutputArtifactsName | Artifacts name for BuildOutput | +| ContainerEventLogArtifactsName | Artifacts name for ContainerEventLog | +| BuildMode | Build mode used when building the artifacts | diff --git a/Actions/CalculateArtifactNames/action.yaml b/Actions/CalculateArtifactNames/action.yaml index 369d2198f..6f00c3073 100644 --- a/Actions/CalculateArtifactNames/action.yaml +++ b/Actions/CalculateArtifactNames/action.yaml @@ -5,9 +5,6 @@ inputs: description: Shell in which you want to run the action (powershell or pwsh) required: false default: powershell - settingsJson: - description: Settings from repository in compressed Json format - required: true project: description: Name of the built project required: true @@ -59,12 +56,11 @@ runs: shell: ${{ inputs.shell }} id: calculateartifactnames env: - _settingsJson: ${{ inputs.settingsJson }} _project: ${{ inputs.project }} _buildMode: ${{ inputs.buildMode }} _branchName: ${{ inputs.branchName }} _suffix: ${{ inputs.suffix }} - run: try { ${{ github.action_path }}/CalculateArtifactNames.ps1 -settingsJson $ENV:_settingsJson -project $ENV:_project -buildMode $ENV:_buildMode -branchName $ENV:_branchName -suffix $ENV:_suffix } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("*",'').Replace("*",' ')))"; exit 1 } + run: try { ${{ github.action_path }}/CalculateArtifactNames.ps1 -project $ENV:_project -buildMode $ENV:_buildMode -branchName $ENV:_branchName -suffix $ENV:_suffix } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("*",'').Replace("*",' ')))"; exit 1 } branding: icon: terminal color: blue diff --git a/Actions/CheckForUpdates/README.md b/Actions/CheckForUpdates/README.md index 3e5f8715f..6a05c613c 100644 --- a/Actions/CheckForUpdates/README.md +++ b/Actions/CheckForUpdates/README.md @@ -1,15 +1,22 @@ # Check for updates -Check for updates to AL-Go system files -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### update (default N) -Set this input to Y in order to update AL-Go System Files if needed -### updateBranch (default github.ref_name) -Set the branch to update. In case `directCommit` parameter is set to 'Y', then the branch the action is run on will be updated. -### directCommit (default N) -Direct Commit (Y/N) +Check for updates to AL-Go system files and perform the update if requested + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| templateBranch | | Branch in template repository to use for the update | default branch | +| update | | Set this input to Y in order to update AL-Go System Files if needed | N | +| updateBranch | | Set the branch to update. In case `directCommit` parameter is set to 'Y', then the branch the action is run on will be updated | github.ref_name | +| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N | + +## OUTPUT +none \ No newline at end of file diff --git a/Actions/CreateApp/README.md b/Actions/CreateApp/README.md index 3dbdaa137..522a4d0c3 100644 --- a/Actions/CreateApp/README.md +++ b/Actions/CreateApp/README.md @@ -1,19 +1,27 @@ # Create a new app -Create a new app and add it to your AL-Go repository -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### type (required) -Type of app to add (Per Tenant Extension, AppSource App, Test App) -### publisher (required) -Publisher name of the app -### name (required) -Name of the app -### idrange (required) -ID range of the app -### directCommit (default N) -Direct Commit (Y/N) +Create a new app and add it to an AL-Go repository + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | +| type | Yes | Type of app to add (PTE, AppSource App, Test App) | | +| name | Yes | App Name | | +| publisher | Yes | Publisher | | +| idrange | Yes | ID range | | +| sampleCode | | Include Sample Code (Y/N) | N | +| sampleSuite | | Include Sample BCPT Suite (Y/N) | N | +| updateBranch | | Which branch should the app be added to | github.ref_name | +| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N | + +## OUTPUT +none diff --git a/Actions/CreateDevelopmentEnvironment/README.md b/Actions/CreateDevelopmentEnvironment/README.md index 0070eee28..63449edc5 100644 --- a/Actions/CreateDevelopmentEnvironment/README.md +++ b/Actions/CreateDevelopmentEnvironment/README.md @@ -1,15 +1,24 @@ # Create Development Environment Create an online development environment -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### environmentName (required) -Name of the online environment to create -### adminCenterApiCredentials (required) -ClientId/ClientSecret or Refresh token for Admin Center API authentication -### directCommit (default N) -Direct Commit (Y/N) + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| environmentName | Yes | Name of the online environment to create | +| project | | Project name if the repository is setup for multiple projects | . | +| adminCenterApiCredentials | | ClientId/ClientSecret or Refresh token for Admin Center API authentication | | +| reUseExistingEnvironment | | Reuse existing environment if it exists | N | +| updateBranch | | Which branch should the app be added to | github.ref_name | +| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N | + +## OUTPUT +none \ No newline at end of file diff --git a/Actions/CreateReleaseNotes/README.md b/Actions/CreateReleaseNotes/README.md index de022d09e..6e34d279b 100644 --- a/Actions/CreateReleaseNotes/README.md +++ b/Actions/CreateReleaseNotes/README.md @@ -1,13 +1,28 @@ # Creates release notes -Creates release notes for a release, based on a given tag and the tag from the latest release. -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### tag_name (required) -This release tag name -### target_commitish (default last) -Last commit to include in release notes +Creates release notes for a release, based on a given tag and the tag from the latest release + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| tag_name | Yes | This release tag name | | +| target_commitish | | Last commit to include in release notes | Latest | + +## OUTPUT + +### ENV variables +none + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| ReleaseBranch | Name of the release branch | +| ReleaseNotes | Release notes generated based on the changes | diff --git a/Actions/Deliver/Deliver.ps1 b/Actions/Deliver/Deliver.ps1 index 22459db0a..c4818a6d7 100644 --- a/Actions/Deliver/Deliver.ps1 +++ b/Actions/Deliver/Deliver.ps1 @@ -102,7 +102,7 @@ try { $project = $thisProject.Replace('\','_').Replace('/','_') } else { - $project = $env:repoName + $project = $settings.repoName } # projectName is the project name stripped for special characters $projectName = $project -replace "[^a-z0-9]", "-" @@ -296,14 +296,14 @@ try { $parameters.dependencyAppFiles = @(Get-Item -Path (Join-Path $dependenciesFolder[0] "*.app") | ForEach-Object { $_.FullName }) } if ($nuGetAccount.Keys -contains 'PackageName') { - $parameters.packageId = $nuGetAccount.PackageName.replace('{project}',$projectName).replace('{owner}',$ENV:GITHUB_REPOSITORY_OWNER).replace('{repo}',$env:repoName) + $parameters.packageId = $nuGetAccount.PackageName.replace('{project}',$projectName).replace('{owner}',$ENV:GITHUB_REPOSITORY_OWNER).replace('{repo}',$settings.repoName) } else { if ($thisProject -and ($thisProject -eq '.')) { - $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($env:repoName)" + $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)" } else { - $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($env:repoName)-$ProjectName" + $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)-$ProjectName" } } if ($type -eq 'CD') { diff --git a/Actions/Deliver/README.md b/Actions/Deliver/README.md index 861f5156f..484e0173f 100644 --- a/Actions/Deliver/README.md +++ b/Actions/Deliver/README.md @@ -1,21 +1,24 @@ # Deliver -Deliver App to AppSource or Storage -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### projects (default '*') -Projects to deliver -### deliveryTarget (required) -Deliver to AppSource or Storage account -### artifacts (required) -The artifacts to deliver -### type (default 'CD') -Type of delivery -### atypes (default 'Apps,Dependencies,TestApps') -Types of artifacts to deliver -### goLive (default 'N') -Promote AppSource App to Go Live? +Deliver App to deliveryTarget (AppSource, Storage, or...) + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| projects | | Comma separated list of projects to deliver | * | +| deliveryTarget | Yes | Delivery target (AppSource, Storage, GitHubPackages,...) | | +| artifacts | Yes | The artifacts to deliver | | +| type | | Type of delivery (CD or Release) | CD | +| atypes | | Artifact types to deliver | Apps,Dependencies,TestApps | +| goLive | | Only relevant for AppSource delivery type. Promote AppSource App to Go Live? | N | + +## OUTPUT +none diff --git a/Actions/Deploy/README.md b/Actions/Deploy/README.md index b1498ea1d..ab1b52563 100644 --- a/Actions/Deploy/README.md +++ b/Actions/Deploy/README.md @@ -1,13 +1,22 @@ # Deploy -Deploy App to online environment -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### workflow (required) -Name of workflow initiating the deployment (CI | Create Release) -### artifactsUrl (required) -Url of artifacts to deploy +Deploy Apps to online environment + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| projects | | Comma separated list of projects to deploy. | | +| environmentName | Yes | Name of environment to deploy to | +| artifacts | Yes | Artifacts to deploy | +| type | | Type of delivery (CD or Release) | CD | + +## OUTPUT +none diff --git a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.Action.ps1 b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 similarity index 80% rename from Actions/DetermineArtifactUrl/DetermineArtifactUrl.Action.ps1 rename to Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 index af2c95301..2f91c7a79 100644 --- a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.Action.ps1 +++ b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 @@ -3,8 +3,6 @@ Param( [string] $parentTelemetryScopeJson = '7b7d', [Parameter(HelpMessage = "Project folder", Mandatory = $false)] [string] $project = ".", - [Parameter(HelpMessage = "Settings from repository in compressed Json format", Mandatory = $false)] - [string] $settingsJson = '{"artifact":""}', [Parameter(HelpMessage = "Secrets from repository in compressed Json format", Mandatory = $false)] [string] $secretsJson = '{"insiderSasToken":""}' ) @@ -26,7 +24,7 @@ try { $telemetryScope = CreateScope -eventId 'DO0084' -parentTelemetryScopeJson $parentTelemetryScopeJson $secrets = $secretsJson | ConvertFrom-Json | ConvertTo-HashTable $insiderSasToken = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.insiderSasToken)) - $projectSettings = $settingsJson | ConvertFrom-Json | ConvertTo-HashTable + $projectSettings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable $projectSettings = AnalyzeRepo -settings $projectSettings -project $project -doNotCheckArtifactSetting -doNotIssueWarnings $artifactUrl = Determine-ArtifactUrl -projectSettings $projectSettings -insiderSasToken $insiderSasToken $artifactCacheKey = '' @@ -38,15 +36,14 @@ try { #region Action: Output # Set output variables - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ArtifactUrl=$artifactUrl" - Write-Host "ArtifactUrl=$artifactUrl" - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ArtifactCacheKey=$artifactCacheKey" - Write-Host "ArtifactCacheKey=$artifactCacheKey" - $outSettingsJson = $projectSettings | ConvertTo-Json -Depth 99 -Compress - Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "Settings=$OutSettingsJson" - Write-Host "SettingsJson=$outSettingsJson" + Write-Host "SETTINGS:" + $projectSettings | ConvertTo-Json -Depth 99 | Out-Host + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "Settings=$($projectSettings | ConvertTo-Json -Depth 99 -Compress)" + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifact=$artifactUrl" Write-Host "Artifact=$artifactUrl" + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifactCacheKey=$artifactCacheKey" + Write-Host "ArtifactCacheKey=$artifactCacheKey" #endregion TrackTrace -telemetryScope $telemetryScope diff --git a/Actions/DetermineArtifactUrl/README.md b/Actions/DetermineArtifactUrl/README.md index e3f1e2924..407526869 100644 --- a/Actions/DetermineArtifactUrl/README.md +++ b/Actions/DetermineArtifactUrl/README.md @@ -1,15 +1,25 @@ # Determine artifactUrl Determines the artifactUrl to use for a given project -## Parameters -### settingsJson -Settings from repository in compressed Json format -### secretsJson -Secrets from repository in compressed Json format -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal - -## Outputs -### ArtifactUrl: -The ArtifactUrl to use -### ArtifactCacheKey: -The Cache Key to use for caching the artifacts when using CompilerFolder + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project folder if repository is setup for multiple projects | . | +| secretsJson | | Secrets from repository in compressed Json format | | + +## OUTPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| ArtifactUrl | The ArtifactUrl to use | +| ArtifactCacheKey | The Cache Key to use for caching the artifacts when using CompilerFolder | diff --git a/Actions/DetermineArtifactUrl/action.yaml b/Actions/DetermineArtifactUrl/action.yaml index 4cbef11b0..7a3e8402d 100644 --- a/Actions/DetermineArtifactUrl/action.yaml +++ b/Actions/DetermineArtifactUrl/action.yaml @@ -13,35 +13,20 @@ inputs: description: Project folder required: false default: '.' - settingsJson: - description: Settings from repository in compressed Json format - required: false - default: '{"appBuild":0,"appRevision":0}' secretsJson: description: Secrets from repository in compressed Json format required: false default: '{"insiderSasToken":""}' -outputs: - ArtifactUrl: - description: The ArtifactUrl to use for building this project - value: ${{ steps.determineArtifactUrl.outputs.ArtifactUrl }} - ArtifactCacheKey: - description: The Artifact Cache Key to use for building this project (if using CompilerFolder) - value: ${{ steps.determineArtifactUrl.outputs.ArtifactCacheKey }} runs: using: composite steps: - - name: Determine ArtifactUrl + - name: run shell: ${{ inputs.shell }} - id: determineArtifactUrl env: _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} _project: ${{ inputs.project }} - _settingsJson: ${{ inputs.settingsJson }} _secretsJson: ${{ inputs.secretsJson }} - run: try { - ${{ github.action_path }}/DetermineArtifactUrl.Action.ps1 -parentTelemetryScopeJson $env:_parentTelemetryScopeJson -project $ENV:_project -settingsJson $ENV:_settingsJson -secretsJson $ENV:_secretsJson - } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } + run: try { ${{ github.action_path }}/DetermineArtifactUrl.ps1 -parentTelemetryScopeJson $env:_parentTelemetryScopeJson -project $ENV:_project -secretsJson $ENV:_secretsJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } branding: icon: terminal color: blue diff --git a/Actions/DetermineProjectsToBuild/README.md b/Actions/DetermineProjectsToBuild/README.md index 4a08ba384..11d2952c7 100644 --- a/Actions/DetermineProjectsToBuild/README.md +++ b/Actions/DetermineProjectsToBuild/README.md @@ -1,14 +1,28 @@ # Determine projects to build -Scans for AL-Go projects and determines which one to build. -If the action +Scans for AL-Go projects and determines which one to build + The action also computes build dimensions, based on the projects and the build modes for each of them -## Outputs -### ProjectsJson: -An array of AL-Go projects in compressed JSON format +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| maxBuildDepth | | Specifies the maximum build depth suppored by the workflow running the action | 0 | + +## OUTPUT + +### ENV variables +none -### ProjectDependenciesJson: -An object that holds the project dependencies in compressed JSON format - -### BuildOrderJson: -An array of objects that determine that build order, including build dimensions +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| ProjectsJson | An array of AL-Go projects in compressed JSON format | +| ProjectDependenciesJson | An object that holds the project dependencies in compressed JSON format | +| BuildOrderJson |An array of objects that determine that build order, including build dimensions | diff --git a/Actions/DownloadProjectDependencies/README.md b/Actions/DownloadProjectDependencies/README.md index d311fcb4d..667caf82d 100644 --- a/Actions/DownloadProjectDependencies/README.md +++ b/Actions/DownloadProjectDependencies/README.md @@ -1,22 +1,28 @@ # Download project dependencies -Downloads artifacts from AL-Go projects, that are dependencies of a given AL-Go project. +Downloads artifacts from AL-Go projects, that are dependencies of a given AL-Go project -The action constructs arrays of paths to .app files, that are dependencies of the apps in an AL-Go project. +The action constructs arrays of paths to .app files, that are dependencies of the apps in an AL-Go project -## Parameters -### project -The AL-Go project for which to download dependencies +## INPUT -### buildMode -The build mode to use to downloaded to most appropriate dependencies. -If a dependency project isn't built in the provided build mode, then the artifacts from the default mode will be used. +### ENV variables +none -### projectsDependenciesJson -A JSON-formatted object that maps a project to an array of its dependencies. +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| project | Yes | The AL-Go project for which to download dependencies | | +| buildMode | Yes | The build mode to use to downloaded to most appropriate dependencies. If a dependency project isn't built in the provided build mode, then the artifacts from the default mode will be used | | +| projectsDependenciesJson | Yes | A JSON-formatted object that maps a project to an array of its dependencies | | -## Outputs -### DownloadedApps: -A JSON-formatted list of paths to .app files, that dependencies of the apps. +## OUTPUT -### DownloadedTestApps: -A JSON-formatted list of paths to .app files, that dependencies of the test apps. +### ENV variables +none + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| DownloadedApps | A JSON-formatted list of paths to .app files, that dependencies of the apps | +| DownloadedTestApps | A JSON-formatted list of paths to .app files, that dependencies of the test apps | diff --git a/Actions/IncrementVersionNumber/README.md b/Actions/IncrementVersionNumber/README.md index a170c4fdd..74fe13f19 100644 --- a/Actions/IncrementVersionNumber/README.md +++ b/Actions/IncrementVersionNumber/README.md @@ -1,13 +1,22 @@ # Increment version number Increment version number in AL-Go repository -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### versionnumber (required) -New version number (Major.Minor) -### directCommit (default N) -Direct commit (Y/N) + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | +| versionnumber | Yes | Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change | | +| updateBranch | | Which branch should the app be added to | github.ref_name | +| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N | + +## OUTPUT +none diff --git a/Actions/PipelineCleanup/README.md b/Actions/PipelineCleanup/README.md index d86824132..cc43a112d 100644 --- a/Actions/PipelineCleanup/README.md +++ b/Actions/PipelineCleanup/README.md @@ -1,5 +1,17 @@ # Pipeline Cleanup Perform cleanup after running pipeline in AL-Go repository -## Parameters -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | + +## OUTPUT +none diff --git a/Actions/README.md b/Actions/README.md index 20b6a6f28..be7f4d163 100644 --- a/Actions/README.md +++ b/Actions/README.md @@ -1,52 +1,38 @@ # AL-Go Actions -## Actions -### [Create a new app](CreateApp) -Create a new app and add it to your AL-Go repository -### [Add existing app](AddExistingApp) -Add an existing app to a AL-Go repository -### [Check for updates](CheckForUpdates) -Check for updates to AL-Go system files -### [Deploy](Deploy) -Deploy App to online environment -### [Increment version number](IncrementVersionNumber) -Increment version number in AL-Go repository -### [Pipeline cleanup](PipelineCleanup) -Perform cleanup after running pipeline in AL-Go repository -### [Read secrets](ReadSecrets) -Read secrets from GitHub secrets or Azure Keyvault for AL-Go workflows -### [Read settings](ReadSettings) -Read settings for AL-Go workflows -### [Register customer environment](RegisterCustomerEnvironment) -Register customer environment for AL-Go continuous deployment -### [Run pipeline](RunPipeline) -Run pipeline in AL-Go repository - - -# Project +This repository contains a set of GitHub actions used by the AL-Go for GitHub templates. -> This repo has been populated by an initial template to help get you started. Please -> make sure to update the content to build a great experience for community-building. +Please go to https://aka.ms/AL-Go to learn more. -As the maintainer of this project, please make a few updates: - -- Improving this README.MD file to provide a great experience -- Updating SUPPORT.MD with content about this project's support experience -- Understanding the security reporting process in SECURITY.MD -- Remove this section from the README +## Actions +| Name | Description | +| :-- | :-- | +| [Add existing app](AddExistingApp) | Add an existing app to an AL-Go for GitHub repository | +| [Analyze Tests](AnalyzeTests) | Analyze results of tests from the RunPipeline action | +| [Calculate Artifact Names](CalculateArtifactNames) | Calculate Artifact Names for AL-Go workflows | +| [Check for updates](CheckForUpdates) | Check for updates to AL-Go system files and perform the update if requested | +| [Create a new app](CreateApp) | Create a new app and add it to an AL-Go repository | +| [Create Development Environment](CreateDevelopmentEnvironment) | Create an online development environment | +| [Creates release notes](CreateReleaseNotes) | Creates release notes for a release, based on a given tag and the tag from the latest release | +| [Deliver](Deliver) | Deliver App to deliveryTarget (AppSource, Storage, or...) | +| [Deploy](Deploy) | Deploy Apps to online environment | +| [Determine artifactUrl](DetermineArtifactUrl) | Determines the artifactUrl to use for a given project | +| [Determine projects to build](DetermineProjectsToBuild) | Scans for AL-Go projects and determines which one to build | +| [Download project dependencies](DownloadProjectDependencies) | Downloads artifacts from AL-Go projects, that are dependencies of a given AL-Go project | +| [Increment version number](IncrementVersionNumber) | Increment version number in AL-Go repository | +| [Pipeline Cleanup](PipelineCleanup) | Perform cleanup after running pipeline in AL-Go repository | +| [Read secrets](ReadSecrets) | Read secrets from GitHub secrets or Azure Keyvault for AL-Go workflows | +| [Read settings](ReadSettings) | Read settings for AL-Go workflows | +| [Run pipeline](RunPipeline) | Run pipeline in AL-Go repository | +| [Sign](Sign) | Sign apps with a certificate stored in Azure Key Vault | +| [Verify Pull Request changes](VerifyPRChanges) | Verify Pull Request Changes for AL-Go workflows | +| [Initialize workflow](WorkflowInitialize) | Initialize a workflow | +| [PostProcess action](WorkflowPostProcess) | Finalize a workflow | ## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit [https://cla.opensource.microsoft.com](https://cla.opensource.microsoft.com). - -When you submit a pull request, a CLA bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. +Please read [this](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) description on how to contribute to AL-Go for GitHub. -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +We do not accept Pull Requests on the Actions repository directly. ## Trademarks diff --git a/Actions/ReadSecrets/README.md b/Actions/ReadSecrets/README.md index 15be3839c..91fc98b48 100644 --- a/Actions/ReadSecrets/README.md +++ b/Actions/ReadSecrets/README.md @@ -1,9 +1,29 @@ # Read secrets Read secrets from GitHub secrets or Azure Keyvault for AL-Go workflows -## Parameters -### keyVaultName (required) -Name of keyvault -### secrets (required) -Comma separated list of Secrets to get -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| secrets | Yes | Comma separated list of secrets to get | | + +## OUTPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| RepoSecrets | A compressed json construct with all secrets base64 encoded. The secret value + the base64 value of the secret value are masked in the log | +| Settings | ReadSecrets makes changes to the Settings environment variables if there are appDependencyProbingPaths defined | + +> **NOTE:** This method will also create individual environment variables for every secret encoded with base64. + +### OUTPUT variables +none diff --git a/Actions/ReadSecrets/ReadSecrets.ps1 b/Actions/ReadSecrets/ReadSecrets.ps1 index e61de8f7e..830b82be9 100644 --- a/Actions/ReadSecrets/ReadSecrets.ps1 +++ b/Actions/ReadSecrets/ReadSecrets.ps1 @@ -1,7 +1,4 @@ Param( - - [Parameter(HelpMessage = "Settings from template repository in compressed Json format", Mandatory = $false)] - [string] $settingsJson = '{"keyVaultName": ""}', [Parameter(HelpMessage = "Comma separated list of Secrets to get", Mandatory = $true)] [string] $secrets = "", [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)] @@ -36,13 +33,16 @@ try { Import-Module (Join-Path $PSScriptRoot ".\ReadSecretsHelper.psm1") $outSecrets = [ordered]@{} - $settings = $settingsJson | ConvertFrom-Json | ConvertTo-HashTable + $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable $outSettings = $settings - $keyVaultName = $settings.keyVaultName - if ([string]::IsNullOrEmpty($keyVaultName) -and (IsKeyVaultSet)) { - $credentialsJson = Get-KeyVaultCredentials | ConvertTo-HashTable - if ($credentialsJson.Keys -contains "keyVaultName") { - $keyVaultName = $credentialsJson.keyVaultName + $keyVaultName = "" + if (IsKeyVaultSet -and $settings.ContainsKey('keyVaultName')) { + $keyVaultName = $settings.keyVaultName + if ([string]::IsNullOrEmpty($keyVaultName)) { + $credentialsJson = Get-KeyVaultCredentials | ConvertTo-HashTable + if ($credentialsJson.Keys -contains "keyVaultName") { + $keyVaultName = $credentialsJson.keyVaultName + } } } [System.Collections.ArrayList]$secretsCollection = @() @@ -113,12 +113,16 @@ try { }) -join ', ')" } + #region Action: Output + $outSecretsJson = $outSecrets | ConvertTo-Json -Compress Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "RepoSecrets=$outSecretsJson" $outSettingsJson = $outSettings | ConvertTo-Json -Depth 99 -Compress Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "Settings=$OutSettingsJson" + #endregion + TrackTrace -telemetryScope $telemetryScope } catch { diff --git a/Actions/ReadSecrets/action.yaml b/Actions/ReadSecrets/action.yaml index f289f4e71..c434702fc 100644 --- a/Actions/ReadSecrets/action.yaml +++ b/Actions/ReadSecrets/action.yaml @@ -5,10 +5,6 @@ inputs: description: Shell in which you want to run the action (powershell or pwsh) required: false default: powershell - settingsJson: - description: Settings from template repository in compressed Json format - required: false - default: '{"keyVaultName": ""}' secrets: description: Comma separated list of Secrets to get required: true @@ -22,10 +18,9 @@ runs: - name: run shell: ${{ inputs.shell }} env: - _settingsJson: ${{ inputs.settingsJson }} _secrets: ${{ inputs.secrets }} _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - run: try { ${{ github.action_path }}/ReadSecrets.ps1 -settingsJson $ENV:_settingsJson -secrets $ENV:_secrets -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } + run: try { ${{ github.action_path }}/ReadSecrets.ps1 -secrets $ENV:_secrets -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } branding: icon: terminal color: blue diff --git a/Actions/ReadSettings/README.md b/Actions/ReadSettings/README.md index 782e7c6b8..6657413fe 100644 --- a/Actions/ReadSettings/README.md +++ b/Actions/ReadSettings/README.md @@ -1,11 +1,39 @@ # Read settings Read settings for AL-Go workflows -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -### get (reqiured) -Comma separated list of properties to get from repo settings + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | +| getenvironments | | Specifies the pattern of the environments you want to retreive (or empty for no environments) | | +| includeProduction | | Specifies whether you want to include production environments | N | +| release | | Indicates whether this is called from a release pipeline | N | +| get | | Specifies which properties to get from the settings file, default is all | | + +## OUTPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | A compressed JSON structure with ALL AL-Go settings, independent of the get parameter. If project was not specified, this will only include repository settings. | + +> **NOTE:** This method creates individual environment variables for every setting specified in the get parameter. + + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| GitHubRunnerJson | GitHubRunner in compressed Json format | +| GitHubRunnerShell | Shell for GitHubRunner jobs | +| EnvironmentsJson | Environments in compressed Json format | +| EnvironmentCount | Number of environments in array | +| UnknownEnvironment | Determines whether we are publishing to an unknown environment | diff --git a/Actions/ReadSettings/ReadSettings.ps1 b/Actions/ReadSettings/ReadSettings.ps1 index c52a86e61..605cf4bc3 100644 --- a/Actions/ReadSettings/ReadSettings.ps1 +++ b/Actions/ReadSettings/ReadSettings.ps1 @@ -36,7 +36,7 @@ try { $getSettings = $get.Split(',').Trim() } else { - $getSettings = @($settings.Keys) + $getSettings = @() } if ($ENV:GITHUB_EVENT_NAME -in @("pull_request_target", "pull_request")) { @@ -49,48 +49,47 @@ try { } if ($settings.versioningstrategy -ne -1) { - if ($getSettings -contains 'appBuild' -or $getSettings -contains 'appRevision') { - switch ($settings.versioningStrategy -band 15) { - 0 { # Use RUN_NUMBER and RUN_ATTEMPT - $settings.appBuild = $settings.runNumberOffset + [Int32]($ENV:GITHUB_RUN_NUMBER) - $settings.appRevision = [Int32]($ENV:GITHUB_RUN_ATTEMPT) - 1 - } - 1 { # Use RUN_ID and RUN_ATTEMPT - OutputError -message "Versioning strategy 1 is no longer supported" - } - 2 { # USE DATETIME - $settings.appBuild = [Int32]([DateTime]::UtcNow.ToString('yyyyMMdd')) - $settings.appRevision = [Int32]([DateTime]::UtcNow.ToString('HHmmss')) - } - 15 { # Use maxValue - $settings.appBuild = [Int32]::MaxValue - $settings.appRevision = 0 - } - default { - OutputError -message "Unknown version strategy $versionStrategy" - exit - } + switch ($settings.versioningStrategy -band 15) { + 0 { # Use RUN_NUMBER and RUN_ATTEMPT + $settings.appBuild = $settings.runNumberOffset + [Int32]($ENV:GITHUB_RUN_NUMBER) + $settings.appRevision = [Int32]($ENV:GITHUB_RUN_ATTEMPT) - 1 + } + 1 { # Use RUN_ID and RUN_ATTEMPT + OutputError -message "Versioning strategy 1 is no longer supported" + } + 2 { # USE DATETIME + $settings.appBuild = [Int32]([DateTime]::UtcNow.ToString('yyyyMMdd')) + $settings.appRevision = [Int32]([DateTime]::UtcNow.ToString('HHmmss')) + } + 15 { # Use maxValue + $settings.appBuild = [Int32]::MaxValue + $settings.appRevision = 0 + } + default { + OutputError -message "Unknown version strategy $versionStrategy" + exit } } } $outSettings = @{} - $getSettings | ForEach-Object { - $setting = $_.Trim() + $settings.Keys | ForEach-Object { + $setting = $_ $settingValue = $settings."$setting" $outSettings += @{ "$setting" = $settingValue } - if ($settingValue -is [System.Collections.Specialized.OrderedDictionary]) { - Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$($settingValue | ConvertTo-Json -Depth 99 -Compress)" - } - else { - Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$settingValue" + if ($getSettings -contains $setting) { + if ($settingValue -is [System.Collections.Specialized.OrderedDictionary]) { + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$($settingValue | ConvertTo-Json -Depth 99 -Compress)" + } + else { + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$settingValue" + } } } - $outSettingsJson = $outSettings | ConvertTo-Json -Depth 99 -Compress - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "SettingsJson=$outSettingsJson" - Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "Settings=$OutSettingsJson" - Write-Host "SettingsJson=$outSettingsJson" + Write-Host "SETTINGS:" + $outSettings | ConvertTo-Json -Depth 99 | Out-Host + Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "Settings=$($outSettings | ConvertTo-Json -Depth 99 -Compress)" $gitHubRunner = $settings.githubRunner.Split(',').Trim() | ConvertTo-Json -compress Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GitHubRunnerJson=$githubRunner" diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index 7e5d2878b..ce301431e 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -38,9 +38,6 @@ inputs: required: false default: '' outputs: - SettingsJson: - description: Settings in compressed Json format - value: ${{ steps.readsettings.outputs.SettingsJson }} GitHubRunnerJson: description: GitHubRunner in compressed Json format value: ${{ steps.readsettings.outputs.GitHubRunnerJson }} diff --git a/Actions/RunPipeline/README.md b/Actions/RunPipeline/README.md index 2572682fc..065168bfd 100644 --- a/Actions/RunPipeline/README.md +++ b/Actions/RunPipeline/README.md @@ -1,19 +1,32 @@ # Run pipeline Run pipeline in AL-Go repository -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### parentTelemetryScopeJson (default {}) -Specifies the parent telemetry scope for the telemetry signal -## insiderSasToken (default '') -Insider Sas token from https://aka.ms/collaborate -## licenseFileUrl (default '') -Secure URL for license file -## appVersion (required) -Major and Minor part of app Version number -## appBuild (required) -Build part of app Version number -## appRevision (required) -Revision part of app Version number + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| actor | | The GitHub actor running the action | github.actor | +| token | | The GitHub token running the action | github.token | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| project | | Project name if the repository is setup for multiple projects | . | +| secretsJson | | Secrets from repository in compressed Json format | {} | +| buildMode | | Specifies a mode to use for the build steps | Default | +| installAppsJson | | A JSON-formatted list of apps to install | [] | +| installTestAppsJson | | A JSON-formatted list of test apps to install | [] | + +## OUTPUT + +## ENV variables +| Name | Description | +| :-- | :-- | +| containerName | Container name of a container used during build | + +## OUTPUT variables +none diff --git a/Actions/RunPipeline/RunPipeline.ps1 b/Actions/RunPipeline/RunPipeline.ps1 index 58a264e2a..f2b378bd5 100644 --- a/Actions/RunPipeline/RunPipeline.ps1 +++ b/Actions/RunPipeline/RunPipeline.ps1 @@ -7,8 +7,6 @@ Param( [string] $parentTelemetryScopeJson = '7b7d', [Parameter(HelpMessage = "Project folder", Mandatory = $false)] [string] $project = "", - [Parameter(HelpMessage = "Settings from repository in compressed Json format", Mandatory = $false)] - [string] $settingsJson = '{"appBuild":"", "appRevision":""}', [Parameter(HelpMessage = "Secrets from repository in compressed Json format", Mandatory = $false)] [string] $secretsJson = '{"insiderSasToken":"","licenseFileUrl":"","codeSignCertificateUrl":"","codeSignCertificatePassword":"","keyVaultCertificateUrl":"","keyVaultCertificatePassword":"","keyVaultClientId":"","storageContext":"","applicationInsightsConnectionString":""}', [Parameter(HelpMessage = "Specifies a mode to use for the build steps", Mandatory = $false)] @@ -84,7 +82,7 @@ try { $workflowName = "$env:GITHUB_WORKFLOW".Trim() Write-Host "use settings and secrets" - $settings = $settingsJson | ConvertFrom-Json | ConvertTo-HashTable + $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable $secrets = $secretsJson | ConvertFrom-Json | ConvertTo-HashTable $appBuild = $settings.appBuild $appRevision = $settings.appRevision diff --git a/Actions/RunPipeline/action.yaml b/Actions/RunPipeline/action.yaml index 77ced37a5..053ee7337 100644 --- a/Actions/RunPipeline/action.yaml +++ b/Actions/RunPipeline/action.yaml @@ -21,10 +21,6 @@ inputs: description: Project folder required: false default: '.' - settingsJson: - description: Settings from repository in compressed Json format - required: false - default: '{"appBuild":0,"appRevision":0}' secretsJson: description: Secrets from repository in compressed Json format required: false @@ -51,12 +47,11 @@ runs: _token: ${{ inputs.token }} _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} _project: ${{ inputs.project }} - _settingsJson: ${{ inputs.settingsJson }} _secretsJson: ${{ inputs.secretsJson }} _buildMode: ${{ inputs.buildMode }} _installAppsJson: ${{ inputs.installAppsJson }} _installTestAppsJson: ${{ inputs.installTestAppsJson }} - run: try { ${{ github.action_path }}/RunPipeline.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -settingsJson $ENV:_settingsJson -secretsJson $ENV:_secretsJson -buildMode $ENV:_buildMode -installAppsJson $ENV:_installAppsJson -installTestAppsJson $ENV:_installTestAppsJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } + run: try { ${{ github.action_path }}/RunPipeline.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -secretsJson $ENV:_secretsJson -buildMode $ENV:_buildMode -installAppsJson $ENV:_installAppsJson -installTestAppsJson $ENV:_installTestAppsJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } branding: icon: terminal color: blue diff --git a/Actions/SUPPORT.md b/Actions/SUPPORT.md index e76471afa..96927d757 100644 --- a/Actions/SUPPORT.md +++ b/Actions/SUPPORT.md @@ -2,9 +2,9 @@ ## How to file issues and get help -This project uses [GitHub Issues on the AL-Go project](https://github.com/microsoft/AL-Go/issues) to track bugs and feature requests. Please search the existing -issues before filing new issues to avoid duplicates. For new issues, file your bug or -feature request as a new Issue. +This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. + +Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. ## Microsoft Support Policy diff --git a/Actions/Sign/README.md b/Actions/Sign/README.md index 986aa7c15..2554b789f 100644 --- a/Actions/Sign/README.md +++ b/Actions/Sign/README.md @@ -1,19 +1,22 @@ # Sign -Sign files with a certificate stored in Azure Key Vault -## Parameters -### azureKeyVaultURI -The URI of the Azure Key Vault the certificate is stored in -### azureKeyVaultClientID -The Client ID of the service principal used to access the keyvault -### azureKeyVaultClientSecret -The Client ID of the service principal used to access the keyvault -### azureKeyVaultTenantID -The tenant id used to authenticate to Azure -### azureKeyVaultCertificateName -The name of the certificate used to perform the signing -### pathToFiles -The path to the files to be signed -### timestampService -The URI of the timestamp server -### digestAlgorithm -The digest algorithm to use for signing and timestamping +Sign apps with a certificate stored in Azure Key Vault + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | +| azureCredentialsJson | Yes | Azure Credentials secret | | +| timestampService | | The URI of the timestamp server | http://timestamp.digicert.com | +| digestAlgorithm | | The digest algorithm to use for signing and timestamping | SHA256 | +| pathToFiles | Yes | The path to the files to be signed | + +## OUTPUT +none diff --git a/Actions/Sign/Sign.ps1 b/Actions/Sign/Sign.ps1 index f27252b8a..da0d6e07a 100644 --- a/Actions/Sign/Sign.ps1 +++ b/Actions/Sign/Sign.ps1 @@ -1,16 +1,16 @@ param( [Parameter(HelpMessage = "Azure Key Vault URI.", Mandatory = $true)] - [string]$AzureCredentialsJson, - [Parameter(HelpMessage = "Settings from repository in compressed Json format", Mandatory = $true)] - [string]$settingsJson, + [string] $AzureCredentialsJson, + [Parameter(HelpMessage = "'OBSOLETE: Settings from repository in compressed Json format'", Mandatory = $true)] + [string] $settingsJson, [Parameter(HelpMessage = "Paths to the files to be signed.", Mandatory = $true)] - [String]$PathToFiles, + [String] $PathToFiles, [Parameter(HelpMessage = "Timestamp service.", Mandatory = $false)] - [string]$TimestampService = "http://timestamp.digicert.com", + [string] $TimestampService = "http://timestamp.digicert.com", [Parameter(HelpMessage = "Timestamp digest algorithm.", Mandatory = $false)] - [string]$TimestampDigest = "sha256", + [string] $TimestampDigest = "sha256", [Parameter(HelpMessage = "File digest algorithm.", Mandatory = $false)] - [string]$FileDigest = "sha256", + [string] $FileDigest = "sha256", [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)] [string] $ParentTelemetryScopeJson = '7b7d' ) diff --git a/Actions/Sign/action.yaml b/Actions/Sign/action.yaml index c44e3a078..aa48aa5b1 100644 --- a/Actions/Sign/action.yaml +++ b/Actions/Sign/action.yaml @@ -8,9 +8,6 @@ inputs: azureCredentialsJson: description: Azure Credentials secret required: true - settingsJson: - description: Settings from repository in compressed Json format - required: true timestampService: description: The URI of the timestamp server required: false @@ -33,21 +30,19 @@ runs: shell: ${{ inputs.shell }} env: _azureCredentialsJson: ${{ inputs.azureCredentialsJson }} - _settingsJson: ${{ inputs.settingsJson }} _timestampService: ${{ inputs.timestampService }} _digestAlgorithm: ${{ inputs.digestAlgorithm }} _pathToFiles: ${{ inputs.pathToFiles }} _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} id: Sign - run: | + run: | try { - ${{ github.action_path }}/Sign.ps1 -AzureCredentialsJson "$ENV:_azureCredentialsJson" ` - -settingsJson "$ENV:_settingsJson" ` - -TimestampService "$ENV:_timestampService" ` - -TimestampDigest "$ENV:_digestAlgorithm" ` - -FileDigest "$ENV:_digestAlgorithm" ` - -PathToFiles "$ENV:_pathToFiles" ` - -ParentTelemetryScopeJson "$ENV:_parentTelemetryScopeJson" + ${{ github.action_path }}/Sign.ps1 -AzureCredentialsJson $ENV:_azureCredentialsJson ` + -TimestampService $ENV:_timestampService ` + -TimestampDigest $ENV:_digestAlgorithm ` + -FileDigest $ENV:_digestAlgorithm ` + -PathToFiles $ENV:_pathToFiles ` + -ParentTelemetryScopeJson $ENV:_parentTelemetryScopeJson } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 } diff --git a/Actions/VerifyPRChanges/README.md b/Actions/VerifyPRChanges/README.md index 09a334ec9..e01438ce7 100644 --- a/Actions/VerifyPRChanges/README.md +++ b/Actions/VerifyPRChanges/README.md @@ -1,9 +1,18 @@ -# Read settings -Verify PR Changes for AL-Go workflows -## Parameters -### token (default github.token) -The GitHub token running the action -### prBaseRepository (default github.event.pull_request.base.repo.full_name) -The name of the repository the PR is going to -### pullRequestId (default github.event.pull_request.number) -The id of the pull request +# Verify Pull Request changes +Verify Pull Request Changes for AL-Go workflows + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| token | | The token to use for the GitHub API |github.token | +| prBaseRepository | | The name of the repository the PR is going to | github.event.pull_request.base.repo.full_name | +| pullRequestId | | The id of the pull request | github.event.pull_request.number | + +## OUTPUT +none diff --git a/Actions/WorkflowInitialize/README.md b/Actions/WorkflowInitialize/README.md index 13ce9f00b..3aed69fb8 100644 --- a/Actions/WorkflowInitialize/README.md +++ b/Actions/WorkflowInitialize/README.md @@ -1,5 +1,24 @@ -# Initializing workflow -Initializing a workflow -## Parameters -### workflowName (required) -Name of workflow initiating the workflow +# Initialize workflow +Initialize a workflow + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| eventId | Yes | The event id of the initiating workflow | | + +## OUTPUT + +### ENV variables +none + +### OUTPUT variables +| Name | Description | +| :-- | :-- | +| correlationId | A correlation Id for the workflow | +| telemetryScopeJson | A telemetryScope that covers the workflow | diff --git a/Actions/WorkflowPostProcess/README.md b/Actions/WorkflowPostProcess/README.md index 0e783b9bf..598d492f7 100644 --- a/Actions/WorkflowPostProcess/README.md +++ b/Actions/WorkflowPostProcess/README.md @@ -1,11 +1,18 @@ # PostProcess action -finalizing a workflow -## Parameters -### actor (default github.actor) -The GitHub actor running the action -### token (default github.token) -The GitHub token running the action -### workflowName (required) -Name of workflow initiating the deployment -### telemetryScope -Telemetry scope generated during the workflow initialization +Finalize a workflow + +## INPUT + +### ENV variables +none + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| eventId | Yes | The event id of the initiating workflow | | +| telemetryScopeJson | | Telemetry scope generated during the workflow initialization | {} | + + +## OUTPUT +none \ No newline at end of file diff --git a/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml b/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml index cf5eb2787..c65422840 100644 --- a/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml +++ b/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml @@ -52,7 +52,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -62,7 +62,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 206b23d56..544f6bf7b 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -27,7 +27,6 @@ jobs: runs-on: [ windows-latest ] outputs: telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settings: ${{ steps.ReadSettings.outputs.SettingsJson }} environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }} environmentCount: ${{ steps.ReadSettings.outputs.EnvironmentCount }} deliveryTargets: ${{ steps.DetermineDeliveryTargets.outputs.DeliveryTargetsJson }} @@ -90,7 +89,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: ${{ steps.DetermineDeliveryTargetSecrets.outputs.Secrets }} - name: Determine Delivery Targets @@ -230,7 +228,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - name: AuthContext @@ -346,7 +343,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ matrix.deliveryTarget }}Context' - name: DeliveryContext diff --git a/Templates/AppSource App/.github/workflows/CreateApp.yaml b/Templates/AppSource App/.github/workflows/CreateApp.yaml index aebb245fb..1fce41f8b 100644 --- a/Templates/AppSource App/.github/workflows/CreateApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreateApp.yaml @@ -61,7 +61,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: type,keyVaultName,ghTokenWorkflowSecretName + get: type,ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -71,7 +71,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml index 315f5fe2a..0af4a8d80 100644 --- a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml +++ b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml @@ -69,7 +69,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'adminCenterApiCredentials' - name: Check AdminCenterApiCredentials / Initiate Device Login (open to see code) @@ -112,6 +111,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -120,7 +120,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'adminCenterApiCredentials,ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml index 9c1078284..e7f86dcb8 100644 --- a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml @@ -68,7 +68,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -78,7 +78,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/CreateRelease.yaml b/Templates/AppSource App/.github/workflows/CreateRelease.yaml index 341bf902d..deb6edd3c 100644 --- a/Templates/AppSource App/.github/workflows/CreateRelease.yaml +++ b/Templates/AppSource App/.github/workflows/CreateRelease.yaml @@ -228,7 +228,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'nuGetContext,storageContext' - name: Download artifact @@ -338,7 +337,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -348,7 +347,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml index 0f6343f86..a6b101f4e 100644 --- a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml @@ -64,7 +64,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -74,7 +74,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/Current.yaml b/Templates/AppSource App/.github/workflows/Current.yaml index 792eaaaae..075c28408 100644 --- a/Templates/AppSource App/.github/workflows/Current.yaml +++ b/Templates/AppSource App/.github/workflows/Current.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml index 4b7680245..fe717c60c 100644 --- a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml +++ b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml @@ -52,7 +52,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -62,7 +62,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/AppSource App/.github/workflows/NextMajor.yaml b/Templates/AppSource App/.github/workflows/NextMajor.yaml index cee9b1d75..21ac8f74b 100644 --- a/Templates/AppSource App/.github/workflows/NextMajor.yaml +++ b/Templates/AppSource App/.github/workflows/NextMajor.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/AppSource App/.github/workflows/NextMinor.yaml b/Templates/AppSource App/.github/workflows/NextMinor.yaml index 057f787dc..964360fbf 100644 --- a/Templates/AppSource App/.github/workflows/NextMinor.yaml +++ b/Templates/AppSource App/.github/workflows/NextMinor.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml b/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml index 421b3a12b..d97aaa4d1 100644 --- a/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml +++ b/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml @@ -64,7 +64,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: 'appSourceContext' - name: DeliveryContext diff --git a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml index 4cbb87d61..0d8288827 100644 --- a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml +++ b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml @@ -28,7 +28,6 @@ jobs: runs-on: [ windows-latest ] outputs: telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settings: ${{ steps.ReadSettings.outputs.SettingsJson }} environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }} environmentCount: ${{ steps.ReadSettings.outputs.EnvironmentCount }} unknownEnvironment: ${{ steps.ReadSettings.outputs.UnknownEnvironment }} @@ -69,7 +68,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' - name: Authenticate @@ -137,7 +135,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - name: AuthContext diff --git a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml index c76d66d37..2f07b2c8e 100644 --- a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml +++ b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml @@ -42,7 +42,6 @@ jobs: 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 }} diff --git a/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml b/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml index d03c0cd26..947b8d756 100644 --- a/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml +++ b/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml @@ -42,7 +42,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName,templateUrl + get: ghTokenWorkflowSecretName,templateUrl - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -51,7 +51,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: Override templateUrl diff --git a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml index 2315db6b4..ad8201b83 100644 --- a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml +++ b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml @@ -83,6 +83,7 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} + get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -91,7 +92,6 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: ${{ inputs.secrets }} - name: Determine ArtifactUrl @@ -101,15 +101,14 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - settingsJson: ${{ env.Settings }} secretsJson: ${{ env.RepoSecrets }} - name: Cache Business Central Artifacts - if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && steps.determineArtifactUrl.outputs.ArtifactCacheKey + if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.ArtifactCacheKey uses: actions/cache@v3 with: path: .artifactcache - key: ${{ steps.determineArtifactUrl.outputs.ArtifactCacheKey }} + key: ${{ env.ArtifactCacheKey }} - name: Download Project Dependencies id: DownloadProjectDependencies @@ -129,7 +128,6 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - settingsJson: ${{ env.Settings }} secretsJson: ${{ env.RepoSecrets }} buildMode: ${{ inputs.buildMode }} installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }} @@ -142,7 +140,6 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} azureCredentialsJson: ${{ secrets.AZURE_CREDENTIALS }} - settingsJson: ${{ env.Settings }} pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app' parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} @@ -152,7 +149,6 @@ jobs: if: success() || failure() with: shell: ${{ inputs.shell }} - settingsJson: ${{ env.Settings }} project: ${{ inputs.project }} buildMode: ${{ inputs.buildMode }} branchName: ${{ github.ref_name }} @@ -239,7 +235,7 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - Project: ${{ inputs.project }} + project: ${{ inputs.project }} - name: Cleanup if: always() @@ -247,4 +243,4 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - Project: ${{ inputs.project }} + project: ${{ inputs.project }} diff --git a/Templates/AppSource App/README.md b/Templates/AppSource App/README.md index 20f5c1149..5eb2e499a 100644 --- a/Templates/AppSource App/README.md +++ b/Templates/AppSource App/README.md @@ -1,5 +1,10 @@ -# AL-Go Template -## AppSource App Project +# AL-Go AppSource App Template This template repository can be used for managing AppSource Apps for Business Central. -Please consult https://github.com/microsoft/AL-Go/#readme for scenarios on usage +Please go to https://aka.ms/AL-Go to learn more. + +## Contributing + +Please read [this](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) description on how to contribute to AL-Go for GitHub. + +We do not accept Pull Requests on the template repository directly. diff --git a/Templates/AppSource App/SUPPORT.md b/Templates/AppSource App/SUPPORT.md index 7db10e3a6..96927d757 100644 --- a/Templates/AppSource App/SUPPORT.md +++ b/Templates/AppSource App/SUPPORT.md @@ -2,8 +2,7 @@ ## How to file issues and get help -This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go -Issues, bug tracking and feature requests should be done there. +This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. diff --git a/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml index cf5eb2787..c65422840 100644 --- a/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml @@ -52,7 +52,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -62,7 +62,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 206b23d56..544f6bf7b 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -27,7 +27,6 @@ jobs: runs-on: [ windows-latest ] outputs: telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settings: ${{ steps.ReadSettings.outputs.SettingsJson }} environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }} environmentCount: ${{ steps.ReadSettings.outputs.EnvironmentCount }} deliveryTargets: ${{ steps.DetermineDeliveryTargets.outputs.DeliveryTargetsJson }} @@ -90,7 +89,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: ${{ steps.DetermineDeliveryTargetSecrets.outputs.Secrets }} - name: Determine Delivery Targets @@ -230,7 +228,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - name: AuthContext @@ -346,7 +343,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ matrix.deliveryTarget }}Context' - name: DeliveryContext diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml index aebb245fb..1fce41f8b 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml @@ -61,7 +61,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: type,keyVaultName,ghTokenWorkflowSecretName + get: type,ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -71,7 +71,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml index 315f5fe2a..71082954a 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml @@ -61,6 +61,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -69,7 +70,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'adminCenterApiCredentials' - name: Check AdminCenterApiCredentials / Initiate Device Login (open to see code) @@ -120,7 +120,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'adminCenterApiCredentials,ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml index 9c1078284..e7f86dcb8 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml @@ -68,7 +68,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -78,7 +78,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml index 341bf902d..deb6edd3c 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml @@ -228,7 +228,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'nuGetContext,storageContext' - name: Download artifact @@ -338,7 +337,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -348,7 +347,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml index 0f6343f86..a6b101f4e 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml @@ -64,7 +64,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -74,7 +74,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/Current.yaml b/Templates/Per Tenant Extension/.github/workflows/Current.yaml index b8e785b0a..b192b5a7a 100644 --- a/Templates/Per Tenant Extension/.github/workflows/Current.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/Current.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml index 4b7680245..fe717c60c 100644 --- a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml @@ -52,7 +52,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName + get: ghTokenWorkflowSecretName - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -62,7 +62,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: CalculateToken diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml index 4935cd2da..7e1b9cf1c 100644 --- a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml index 057f787dc..964360fbf 100644 --- a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml @@ -20,7 +20,6 @@ jobs: 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 }} diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml index 4cbb87d61..0d8288827 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml @@ -28,7 +28,6 @@ jobs: runs-on: [ windows-latest ] outputs: telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settings: ${{ steps.ReadSettings.outputs.SettingsJson }} environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }} environmentCount: ${{ steps.ReadSettings.outputs.EnvironmentCount }} unknownEnvironment: ${{ steps.ReadSettings.outputs.UnknownEnvironment }} @@ -69,7 +68,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' - name: Authenticate @@ -137,7 +135,6 @@ jobs: secrets: ${{ toJson(secrets) }} with: shell: powershell - settingsJson: ${{ env.Settings }} secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - name: AuthContext diff --git a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml index c76d66d37..2f07b2c8e 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml @@ -42,7 +42,6 @@ jobs: 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 }} diff --git a/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml b/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml index d03c0cd26..947b8d756 100644 --- a/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml @@ -42,7 +42,7 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - get: keyVaultName,ghTokenWorkflowSecretName,templateUrl + get: ghTokenWorkflowSecretName,templateUrl - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -51,7 +51,6 @@ jobs: with: shell: powershell parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' - name: Override templateUrl diff --git a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml index 2315db6b4..ad8201b83 100644 --- a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml @@ -83,6 +83,7 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} + get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps - name: Read secrets uses: microsoft/AL-Go-Actions/ReadSecrets@main @@ -91,7 +92,6 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - settingsJson: ${{ env.Settings }} secrets: ${{ inputs.secrets }} - name: Determine ArtifactUrl @@ -101,15 +101,14 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - settingsJson: ${{ env.Settings }} secretsJson: ${{ env.RepoSecrets }} - name: Cache Business Central Artifacts - if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && steps.determineArtifactUrl.outputs.ArtifactCacheKey + if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.ArtifactCacheKey uses: actions/cache@v3 with: path: .artifactcache - key: ${{ steps.determineArtifactUrl.outputs.ArtifactCacheKey }} + key: ${{ env.ArtifactCacheKey }} - name: Download Project Dependencies id: DownloadProjectDependencies @@ -129,7 +128,6 @@ jobs: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - settingsJson: ${{ env.Settings }} secretsJson: ${{ env.RepoSecrets }} buildMode: ${{ inputs.buildMode }} installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }} @@ -142,7 +140,6 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} azureCredentialsJson: ${{ secrets.AZURE_CREDENTIALS }} - settingsJson: ${{ env.Settings }} pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app' parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} @@ -152,7 +149,6 @@ jobs: if: success() || failure() with: shell: ${{ inputs.shell }} - settingsJson: ${{ env.Settings }} project: ${{ inputs.project }} buildMode: ${{ inputs.buildMode }} branchName: ${{ github.ref_name }} @@ -239,7 +235,7 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - Project: ${{ inputs.project }} + project: ${{ inputs.project }} - name: Cleanup if: always() @@ -247,4 +243,4 @@ jobs: with: shell: ${{ inputs.shell }} parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} - Project: ${{ inputs.project }} + project: ${{ inputs.project }} diff --git a/Templates/Per Tenant Extension/README.md b/Templates/Per Tenant Extension/README.md index 9d4e7d59f..3a9a0a281 100644 --- a/Templates/Per Tenant Extension/README.md +++ b/Templates/Per Tenant Extension/README.md @@ -1,5 +1,10 @@ -# AL-Go Template -## Per Tenant Extension Project -This template repository can be used for managing Per Tenant Extensions for Business Central. +# AL-Go Per Tenant Extension Template +This template repository can be used for managing AppSource Apps for Business Central. -Please consult https://github.com/microsoft/AL-Go/#readme for scenarios on usage +Please go to https://aka.ms/AL-Go to learn more. + +## Contributing + +Please read [this](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) description on how to contribute to AL-Go for GitHub. + +We do not accept Pull Requests on the template repository directly. diff --git a/Templates/Per Tenant Extension/SUPPORT.md b/Templates/Per Tenant Extension/SUPPORT.md index 7db10e3a6..96927d757 100644 --- a/Templates/Per Tenant Extension/SUPPORT.md +++ b/Templates/Per Tenant Extension/SUPPORT.md @@ -2,8 +2,7 @@ ## How to file issues and get help -This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go -Issues, bug tracking and feature requests should be done there. +This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. diff --git a/Tests/CalculateArtifactNames.Test.ps1 b/Tests/CalculateArtifactNames.Test.ps1 index a9d6b1d14..c34dead47 100644 --- a/Tests/CalculateArtifactNames.Test.ps1 +++ b/Tests/CalculateArtifactNames.Test.ps1 @@ -10,7 +10,7 @@ Describe 'CalculateArtifactNames Action Tests' { $scriptPath = Join-Path $scriptRoot $scriptName $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName - $settingsJson = '{ "appBuild": 123, "repoVersion": "22.0", "appRevision": 0,"repoName": "AL-GO"}' + $env:Settings = '{ "appBuild": 123, "repoVersion": "22.0", "appRevision": 0,"repoName": "AL-GO"}' $project = "ALGOProject" } @@ -27,7 +27,6 @@ Describe 'CalculateArtifactNames Action Tests' { $buildMode = "Clean" $branchName = "main" & $scriptPath ` - -settingsJson $settingsJson ` -project $project ` -buildMode $buildMode ` -branchName $branchName @@ -50,7 +49,6 @@ Describe 'CalculateArtifactNames Action Tests' { $buildMode = "Default" $branchName = "main" & $scriptPath ` - -settingsJson $settingsJson ` -project $project ` -buildMode $buildMode ` -branchName $branchName @@ -71,7 +69,6 @@ Describe 'CalculateArtifactNames Action Tests' { $buildMode = "Default" $branchName = "releases/1.0" & $scriptPath ` - -settingsJson $settingsJson ` -project $project ` -buildMode $buildMode ` -branchName $branchName @@ -93,7 +90,6 @@ Describe 'CalculateArtifactNames Action Tests' { $branchName = "releases/1.0" $suffix = "Current" & $scriptPath ` - -settingsJson $settingsJson ` -project $project ` -buildMode $buildMode ` -branchName $branchName ` @@ -121,7 +117,6 @@ Describe 'CalculateArtifactNames Action Tests' { $branchName = "releases/1.0" $suffix = "Current" & $scriptPath ` - -settingsJson $settingsJson ` -project $project ` -buildMode $buildMode ` -branchName $branchName ` diff --git a/Tests/DetermineArtifactUrl.Test.ps1 b/Tests/DetermineArtifactUrl.Test.ps1 index bc5417086..8b81c2193 100644 --- a/Tests/DetermineArtifactUrl.Test.ps1 +++ b/Tests/DetermineArtifactUrl.Test.ps1 @@ -117,3 +117,25 @@ Describe "DetermineArtifactUrl" { CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath } } + + +Describe "DetermineArtifactUrl Action Test" { + BeforeAll { + $actionName = "DetermineArtifactUrl" + $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve + $scriptName = "$actionName.ps1" + $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName + } + + It 'Compile Action' { + Invoke-Expression $actionScript + } + + It 'Test action.yaml matches script' { + $permissions = [ordered]@{ + } + $outputs = [ordered]@{ + } + YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs + } +} \ No newline at end of file diff --git a/Tests/ReadSettings.Action.Test.ps1 b/Tests/ReadSettings.Action.Test.ps1 index dbfd91d9b..d69e89abe 100644 --- a/Tests/ReadSettings.Action.Test.ps1 +++ b/Tests/ReadSettings.Action.Test.ps1 @@ -18,7 +18,6 @@ Describe "ReadSettings Action Tests" { $permissions = [ordered]@{ } $outputs = [ordered]@{ - "SettingsJson" = "Settings in compressed Json format" "GitHubRunnerJson" = "GitHubRunner in compressed Json format" "GitHubRunnerShell" = "Shell for GitHubRunner jobs" "EnvironmentsJson" = "Environments in compressed Json format" diff --git a/Tests/TestActionsHelper.psm1 b/Tests/TestActionsHelper.psm1 index 4ea1170f1..c364062e1 100644 --- a/Tests/TestActionsHelper.psm1 +++ b/Tests/TestActionsHelper.psm1 @@ -70,6 +70,7 @@ function YamlTest { $yaml.AppendLine(" required: false") | Out-Null $yaml.AppendLine(" default: powershell") | Out-Null $parameterString = "" + $warningLines = @() $envLines = [System.Text.StringBuilder]::new() if ($cmd.Parameters.Count -gt 0) { $cmd.Parameters.GetEnumerator() | ForEach-Object { @@ -82,8 +83,8 @@ function YamlTest { $type = $value.ParameterType.ToString() $yaml.AppendLine(" $($name):") | Out-Null $yaml.AppendLine(" description: $description") | Out-Null - $yaml.AppendLine(" required: $($required.ToString().ToLowerInvariant())") | Out-Null $envLines.AppendLine(" _$($name): `${{ inputs.$($name) }}") + $yaml.AppendLine(" required: $($required.ToString().ToLowerInvariant())") | Out-Null if ($type -eq "System.String" -or $type -eq "System.Int32") { $parameterString += " -$($name) `$ENV:_$($name)" if (!$required) { @@ -122,7 +123,17 @@ function YamlTest { $yaml.AppendLine(" env:") | Out-Null $yaml.Append($envLines.ToString()) } - $yaml.AppendLine(" run: try { `${{ github.action_path }}/$actionName.ps1$parameterString } catch { Write-Host ""::Error::Unexpected error when running action (`$(`$_.Exception.Message.Replace(""*"",'').Replace(""*"",' ')))""; exit 1 }") | Out-Null + if ($warningLines) { + $yaml.AppendLine(" run: |") | Out-Null + # Add the warning lines + $warningLines | ForEach-Object { + $yaml.AppendLine(" $_") | Out-Null + } + $yaml.AppendLine(" try { `${{ github.action_path }}/$actionName.ps1$parameterString } catch { Write-Host ""::Error::Unexpected error when running action (`$(`$_.Exception.Message.Replace(""*"",'').Replace(""*"",' ')))""; exit 1 }") | Out-Null + } + else { + $yaml.AppendLine(" run: try { `${{ github.action_path }}/$actionName.ps1$parameterString } catch { Write-Host ""::Error::Unexpected error when running action (`$(`$_.Exception.Message.Replace(""*"",'').Replace(""*"",' ')))""; exit 1 }") | Out-Null + } $yaml.AppendLine("branding:") | Out-Null $yaml.AppendLine(" icon: terminal") | Out-Null $yaml.Append(" color: blue") | Out-Null diff --git a/Tests/WorkflowInitialize.Test.ps1 b/Tests/WorkflowInitialize.Test.ps1 index 73f79f4e1..aa1432f8a 100644 --- a/Tests/WorkflowInitialize.Test.ps1 +++ b/Tests/WorkflowInitialize.Test.ps1 @@ -59,6 +59,8 @@ Describe "WorkflowInitialize Action Tests" { . (Join-Path $PSScriptRoot "..\Actions\AL-Go-Helper.ps1" -Resolve) . (Join-Path $PSScriptRoot "..\Actions\AL-Go-TestRepoHelper.ps1" -Resolve) + Mock Write-Host { } + TestSettingsFiles ` -ALGoOrgSettings '{}' ` -ALGoRepoSettings '{}' `