Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ jobs:
buildMode: ${{ inputs.buildMode }}
get: useCompilerFolder,workspaceCompilation,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,doNotRunBcptTests,doNotRunpageScriptingTests,artifact,generateDependencyArtifact,trustedSigning,useGitSubmodules,trackALAlertsInGitHub,skipUpgrade

- name: Run Build Initialize hook
if: hashFiles(format('{0}/.AL-Go/BuildInitialize.ps1', inputs.project)) != ''
uses: microsoft/AL-Go-Actions/RunHook@main
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
hookName: BuildInitialize

- name: Determine whether to build project
id: DetermineBuildProject
uses: microsoft/AL-Go-Actions/DetermineBuildProject@main
Expand All @@ -128,6 +120,19 @@ jobs:
project: ${{ inputs.project }}
baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}

- name: Run Build Initialize hook
if: hashFiles(format('{0}/.AL-Go/BuildInitialize.ps1', inputs.project)) != ''
Comment thread
freddydk marked this conversation as resolved.
uses: microsoft/AL-Go-Actions/RunHook@main
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
hookName: BuildInitialize
parametersJson: |
{
"buildMode": "${{ inputs.buildMode }}",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if buildmode should just be a standard parameter like project is

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on whether hooks will be available in non-build workflows as well, but then project maybe shouldn't be a standard parameter?
Let me know what you conclude?

"buildIt": ${{ steps.DetermineBuildProject.outputs.BuildIt == 'True' }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than passing BuildIt as a parameter, wouldn't it make more sense to just skip the hook altogether if BuildIt is false? Not sure what a hook would do in a job that doesnt build anyway.

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it actually will invoke the _BuildALGoProject (to copy the files), but it would be OK for my scenario.
I also added a Cleanup hook - with these two hooks, I can integrate Fkh to AL-Go and not need anything but that.
Obviously, I would copy some overrides to the .AL-Go folder during build, but I could modify those when you guys modify the build process and keep all changes centralized.

This is how my BuildInitialize and BuildCleanup looks:

Param(
    [Hashtable] $parameters
)

# AL-Go Hook

$buildIt = $parameters.buildIt

if (-not $buildIt) {
    Write-Host "BuildIt is false, no need to copy fkh scripts"
    return
}

$ENV:FKH_BACKEND_URL = "https://fkh-freddydk-backend.azurewebsites.net/api"
$ENV:FKH_TIMEZONE = "Europe/Copenhagen"

Write-Host "Install Freddy's Kubernetes Helper & Business Central Development Tools"
dotnet tool install -g fkh --prerelease
dotnet tool install -g Microsoft.Dynamics.BusinessCentral.Development.Tools

fkh applyALGoOverrides --output $PSScriptRoot

and Cleanup:

Param(
    [Hashtable] $parameters
)

# AL-Go Hook

$project = $parameters.project
$buildMode = $parameters.buildMode
$buildIt = $parameters.buildIt

if (-not $buildIt) {
    Write-Host "BuildIt is false, no need to remove container"
    return
}

$ENV:FKH_BACKEND_URL = "https://fkh-freddydk-backend.azurewebsites.net/api"
$ENV:FKH_TIMEZONE = "Europe/Copenhagen"

$parts = "$ENV:GITHUB_REPOSITORY". Split('/')
$containerName = "$($parts[0])-$($parts[1])-$($project)-$($buildMode)-$($ENV:GITHUB_RUN_ID)".ToLower() -replace "[^a-z0-9\-]"

fkh RemoveContainer --name $containerName --useOIDC

I can easily modify the PR to skip the hooks if buildIt is false - I am not going to use that.

}

- name: Read secrets
id: ReadSecrets
if: steps.DetermineBuildProject.outputs.BuildIt == 'True'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ jobs:
buildMode: ${{ inputs.buildMode }}
get: useCompilerFolder,workspaceCompilation,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,doNotRunBcptTests,doNotRunpageScriptingTests,artifact,generateDependencyArtifact,trustedSigning,useGitSubmodules,trackALAlertsInGitHub,skipUpgrade

- name: Run Build Initialize hook
if: hashFiles(format('{0}/.AL-Go/BuildInitialize.ps1', inputs.project)) != ''
uses: microsoft/AL-Go-Actions/RunHook@main
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
hookName: BuildInitialize

- name: Determine whether to build project
id: DetermineBuildProject
uses: microsoft/AL-Go-Actions/DetermineBuildProject@main
Expand All @@ -128,6 +120,19 @@ jobs:
project: ${{ inputs.project }}
baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}

- name: Run Build Initialize hook
if: hashFiles(format('{0}/.AL-Go/BuildInitialize.ps1', inputs.project)) != ''
Comment thread
freddydk marked this conversation as resolved.
uses: microsoft/AL-Go-Actions/RunHook@main
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
hookName: BuildInitialize
parametersJson: |
{
"buildMode": "${{ inputs.buildMode }}",
"buildIt": ${{ steps.DetermineBuildProject.outputs.BuildIt == 'True' }}
}

- name: Read secrets
id: ReadSecrets
if: steps.DetermineBuildProject.outputs.BuildIt == 'True'
Expand Down
Loading