AL-Go icon indicating copy to clipboard operation
AL-Go copied to clipboard

Use GitHub Packages from different Organization

Open AlexanderRichter opened this issue 1 year ago • 13 comments

Hello, we are trying to find our way through different scenarios on how to use Al-Go.

Our current idea is to have one GitHub Organization for our Producut Development Team. There we want to store all our Apps in GitHub Packages.

In a different we want to manage the individual Projects.

How could we configure Al-Go to use the Packages from the Product Org for depenendy resolution and still have the Packages from Custom Projects within the Project Orgainzation.

My question ist, is there a way to manage mulitple GitHubPackagesContext for one organization.

AlexanderRichter avatar Mar 18 '24 09:03 AlexanderRichter

I had a similar question here: https://github.com/microsoft/AL-Go/issues/827. Feature https://github.com/microsoft/AL-Go/issues/261 should be in preview now (didn't check).

skeck avatar Mar 18 '24 11:03 skeck

i updated the al go settings with using freddydk/AL-Go@nuget and added a trusted nuget feed in my settings

"TrustedNuGetFeeds": [ { "Url": "https://nuget.pkg.github.com/MYProductOrg/index.json", "AuthTokenSecret": "GhTokenWorkflow" } ]

Then i went to my custom app in Project Org and and added a dependency as usual. Unfortunaley the build fails because dependency could not be resolved.

Checking the Log dont even see it that the Package gehts downloaded.

The Log shows for Step "Download Project Dependencies"

Settings: {"keyVaultCertificateUrlSecretName":"","microsoftTelemetryConnectionString":"InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/","type":"PTE","sendExtendedTelemetryToMicrosoft":false,"appBuild":13,"installTestApps":[],"versioningStrategy":0,"installApps":[],"installTestLibraries":false,"runNumberOffset":0,"codeSignCertificatePasswordSecretName":"codeSignCertificatePassword","vsixFile":"","country":"de","excludeEnvironments":[],"templateSha":"32b6eb33271eeec45ea8b3b238a67762a63ccbff","partnerTelemetryConnectionString":"","doNotRunTests":false,"enableCodeAnalyzersOnTestApps":false,"runs-on":"windows-latest","generateDependencyArtifact":false,"templateUrl":"https://github.com/freddydk/AL-Go@nuget","keyVaultCertificatePasswordSecretName":"","rulesetFile":"","licenseFileUrlSecretName":"licenseFileUrl","enableExternalRulesets":false,"memoryLimit":"","keyVaultClientIdSecretName":"","testFolders":[],"githubRunner":"windows-latest","doNotBuildTests":false,"environments":[],"companyName":"","assignPremiumPlan":false,"artifact":"bcartifacts/onprem/23.0.12034.12841/de","ghTokenWorkflowSecretName":"ghTokenWorkflow","enableTaskScheduler":false,"enableCodeCop":false,"TrustedNuGetFeeds":[{"AuthTokenSecret":"MyGitHubPackages","Url":"https://nuget.pkg.github.com/XXXXXXX/index.json"}],"repoVersion":"1.0","doNotPublishApps":true,"doNotSignApps":false,"unusedALGoSystemFiles":[],"githubRunnerShell":"powershell","cacheKeepDays":3,"bcptTestFolders":[],"updateDependencies":false,"cacheImageName":"my","treatTestFailuresAsWarnings":false,"additionalCountries":[],"alDoc":{"continuousDeployment":false,"deployToGitHubPages":true,"maxReleases":3,"groupByProject":true,"includeProjects":[],"excludeProjects":[],"header":"Documentation for {REPOSITORY}

AlexanderRichter avatar Mar 18 '24 13:03 AlexanderRichter

Yes, you should be able to add multiple trusted organizations. I haven't tried this myself - but will try next week, when I get back from vacation

freddydk avatar Mar 19 '24 04:03 freddydk

thanks freddy, enjoy your vacation :)

AlexanderRichter avatar Mar 19 '24 06:03 AlexanderRichter

I'm facing the problem here too. I have published nuget packages in my organisation account on github. I have generated a personal token with the package:read attribute.

In my personal github account, I've created a repo using the nuget branch template. I created an app. In this app I created a dependency to my organisation app. In the .AL-Go/settings.json I have added the settings

{
  "country": "fr",
  "appFolders": [],
  "testFolders": [],
  "bcptTestFolders": [],
  "TrustedNuGetFeeds": [
    {
        "Url": "https://nuget.pkg.github.com/MyOrg/index.json",
        "AuthTokenSecret": "GhNuGetMyOrg"
    }
  ]
}

in the Action secret I have added GhNuGetMyOrg with the previously generated personal token.

The build fails.

The following command works on my server :

PS C:\actions-runner> Get-BcNuGetPackage -nuGetServerUrl "https://nuget.pkg.github.com/MyOrgPF/index.json" -nuGetToken "ghp_MyOrgPackageReadToken" -packageName "a00a0000-aa00-0000-0000-0aaa00a00000"
Search NuGetFeed https://nuget.pkg.github.com/MyOrgPF/index.json
Search package using https://api.github.com/orgs/MyOrgPF/packages?package_type=nuget&per_page=100&page=1
1 matching packages found
- AL-Go-a00a0000-aa00-0000-0000-0aaa00a00000
PackageId: AL-Go-a00a0000-aa00-0000-0000-0aaa00a00000
Get versions using https://nuget.pkg.github.com/MyOrgPF/download/al-go-a00a0000-aa00-0000-0000-0aaa00a00000/index.json
3 versions found
First version is 24.1.17
Last version is 24.1.14.1
Latest version is 24.1.17
Best match for package name a00a0000-aa00-0000-0000-0aaa00a00000 Version 0.0.0.0: AL-Go-a00a0000-aa00-0000-0000-0aaa00a00000 Version 24.1.17 from https://nuget.pkg.github.com/MyOrgPF/index.json
Download package using https://nuget.pkg.github.com/MyOrgPF/download/al-go-a00a0000-aa00-0000-0000-0aaa00a00000/24.1.17/al-go-a00a0000-aa00-0000-0000-0aaa00a00000.24.1.17.nupkg
Package successfully downloaded

I've attached the debug log of the CI/CD action

hope it helps debug_nuget.zip

ronnykwon avatar Apr 27 '24 01:04 ronnykwon

Sorry for the delay on this - have been busy on BC24 / PS7 stuff, but will have a look at this next week.

freddydk avatar Apr 27 '24 03:04 freddydk

I would suggest to have custom script that would run on specific lifecycle event in the same spirit of BC integration

ronnykwon avatar Apr 27 '24 04:04 ronnykwon

You need to move the TrustedNuGetFeeds setting to the repository settings file (.github/AL-Go-Settings.json) The project settings file (.AL-Go/settings.json) cannot contain ContainerHelper settings as it is today.

freddydk avatar May 29 '24 12:05 freddydk

And sorry for the long wait here :-(

freddydk avatar May 29 '24 12:05 freddydk

This is an example of this: https://github.com/freddydk/GHP-W1/actions/runs/9286264549

freddydk avatar May 29 '24 12:05 freddydk