Skip to content

preinstall 3 versions of awf for agentic workflow#13937

Open
aiqiaoy wants to merge 3 commits intoactions:mainfrom
aiqiaoy:aiqiaoy/preinstall-tools-aw
Open

preinstall 3 versions of awf for agentic workflow#13937
aiqiaoy wants to merge 3 commits intoactions:mainfrom
aiqiaoy:aiqiaoy/preinstall-tools-aw

Conversation

@aiqiaoy
Copy link
Copy Markdown

@aiqiaoy aiqiaoy commented Apr 16, 2026

Description

New tool, Bug fixing, or Improvement?
Please include a summary of the change and which issue is fixed. Also include relevant motivation and context.
For new tools, please provide total size and installation time.

Following ADR to pre-install awf js bundle in runner images. 3 versions of awf bundle ~1MB.

Related issue: https://github.com/github/c2c-actions/issues/9991

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

Copilot AI review requested due to automatic review settings April 16, 2026 14:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds preinstallation of Agentic Workflow tooling to the Ubuntu runner images to reduce setup time for agentic workflows by caching multiple versions of the AWF JS bundle and the Copilot CLI in the toolcache.

Changes:

  • Add Ubuntu build scripts to install and toolcache the latest 3 stable versions of copilot-cli and the AWF JS bundle (skipping Ubuntu 22.04).
  • Wire the new installers into the Ubuntu 22.04/24.04 Packer templates.
  • Add Pester tests validating the AWF toolcache layout and that the Copilot CLI is present and runnable.
Show a summary per file
File Description
images/ubuntu/templates/build.ubuntu-24_04.pkr.hcl Adds AWF + Copilot CLI installers to the 24.04 build pipeline.
images/ubuntu/templates/build.ubuntu-22_04.pkr.hcl Adds the same installers (scripts self-skip on 22.04).
images/ubuntu/scripts/tests/Tools.Tests.ps1 Adds AWF toolcache validation tests (skipped on 22.04).
images/ubuntu/scripts/tests/CLI.Tools.Tests.ps1 Adds Copilot CLI presence/version tests (skipped on 22.04).
images/ubuntu/scripts/build/install-copilot-cli.sh New installer that caches multiple Copilot CLI versions + symlinks latest.
images/ubuntu/scripts/build/install-awf.sh New installer that caches multiple AWF JS bundle versions in toolcache.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 3

Comment on lines +20 to +23
# Get the most recent stable releases (exclude pre-releases, beta and release without assets)
releases=$(curl -fsSL "https://api.github.com/repos/github/gh-aw-firewall/releases?per_page=10")
versions=$(echo "$releases" | jq -r '[.[] | select(.assets | length > 0) | select(.prerelease == false) | select(.tag_name | test(".*-[a-z]|beta") | not)] | .[:'"$NUM_VERSIONS"'] | .[].tag_name')

Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The GitHub release query uses per_page=10 and only checks that a release has some assets, not that it includes awf-bundle.js/checksums.txt. This can lead to caching fewer than NUM_VERSIONS versions or failing downloads if a release is missing the expected files. Prefer using helpers/install.sh (get_github_releases_by_version + resolve_github_release_asset_url) or filter releases by the required asset name and increase the page size so you can reliably install 3 stable versions.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

já verifiquei as mudanças a serem feitas.

Comment thread images/ubuntu/scripts/tests/CLI.Tools.Tests.ps1 Outdated
Comment thread images/ubuntu/scripts/build/install-copilot-cli.sh Outdated
@aiqiaoy aiqiaoy changed the title preinstall 3 versions of awf and copilot-cli for agentic workflow preinstall 3 versions of awf for agentic workflow Apr 16, 2026
bundle_path=$(download_with_retry "$bundle_url")

# Supply chain security - AWF
checksums_url="https://github.com/github/gh-aw-firewall/releases/download/${tag}/checksums.txt"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Curious, how do we enforce the security here? If someone was able to update release artifacts then they could equally update the checksum file too.

Copy link
Copy Markdown
Author

@aiqiaoy aiqiaoy Apr 17, 2026

Choose a reason for hiding this comment

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

Yeah good point. I think we need to verify signature to be fully protected, although this check sum validation is an existing pattern in our install scripts

source $HELPER_SCRIPTS/os.sh

# Following the pattern in install-docker.sh where the core AW container images are only installed on ubuntu-latest
if is_ubuntu22; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given this code do you need updating ubuntu-22 Packer template?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point. Updated

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.

4 participants