Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

❔What, Why & How

Federated credentials require stable repository identity. Refactored the test to reuse e2e-bingmaps.appsource instead of deleting/recreating tmp-bingmaps.appsource on each run. Test is currently disabled in the workflow pending Azure resource migration.

Helper functions added to e2eTestHelper.psm1:

  • CleanupWorkflowRuns: Deletes all workflow runs in a repository (ensures clean tracking state)
  • ResetRepositoryToSource: Hard resets repository content to match source via git reset --hard + force push (preserves identity, resets content)

Test flow changes in scenarios/FederatedCredentials/runtest.ps1:

  • Renamed repository: tmp-bingmaps.appsourcee2e-bingmaps.appsource (avoids tmp* cleanup pattern)
  • Requires pre-existing repository with federated credentials configured (errors if missing)
  • Resets to bcsamples-bingmaps.appsource content before each run
  • Cleans all workflow runs before triggering new ones
  • Re-applies test settings (ghTokenWorkflowSecretName) after reset
  • Timestamp-based workflow tracking (waits for correct CI/CD run)

Workflow changes in .github/workflows/E2E.yaml:

  • Filters out FederatedCredentials from scenario matrix (temporarily disabled)

Technical details:

  • Mandatory parameters on helper functions
  • GUID-based temp paths
  • LASTEXITCODE checks after git operations
  • Removed unsupported -- --quiet flag from gh repo clone

When re-enabled, the test will use the stable repository instead of recreating it, maintaining federated credential authentication.

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry
Original prompt

Refactor the FederatedCredentials end-to-end test scenario in microsoft/AL-Go so it reuses an existing temporary repository instead of deleting and recreating it on every run. The current approach creates a new repository called tmp-bingmaps.appsource copied from microsoft/bcsamples-bingmaps.appsource. Federated credentials no longer work with repository name-based matching, so the repository must be stable across runs.

Context:

  • Failing job URL: https://github.com/microsoft/AL-Go/actions/runs/21470716621/job/61842467415
  • Failure occurs when the test triggers the "Update AL-Go System Files" workflow in the newly created repository.
  • The test script is at e2eTests/scenarios/FederatedCredentials/runtest.ps1 and currently:
    • checks if the temp repo exists
    • deletes it if it exists
    • recreates it from template
    • then runs Update AL-Go System Files

Required changes:

  1. Modify e2eTests/scenarios/FederatedCredentials/runtest.ps1 to reuse the repo if it already exists.
    • Do not delete the repo anymore.
    • If the repo exists, reset it to match the source repo (microsoft/bcsamples-bingmaps.appsource) in a deterministic way.
    • Ensure the repo ends up with the same default branch content expected by the scenario (main).
  2. Add cleanup logic for workflow runs in the reused temp repo to prevent the run list from growing and to ensure the subsequent WaitWorkflow logic targets the correct run.
    • Before starting the scenario, delete older workflow runs (keep a small number like the last 5-10), or alternatively capture the run id of the workflow triggered and wait specifically for that.
  3. Ensure secrets and settings required for the test are still present/updated.
    • The script sets Azure_Credentials; preserve this.
    • The script passes addRepoSettings for ghTokenWorkflowSecretName; ensure this still works if repo already exists.
  4. Update any helper functions or supporting scripts if needed to support resetting repo contents and cleaning workflow runs.

Acceptance criteria:

  • The test no longer relies on deleting/recreating tmp-bingmaps.appsource.
  • The temp repo is stable across runs and compatible with federated credentials.
  • The script reliably waits for and inspects the workflow run it triggered, not an older run.
  • Add clear comments explaining why the repo is reused.

Relevant files:

  • e2eTests/scenarios/FederatedCredentials/runtest.ps1
  • e2eTests/Workflows/RunUpdateAlGoSystemFiles.ps1 (workflow trigger helper)
  • Any relevant helper module under e2eTests/e2eTestHelper.psm1 if needed.

This pull request was created from Copilot chat.


💡 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.

Copilot AI and others added 3 commits January 29, 2026 10:51
…repository

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
…rove pagination and timestamp comparison

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor FederatedCredentials test to reuse temporary repository Refactor FederatedCredentials test to reuse temporary repository Jan 29, 2026
Copilot AI requested a review from mazhelez January 29, 2026 10:59
…federated credentials

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copilot AI changed the title Refactor FederatedCredentials test to reuse temporary repository Refactor FederatedCredentials test to require pre-existing repository with federated credentials Jan 29, 2026
Copilot AI requested a review from mazhelez January 29, 2026 12:03
Copy link
Collaborator

@mazhelez mazhelez left a comment

Choose a reason for hiding this comment

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

Good work!

@copilot the following script is used in a workflow to clean up temp repositories: "Internal\Scripts\RemoveTempRepos.ps1"
Can you adjust the script or rename the repository, so that it doesn't get deleted?

…function, exclude tmp-bingmaps from cleanup

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

Good work!

@copilot the following script is used in a workflow to clean up temp repositories: "Internal\Scripts\RemoveTempRepos.ps1"...

Done. Updated Internal/Scripts/RemoveTempRepos.ps1 to exclude tmp-bingmaps.appsource from automatic deletion. The repository will now remain stable across cleanup operations. Commit: 2309402

Copilot AI requested a review from mazhelez January 29, 2026 12:24
…ce to avoid auto-cleanup

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copilot AI changed the title Refactor FederatedCredentials test to require pre-existing repository with federated credentials Refactor FederatedCredentials test to use stable e2e-bingmaps.appsource repository Jan 29, 2026
Copilot AI requested a review from mazhelez January 29, 2026 12:29
Copy link
Collaborator

@mazhelez mazhelez left a comment

Choose a reason for hiding this comment

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

Getting there.

@copilot can you please also remove trailing whitespaces?

Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

Getting there.

@copilot can you please also remove trailing whitespaces?

Done. Removed trailing whitespaces from runtest.ps1 (lines 131-132). Commit: 626a791

Copilot AI requested a review from mazhelez January 29, 2026 13:10
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
…h repo clone

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copilot AI changed the title Refactor FederatedCredentials test to use stable e2e-bingmaps.appsource repository Fix e2e test failure: remove unsupported --quiet flag from gh repo clone Jan 30, 2026
@mazhelez mazhelez changed the title Fix e2e test failure: remove unsupported --quiet flag from gh repo clone Refactor e2e Federated Credentials test to use a fixed repository Feb 2, 2026
@mazhelez
Copy link
Collaborator

mazhelez commented Feb 3, 2026

@copilot can you please resolve the merge conflicts?

Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot can you please resolve the merge conflicts?

Done. Resolved merge conflicts by taking the updated base from main branch and re-adding our two helper functions (CleanupWorkflowRuns and ResetRepositoryToSource) at lines 345 and 397 respectively. Commit: 44d1b6c

Copilot AI changed the title Refactor e2e Federated Credentials test to use a fixed repository Refactor e2e Federated Credentials test to use a stable repository Feb 3, 2026
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Copilot AI changed the title Refactor e2e Federated Credentials test to use a stable repository Refactor FederatedCredentials e2e test to use stable repository (currently disabled) Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants