Enable AL-Go for GitHub on GitHub Enterprise Cloud with data residency - #2309
Enable AL-Go for GitHub on GitHub Enterprise Cloud with data residency#2309freddydk wants to merge 21 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
|
||
| ## Recommended approach | ||
|
|
||
| The recommended approach is to create two indirect template repositories inside your enterprise organization - one for Per Tenant Extensions and one for AppSource Apps - based on the public AL-Go templates, using the [algoctl](https://github.com/Freddy-DK/AL-Go/tree/main/algoctl) CLI. |
There was a problem hiding this comment.
link results in 404.
i think we should also stay on first party content.
There was a problem hiding this comment.
All of the AL-Go specific things will be microsoft obviously, and I will add documentation on how to do this without using my algoctl cli, but it isn't simple.
|
@freddydk please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
Enables AL-Go templates and actions to operate on GitHub Enterprise Cloud data-residency hosts.
Changes:
- Replaces hardcoded GitHub URLs with runtime server/API URLs.
- Updates release uploads, dependency retrieval, and template downloads for enterprise hosts.
- Adds enterprise documentation, release notes, safeguards, and regression fixes.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
Tests/DownloadProjectDependencies.Test.ps1 |
Tests URL secrets. |
Tests/Deploy.Module.Test.ps1 |
Configures API URL in tests. |
Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml |
Makes release operations host-aware. |
Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 |
Clarifies GitHub CLI authentication. |
Templates/AppSource App/.github/workflows/CreateRelease.yaml |
Makes release operations host-aware. |
Templates/AppSource App/.AL-Go/localDevEnv.ps1 |
Clarifies GitHub CLI authentication. |
Scenarios/UsingGitHubEnterprise.md |
Adds enterprise setup guidance. |
RELEASENOTES.md |
Announces enterprise compatibility. |
README.md |
Links the enterprise guide. |
Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 |
Targets the active GitHub CLI host. |
Actions/VerifyPRChanges/VerifyPRChanges.ps1 |
Uses the runtime API URL. |
Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 |
Targets the runtime GitHub host. |
Actions/Github-Helper.psm1 |
Derives dependency API hosts. |
Actions/GetArtifactsForDeployment/GetArtifactsForDeployment.psm1 |
Uses host-aware API and run URLs. |
Actions/GetArtifactsForDeployment/GetArtifactsForDeployment.ps1 |
Produces host-aware links. |
Actions/DownloadProjectDependencies/DownloadProjectDependencies.psm1 |
Resolves whole-URL secrets. |
Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.psm1 |
Initializes empty project metadata. |
Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 |
Emits host-aware build links. |
Actions/Deploy/Deploy.psm1 |
Uses the runtime API URL. |
Actions/Deliver/Deliver.ps1 |
Handles package lookup failures. |
Actions/CheckForUpdates/CheckForUpdates.ps1 |
Configures the GitHub CLI host. |
Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 |
Adds host-aware template downloads. |
Actions/AL-Go-Helper.ps1 |
Updates defaults and dependency URLs. |
.github/workflows/CI.yaml |
Restricts AL-Go development CI to GitHub.com. |
| # Get the latest CICD workflow run | ||
| while($true) { | ||
| $runsURI = "https://api.github.com/repos/$repository/actions/runs?per_page=$per_page&page=$page&exclude_pull_requests=true&status=completed&branch=$branch&created=>$expired" | ||
| $runsURI = "$ENV:GITHUB_API_URL/repos/$repository/actions/runs?per_page=$per_page&page=$page&exclude_pull_requests=true&status=completed&branch=$branch&created=>$expired" |
| $dependencyUri = [uri]$dependency.repo | ||
| $dependencyApiUrl = "$($dependencyUri.Scheme)://api.$($dependencyUri.Host)" |
| algoctl createrepo --repo https://<enterprise>.ghe.com/<org>/<enterprise>-PTE --templaterepo Freddy-DK/AL-Go-PTE | ||
| algoctl createrepo --repo https://<enterprise>.ghe.com/<org>/<enterprise>-AppSource --templaterepo Freddy-DK/AL-Go-AppSource |
|
|
||
| You can copy one of the public AL-Go templates into your enterprise using **git** and **GitHub CLI**. This mirror-clones the template repository from `github.com` and pushes it into a new repository on your enterprise host. | ||
|
|
||
| Replace `OWNER/REPO` with the public template (for example `microsoft/AL-Go-PTE` or `microsoft/AL-Go-AppSource`), and `ORG/REPO` and `github.mycompany.com` with your enterprise organization, repository name and host: |
| # 4. Push everything into it | ||
| Set-Location REPO.git | ||
| git push --mirror https://github.mycompany.com/ORG/REPO.git |
| [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'defaultCICDPullRequestBranches', Justification = 'False positive.')] | ||
| $defaultCICDPullRequestBranches = @( 'main' ) | ||
| $defaultBcContainerHelperVersion = "preview" | ||
| $defaultBcContainerHelperVersion = "https://github.com/Freddy-DK/navcontainerhelper/archive/refs/heads/main.zip" |
| try { | ||
| $feed, $packageId, $packageVersion = Find-BcNugetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $packageName -version $searchVersion -select Exact -allowPrerelease | ||
| } | ||
| catch { | ||
| $feed = $null | ||
| } |
❔What, Why & How
This pull request introduces comprehensive updates to improve compatibility with GitHub Enterprise (GHE) hosts. The main focus is to ensure that all scripts and workflows dynamically use the correct GitHub server and API URLs, rather than hardcoding references to
github.comandapi.github.com. This enables repositories using AL-Go for GitHub to work seamlessly on both public GitHub and GHE instances. Additionally, documentation has been updated to clarify support and provide guidance for GHE users.GitHub Enterprise compatibility and dynamic host resolution:
GITHUB_SERVER_URLandGITHUB_API_URLenvironment variables instead of hardcodedgithub.comandapi.github.comURLs for REST API calls and repository links. This affects actions such as dependency probing, deployments, pull request validation, and workflow post-processing. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]github.com, preventing unsupported usage on GHE for the main repo.ghCLI commands set theGH_HOSTenvironment variable to ensure API calls target the correct host on GHE. [1] [2] [3]Documentation and user guidance:
Scenarios/UsingGitHubEnterprise.md, detailing how to use AL-Go for GitHub on GHE, including setup instructions and best practices.README.mdis updated to reference the new GHE usage guide.Other improvements and fixes:
These changes ensure that AL-Go for GitHub works reliably in both public and enterprise GitHub environments, with clear documentation and robust host detection.
This functionality was sponsored by Fellowmind, Sweden.