microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
279 stars 114 forks source link

Dependency App is not being installed into container #1068

Closed gntpet closed 4 months ago

gntpet commented 4 months ago

Hey @freddydk , I'm trying to setup cron jobs to run "Test Current", but running into the strange issues with dependency app. It does not get installed into the container, but rather just copied to the symbols folder. Therefore, when ALGO tries to publish built app, it runs into the dependency is missing error.

image

image

See my settings:

.github\AL-Go-Settings.json here we don't run any tests cases, and use compilerFolder to gain build speed.

{
  "type": "PTE",
  "templateUrl": "https://github.com/microsoft/AL-Go-PTE@main",
  "treatTestFailuresAsWarnings": true,
  "doNotRunBcptTests": true,
  "enableCodeCop": true,
  "rulesetFile": "../cicd.ruleset.json",
  "companyName": "TNM Automated Test",
  "runs-on": "srs-eid",
  "githubRunner": "srs-eid",
  "skipUpgrade": true,
  "environments": [
    "QA"
  ],
  "CICDPushBranches": [
    "main",
    "release/*"
  ],
  "CICDPullRequestBranches": [
    "main",
    "release/*",
    "features/*",
    "bug/*"
  ],
  "DeliverToStorage": {
    "Branches": [
      "main",
      "release/*"
    ]
  },
  "DeployToQA": {
    "EnvironmentType": "SaaS",
    "EnvironmentName": "QA",
    "Projects": "SRS.nl",
    "Branches": [
      "main"
    ],
    "ContinuousDeployment": true,
    "runs-on": "srs-eid"
  },
  "DeployToUAT": {
    "EnvironmentType": "SaaS",
    "EnvironmentName": "UAT",
    "Projects": "SRS.nl",
    "Branches": [
      "release/*"
    ],
    "ContinuousDeployment": false,
    "runs-on": "srs-eid"
  },
  "DeployToPROD": {
    "EnvironmentType": "SaaS",
    "EnvironmentName": "PROD",
    "Projects": "SRS.nl",
    "Branches": [
      "release/*"
    ],
    "ContinuousDeployment": false,
    "runs-on": "srs-eid"
  },
  "EnableTaskScheduler": true,
  "doNotRunTests": true,
  "useCompilerFolder": true,
  "doNotPublishApps": true,
  "alwaysBuildAllProjects": true,
  "PullRequestTrigger": "pull_request",
  "templateSha": "408a7ecc990db8dcd9ed2a3f32f7922669f05dba",
  "CurrentSchedule": "0 2 * * *",
  "NextMinorSchedule": "0 2 * * 6",
  "NextMajorSchedule": "0 2 * * 0"
}

..\SRS.base.AL-Go\settings.json

{
    "country": "base",
    "artifact": "bcartifacts/sandbox/23/base/latest",
    "appFolders": [
    "App"
    ],
    "testFolders": [
    "Test"
    ],
    "installApps": [
        "https://verySecretURL"
    ]
}

.github\Test Current.settings.json here, we want to use containers and run automated tests

{
    "artifact": "////latest",
    "cacheImageName": "",
    "versioningStrategy": 15,
    "doNotRunTests": false,
    "useCompilerFolder": false,
    "doNotPublishApps": false,
    "treatTestFailuresAsWarnings": false
}

If i check source code, it seems that for some processes it still thinks that it is using CompilerFolder https://github.com/microsoft/navcontainerhelper/blob/db40110acc52b648c78c41593ea7e2141f7af755/AppHandling/Run-AlPipeline.ps1#L1210

image

Best Regards, Gintautas

gntpet commented 4 months ago

I believe there's a bug here:

According to the settings documentation

When running a workflow or a local script, the settings are applied by reading settings from GitHub variables and one or more settings files. Last applied settings file wins.

Thus, useCompilerFolder setting from .github/Test Current.settings.json should win over the .github/AL-Go-settings.json. I even tried to copy the Test Current.setting.json to the the project specific .Al-Go folder, but it did not give desired result. It still sees useCompilerFolder =True

image

gntpet commented 4 months ago

I just bumped our AL-GO to the latest version (5.1), and still it gets the same results

gntpet commented 4 months ago

After endless attempts, i have managed to sort it out. It turns out that .github/AL-Go-settings.json is used when loading bccontainerhelper, and if use set useCompilerFolder to true there, you cannot override it within worfklow or project settings.

This behavior is 'somehwat' documented in settings here, but totally not clear.

image

Not sure if useCompilerFolder is the only setting like that, or there's more.