Skip to content

Move APM packaging into own job with minimal permissions#22738

Merged
pelikhan merged 4 commits intomainfrom
copilot/move-apm-packaging-into-own-job
Mar 24, 2026
Merged

Move APM packaging into own job with minimal permissions#22738
pelikhan merged 4 commits intomainfrom
copilot/move-apm-packaging-into-own-job

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

Summary

Moves APM (Agent Package Manager) packing out of the activation job into a new dedicated apm job, and gives it minimal permissions.

What changed

New apm job:

  • needs: activation — runs after activation, getting needs.activation.outputs.target_repo_name for cross-org workflow_call fallback (replacing the old steps.resolve-host-repo.outputs.target_repo_name reference)
  • permissions: {} — minimal permissions; all tokens are passed explicitly via secrets/env (no GITHUB_TOKEN scope needed: microsoft/apm-action uses the explicit GITHUB_TOKEN env, actions/upload-artifact uses ACTIONS_RUNTIME_TOKEN, actions/create-github-app-token uses app credentials from secrets, and token revocation uses the minted token directly)
  • Contains: GitHub App token mint step (if configured), microsoft/apm-action pack step, bundle artifact upload, GitHub App token invalidation step (if configured)

Agent job: now needs: [activation, apm] when APM dependencies are configured (mirrors the existing indexing job pattern). activation stays in needs so needs.activation.outputs.* expressions remain resolvable.

Activation job: APM pack/upload/token steps and GH_AW_INFO_APM_VERSION job env are removed.

Files changed

  • pkg/constants/constants.go — added APMJobName JobName = "apm"
  • pkg/workflow/compiler_apm_job.go — new file: buildAPMJob() + buildAPMJobWrapper()
  • pkg/workflow/compiler_jobs.go — call buildAPMJobWrapper() when APM is configured
  • pkg/workflow/compiler_activation_job.go — remove APM steps and env var
  • pkg/workflow/compiler_main_job.go — add apm to agent job needs
  • pkg/workflow/apm_dependencies_compilation_test.go — updated assertions to check APM job
  • pkg/workflow/compiler_activation_jobs_test.go — moved token invalidation test to TestBuildAPMJob_TokenInvalidation
  • pkg/workflow/top_level_github_app_integration_test.go — updated comment
  • All 177 .lock.yml files recompiled


✨ PR Review Safe Output Test - Run 23509681612

💥 [THE END] — Illustrated by Smoke Claude ·


Changeset

  • Type: patch
  • Description: Moves APM packaging into a dedicated apm job with minimal permissions and updates agent job dependencies to consume APM outputs.

Generated by Changeset Generator for issue #22738 ·

- Add APMJobName constant to pkg/constants/constants.go
- Create compiler_apm_job.go with buildAPMJob() and buildAPMJobWrapper()
- Remove APM steps from activation job (compiler_activation_job.go)
- Add apm to agent job's needs in compiler_main_job.go
- Call buildAPMJobWrapper from buildJobs in compiler_jobs.go
- Update APM compilation tests to check new APM job structure
- Recompile all 177 workflow lock files

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/585cea56-aa1b-489a-9220-9d62657b0bda
Copilot AI review requested due to automatic review settings March 24, 2026 20:01
@pelikhan pelikhan added the smoke label Mar 24, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions github-actions bot removed the smoke label Mar 24, 2026
@github-actions
Copy link
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq 4.52.4
curl 8.5.0
gh 2.87.3
node 20.20.1
python3 3.12.3
go 1.24.13
java 21.0.10
dotnet 10.0.102

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Contributor

Smoke Test Results§23509681603

Test Status
GitHub MCP
MCP Scripts GH CLI
Serena MCP
Playwright
Web Fetch
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: ⚠️ PARTIAL PASS (11/12) — Serena MCP not available
@Copilot (author), @pelikhan (assignee)

📰 BREAKING: Report filed by Smoke Copilot ·

@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

Smoke Test Run 23509681612 — Results:

Core: ✅✅✅✅✅✅✅✅✅✅✅
PR Review: ✅✅✅⚠️✅✅⚠️

Overall: PARTIAL (tests #15 and #18 skipped — no threads/test-PR to act on)

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

// the packed bundle so the agent job can download and restore it.
//
// The APM job uses minimal permissions ({}) because all required tokens are passed
// explicitly via env/secrets rather than relying on the workflow's GITHUB_TOKEN scope.
Copy link
Contributor

Choose a reason for hiding this comment

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

Good separation of concerns — moving APM packaging into its own buildAPMJob function makes the activation job cleaner and the APM logic easier to test in isolation.

@@ -641,6 +641,7 @@ var DangerousPropertyNames = []string{

const AgentJobName JobName = "agent"
const ActivationJobName JobName = "activation"
Copy link
Contributor

Choose a reason for hiding this comment

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

The new APMJobName constant follows the existing naming pattern (AgentJobName, ActivationJobName, etc.) — consistent style.

@github-actions
Copy link
Contributor

Commit pushed: 9efa666

Generated by Changeset Generator

@github-actions
Copy link
Contributor

Smoke test (run 23509681637):

🔮 The oracle has spoken through Smoke Codex ·

@pelikhan pelikhan merged commit 8a117f1 into main Mar 24, 2026
54 checks passed
@pelikhan pelikhan deleted the copilot/move-apm-packaging-into-own-job branch March 24, 2026 21:22
Copilot AI review requested due to automatic review settings March 25, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants