-
Notifications
You must be signed in to change notification settings - Fork 3.7k
preinstall 3 versions of awf for agentic workflow #13937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/bin/bash -e | ||
| ################################################################################ | ||
| ## File: install-awf.sh | ||
| ## Desc: Install Agent Workflow Firewall JS bundle (most recent 3 versions) | ||
| ## Supply chain security: AWF - checksum validation | ||
| ################################################################################ | ||
|
|
||
| # Source the helpers for use with the script | ||
| source $HELPER_SCRIPTS/install.sh | ||
| 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 | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Number of versions to install (current + 2 previous) | ||
| NUM_VERSIONS=3 | ||
|
|
||
| # 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') | ||
|
|
||
|
Comment on lines
+14
to
+17
|
||
| if [[ -z "$versions" ]]; then | ||
| echo "Error: Unable to find AWF releases." | ||
| exit 1 | ||
| fi | ||
|
|
||
| for tag in $versions; do | ||
| version="${tag#v}" | ||
| echo "Installing AWF JS bundle version $version to toolcache..." | ||
|
|
||
| # Download the JS bundle | ||
| bundle_url="https://github.com/github/gh-aw-firewall/releases/download/${tag}/awf-bundle.js" | ||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| external_hash=$(get_checksum_from_url "$checksums_url" "awf-bundle.js" "SHA256") | ||
| use_checksum_comparison "$bundle_path" "$external_hash" | ||
|
|
||
| # Install to toolcache | ||
| awf_toolcache_path="$AGENT_TOOLSDIRECTORY/agentic-workflow-firewall-js/$version/x64" | ||
| mkdir -p "$awf_toolcache_path" | ||
| cp "$bundle_path" "$awf_toolcache_path/awf-bundle.js" | ||
|
|
||
| # Mark installation complete | ||
| touch "$AGENT_TOOLSDIRECTORY/agentic-workflow-firewall-js/$version/x64.complete" | ||
| done | ||
|
|
||
| invoke_tests "Tools" "AWF" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/bin/bash -e | ||
| ################################################################################ | ||
| ## File: install-copilot-cli.sh | ||
| ## Desc: Install Copilot CLI (most recent 3 versions) | ||
| ## Supply chain security: Copilot CLI - checksum validation | ||
| ################################################################################ | ||
|
|
||
| # Source the helpers for use with the script | ||
| source $HELPER_SCRIPTS/install.sh | ||
| 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 | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Number of versions to cache (current + 2 previous) | ||
| NUM_VERSIONS=3 | ||
|
|
||
| # Get the most recent stable releases (exclude pre-releases, rc, and beta) | ||
| releases=$(curl -fsSL "https://api.github.com/repos/github/copilot-cli/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') | ||
|
|
||
|
aiqiaoy marked this conversation as resolved.
Outdated
|
||
| if [[ -z "$versions" ]]; then | ||
| echo "Error: Unable to find Copilot CLI releases." | ||
| exit 1 | ||
| fi | ||
|
|
||
| for tag in $versions; do | ||
| version="${tag#v}" | ||
| echo "Installing Copilot CLI version $version to toolcache..." | ||
|
|
||
| # Download Copilot CLI | ||
| archive_url="https://github.com/github/copilot-cli/releases/download/${tag}/copilot-linux-x64.tar.gz" | ||
| copilot_cli_archive=$(download_with_retry "$archive_url") | ||
|
|
||
| # Supply chain security - Copilot CLI | ||
| checksums_url="https://github.com/github/copilot-cli/releases/download/${tag}/SHA256SUMS.txt" | ||
| external_hash=$(get_checksum_from_url "$checksums_url" "copilot-linux-x64.tar.gz" "SHA256") | ||
| use_checksum_comparison "$copilot_cli_archive" "$external_hash" | ||
|
|
||
| # Install to toolcache | ||
| copilot_cli_toolcache_path="$AGENT_TOOLSDIRECTORY/copilot-cli/$version/x64" | ||
| mkdir -p "$copilot_cli_toolcache_path" | ||
| tar -xzf "$copilot_cli_archive" -C "$copilot_cli_toolcache_path" | ||
|
|
||
| # Mark installation complete | ||
| touch "$AGENT_TOOLSDIRECTORY/copilot-cli/$version/x64.complete" | ||
| done | ||
|
|
||
| # Symlink the latest version to /usr/local/bin | ||
| latest_version=$(echo "$versions" | head -n 1) | ||
| latest_version="${latest_version#v}" | ||
| ln -sf "$AGENT_TOOLSDIRECTORY/copilot-cli/$latest_version/x64/copilot" /usr/local/bin/copilot | ||
|
|
||
| invoke_tests "CLI.Tools" "Copilot CLI" | ||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Updated