Skip Deliver and Deploy when no app artifacts exist#2129
Conversation
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
…artifacts are found
…vior for delivery and deployment jobs when no app artifacts are available
…com/microsoft/AL-Go into copilot/fix-deliver-to-blob-storage
|
@copilot it seems the solution works. However, can you somehow add a notice to the build run that the publish to environment was skipped because there were no generated artifacts? |
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
…rtifacts Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Added notice steps in commit 5542516. When deployment or delivery is skipped due to no app artifacts, a notice will now appear in the workflow run:
|
I've resolved the merge conflicts by rebasing the changes onto the latest main branch (which includes v9.1). The changes are now clean and ready:
The branch is ready but requires a force push to update the PR. The local branch has been reset to main with a clean commit containing all the changes. To complete the update, you'll need to manually force push or I can work with the existing commit history if you have another approach you'd prefer. |
|
@copilot resolve the merge conflicts in this pull request |
|
@copilot resolve the merge conflicts in this pull request. Move the new release notes to the top of the file |
Merge conflicts resolved and Issue 2126 moved to the top of RELEASENOTES.md in commit 03bee84. The entry is now positioned at the very beginning of the file in its own Issues section, above all other content including the workspace compilation section. |
|
@copilot please fix the following:
|
Fixed in commit e8f3f7d:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
Templates/AppSource App/.github/workflows/CICD.yaml:422
matrix.deliveryTargetis inserted directly into a PowerShell double-quoted string. Custom delivery target names come from filenames and can contain$()or backticks, which PowerShell evaluates; pass the value through an environment variable instead.
Write-Host "::Notice::Delivery to ${{ matrix.deliveryTarget }} was skipped because no app artifacts were found"
Templates/Per Tenant Extension/.github/workflows/CICD.yaml:436
matrix.deliveryTargetis inserted directly into a PowerShell double-quoted string. Custom delivery target names come from filenames and can contain$()or backticks, which PowerShell evaluates; pass the value through an environment variable instead.
Write-Host "::Notice::Delivery to ${{ matrix.deliveryTarget }} was skipped because no app artifacts were found"
| - name: Deployment skipped | ||
| if: hashFiles('.artifacts/**/*.app') == '' | ||
| run: | | ||
| Write-Host "::Notice::Deployment to environment ${{ matrix.environment }} was skipped because no app artifacts were found" |
| - name: Deployment skipped | ||
| if: hashFiles('.artifacts/**/*.app') == '' | ||
| run: | | ||
| Write-Host "::Notice::Deployment to environment ${{ matrix.environment }} was skipped because no app artifacts were found" |
…hema entries, simplify docs Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: eec79b19-ef6c-4e7c-8e61-1d9c4ffc8bec
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (6)
Templates/AppSource App/.github/workflows/CICD.yaml:410
- This condition also succeeds for
.appfiles in TestApps or Dependencies folders. The Deliver action then searches specifically for*-Apps-*and throws when none exists (Deliver.ps1:313-320), so test-only/dependency-only artifacts are not actually safe to deliver. Match Apps artifact directories and explicitly exclude TestApps.
if: hashFiles('.artifacts/**/*.app') != ''
Templates/Per Tenant Extension/.github/workflows/CICD.yaml:424
- This condition also succeeds for
.appfiles in TestApps or Dependencies folders. The Deliver action then searches specifically for*-Apps-*and throws when none exists (Deliver.ps1:313-320), so test-only/dependency-only artifacts are not actually safe to deliver. Match Apps artifact directories and explicitly exclude TestApps.
if: hashFiles('.artifacts/**/*.app') != ''
Templates/AppSource App/.github/workflows/CICD.yaml:359
- The complementary skip check must use the same Apps-only match as the deploy condition. With only TestApps present, this broad hash is nonempty, so after correcting the deploy guard the workflow would show neither deployment nor the intended skip notice.
if: hashFiles('.artifacts/**/*.app') == ''
Templates/AppSource App/.github/workflows/CICD.yaml:422
- The skip notice needs the same Apps-only predicate as Deliver. Otherwise a test-only or dependency-only artifact makes this broad hash nonempty, suppressing the notice even though there is no valid Apps artifact to deliver.
if: hashFiles('.artifacts/**/*.app') == ''
Templates/Per Tenant Extension/.github/workflows/CICD.yaml:373
- The complementary skip check must use the same Apps-only match as the deploy condition. With only TestApps present, this broad hash is nonempty, so after correcting the deploy guard the workflow would show neither deployment nor the intended skip notice.
if: hashFiles('.artifacts/**/*.app') == ''
Templates/Per Tenant Extension/.github/workflows/CICD.yaml:436
- The skip notice needs the same Apps-only predicate as Deliver. Otherwise a test-only or dependency-only artifact makes this broad hash nonempty, suppressing the notice even though there is no valid Apps artifact to deliver.
if: hashFiles('.artifacts/**/*.app') == ''
|
|
||
| - name: Deploy to Business Central | ||
| id: Deploy | ||
| if: hashFiles('.artifacts/**/*.app') != '' |
|
|
||
| - name: Deploy to Business Central | ||
| id: Deploy | ||
| if: hashFiles('.artifacts/**/*.app') != '' |
❔What, Why & How
This pull request improves the CI/CD workflow for both AppSource App and Per Tenant Extension templates by ensuring that the Deploy and Deliver actions are only executed when app artifacts are present. This prevents errors that could occur on initial commits or when no artifacts are generated.
Workflow improvements for artifact handling:
Added a conditional check (
if: hashFiles('.artifacts/**/*.app') != '') to the Deploy step inTemplates/AppSource App/.github/workflows/CICD.yamlandTemplates/Per Tenant Extension/.github/workflows/CICD.yamlto skip deployment when no.appartifacts are found.Added the same conditional check to the Deliver step in both workflow files to skip delivery when no artifacts are present.
Added notice steps that display informative messages when Deploy or Deliver steps are skipped due to no app artifacts:
E.g.
Documentation updates:
RELEASENOTES.mdto document that Deliver and Deploy actions now skip execution when no app artifacts are found, preventing errors on initial commits.Scenarios/DeliveryTargets.mdto clarify that custom delivery scripts will not execute when delivery is skipped due to missing app artifacts, specifically noting this prevents errors on initial commits when no apps have been built yet.✅ Checklist
Related to #2126
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.