Skip to content

Composite GHA action with caching#10026

Draft
LinuxJedi wants to merge 1 commit intowolfSSL:masterfrom
LinuxJedi:actions-composite-caching
Draft

Composite GHA action with caching#10026
LinuxJedi wants to merge 1 commit intowolfSSL:masterfrom
LinuxJedi:actions-composite-caching

Conversation

@LinuxJedi
Copy link
Member

This adds caching for apt and should make things a bit more stable and faster.

Copilot AI review requested due to automatic review settings March 20, 2026 14:00
Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@LinuxJedi LinuxJedi force-pushed the actions-composite-caching branch from 499bd8a to 3eb4eb5 Compare March 20, 2026 15:00
Copilot AI review requested due to automatic review settings March 20, 2026 15:20
@LinuxJedi LinuxJedi force-pushed the actions-composite-caching branch from 3eb4eb5 to b2d28ab Compare March 20, 2026 15:20
Copy link
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

Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

uses: actions/checkout@v4
with:
sparse-checkout: .github/actions
depth: 1
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

actions/checkout@v4 does not support an input named depth; the correct input is fetch-depth. As written, this will likely perform the default (non-shallow) checkout, which is slower and undermines the intent of adding a lightweight checkout for .github/actions. Replace depth: 1 with fetch-depth: 1 (and apply the same change to the other workflows that introduced depth).

Suggested change
depth: 1
fetch-depth: 1

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +38
for i in 1 2 3; do
sudo apt-get update && sudo apt-get install -y linux-headers-$(uname -r) && break
echo "::warning::apt-get failed (attempt $i/3), retrying..."
sleep $((5 * i))
done || $(exit 2)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

|| $(exit 2) is invalid/unsafe shell usage (command substitution) and will not reliably terminate the step as intended. Use || exit 2 (or check success explicitly after the loop) so the workflow fails correctly when all retries are exhausted.

Copilot uses AI. Check for mistakes.
Comment on lines +214 to +216
uses: ./wolfssl/.github/actions/install-apt-deps
with:
packages: libpcap0.8 libpcap-dev curl libcurl4-openssl-dev libnl-3-dev binutils-dev libssl-dev libiberty-dev libnl-genl-3-dev libnl-route-3-dev libdbus-1-dev bridge-utils tshark python3-pycryptodome
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

This introduces a hard dependency on the local path ./wolfssl/.github/actions/install-apt-deps existing at runtime. In this job, the workflow previously did not require any repo checkout prior to installing deps, so this path may not exist and will cause the job to fail with “action not found”. Prefer checking out .github/actions into the workspace (as other workflows do) and referencing the action as ./.github/actions/install-apt-deps, or otherwise ensure ./wolfssl is present before this step.

Copilot uses AI. Check for mistakes.
Comment on lines +48 to 49
packages: build-essential autoconf automake libtool jq psmisc

Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The previous implementation intentionally fell back to installing without psmisc if that package install failed. With the composite action, the step will now fail hard if psmisc is unavailable or temporarily uninstallable on the runner image. If that fallback is still needed, consider (a) restoring the conditional fallback logic here, or (b) extending install-apt-deps to support optional packages (e.g., an optional-packages input) so the workflow keeps its prior resilience.

Suggested change
packages: build-essential autoconf automake libtool jq psmisc
packages: build-essential autoconf automake libtool jq
- name: Install optional psmisc
continue-on-error: true
run: |
sudo apt-get update
sudo apt-get install -y psmisc

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +32
SORTED_PKGS=$(echo "${{ inputs.packages }}" | tr ' ' '\n' | sort | tr '\n' ' ')
PKG_HASH=$(echo "$SORTED_PKGS" | sha256sum | cut -d' ' -f1 | head -c 16)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The action expands ${{ inputs.packages }} unquoted into a shell command, which is fragile and can become a shell-injection vector if the input is ever derived from untrusted data (or even just contains unexpected whitespace/newlines). It also reduces cache hit-rate when callers include duplicate packages because the cache key is based on raw sorted tokens. Consider parsing packages into a bash array safely (e.g., read into an array and pass as \"${pkgs[@]}\"), and normalize the cache-key input with sort -u to dedupe packages so semantically-identical lists share a cache.

Copilot uses AI. Check for mistakes.
fi
for i in $(seq 1 $RETRIES); do
if sudo apt-get update -q && \
sudo apt-get install -y $NO_REC ${{ inputs.packages }}; then
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The action expands ${{ inputs.packages }} unquoted into a shell command, which is fragile and can become a shell-injection vector if the input is ever derived from untrusted data (or even just contains unexpected whitespace/newlines). It also reduces cache hit-rate when callers include duplicate packages because the cache key is based on raw sorted tokens. Consider parsing packages into a bash array safely (e.g., read into an array and pass as \"${pkgs[@]}\"), and normalize the cache-key input with sort -u to dedupe packages so semantically-identical lists share a cache.

Copilot uses AI. Check for mistakes.
This adds caching for apt and should make things a bit more stable and
faster.
@LinuxJedi LinuxJedi force-pushed the actions-composite-caching branch from b2d28ab to 410cad2 Compare March 20, 2026 16:23
Copy link

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10026

No scan targets match the changed files in this PR. Review skipped.

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.

3 participants