Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/smoke-copilot.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 1 addition & 14 deletions .github/workflows/smoke-copilot.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,7 @@ jobs:
steps:
- name: Build local AWF smoke images
timeout-minutes: 35
run: |
set -euo pipefail
AWF_SMOKE_IMAGE_TAG="run-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}"
HOST_UID="$(node -p "require('./dist/host-identity').getSafeHostUid()")"
HOST_GID="$(node -p "require('./dist/host-identity').getSafeHostGid()")"
for image in squid agent api-proxy; do
build_args=()
if [ "$image" = agent ]; then
build_args+=(--build-arg "USER_UID=$HOST_UID" --build-arg "USER_GID=$HOST_GID")
fi
docker build "${build_args[@]}" --tag "awf-smoke/${image}:${AWF_SMOKE_IMAGE_TAG}" "containers/${image}"
docker image inspect "awf-smoke/${image}:${AWF_SMOKE_IMAGE_TAG}" > /dev/null
done
printf 'AWF_SMOKE_IMAGE_TAG=%s\n' "$AWF_SMOKE_IMAGE_TAG" >> "$GITHUB_ENV"
run: bash "${RUNNER_TEMP}/awf-smoke/build-smoke-images.sh"
- name: Pre-compute smoke test data
run: |
echo "::group::Fetching last 2 merged PRs"
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/smoke-services.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .github/workflows/smoke-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ sandbox:
runtime: docker-sudo-iptables
strict: true
steps:
- name: Build local AWF smoke images
timeout-minutes: 35
run: bash "${RUNNER_TEMP}/awf-smoke/build-smoke-images.sh"
- name: Pre-install service client tools
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq redis-tools postgresql-client
Expand Down
18 changes: 15 additions & 3 deletions scripts/ci/apply-general-workflow-patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function applyGeneralWorkflowPatches(
workflowPath: string
): PatchResult {
const log: string[] = [];
const preparedSmokeImages = /(?:^|[/\\])smoke-copilot\.lock\.yml$/.test(workflowPath)
const preparedSmokeImages = /(?:^|[/\\])smoke-(?:copilot|services)\.lock\.yml$/.test(workflowPath)
&& content.includes('- name: Build local AWF smoke images\n');
const preparedSmokeImageArgs =
'--image-registry awf-smoke --image-tag "${AWF_SMOKE_IMAGE_TAG:?}" --skip-pull';
Expand Down Expand Up @@ -548,12 +548,24 @@ export function applyGeneralWorkflowPatches(
);
const localInstall = /^ {6}- name: Install awf binary \(local\)\n(?: {8}.*\n|\n)*/m;
if (!preparation || !localInstall.test(content)) {
throw new Error('Smoke Copilot image preparation requires the local AWF install step');
throw new Error('Smoke image preparation requires the local AWF install step');
}
const preserveHelperStep =
' - name: Preserve smoke image preparation helper\n' +
' run: |\n' +
' mkdir -p "${RUNNER_TEMP}/awf-smoke"\n' +
' cp "${GITHUB_WORKSPACE}/scripts/ci/build-smoke-images.sh" "${RUNNER_TEMP}/awf-smoke/build-smoke-images.sh"\n';
if (!content.includes(preserveHelperStep)) {
const prCheckout = /^ - name: Checkout PR branch\n id: checkout-pr\n/m;
if (!prCheckout.test(content)) {
throw new Error('Smoke image preparation requires the PR checkout step');
}
content = content.replace(prCheckout, `${preserveHelperStep}$&`);
}
content = content.replace(preparation[0], '');
content = content.replace(localInstall, step => step + preparation[0]);
content = content.replace(/--build-local\b/g, preparedSmokeImageArgs);
log.push(' Reused prepared PR images outside the Smoke Copilot execution budget');
log.push(' Reused prepared PR images outside the smoke execution budget');
}
}

Expand Down
15 changes: 15 additions & 0 deletions scripts/ci/build-smoke-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

AWF_SMOKE_IMAGE_TAG="run-${GITHUB_RUN_ID:?}-${GITHUB_RUN_ATTEMPT:?}"
HOST_UID="$(node -p "require('./dist/host-identity').getSafeHostUid()")"
HOST_GID="$(node -p "require('./dist/host-identity').getSafeHostGid()")"
for image in squid agent api-proxy; do
build_args=()
if [ "$image" = agent ]; then
build_args+=(--build-arg "USER_UID=$HOST_UID" --build-arg "USER_GID=$HOST_GID")
fi
docker build "${build_args[@]}" --tag "awf-smoke/${image}:${AWF_SMOKE_IMAGE_TAG}" "containers/${image}"
docker image inspect "awf-smoke/${image}:${AWF_SMOKE_IMAGE_TAG}" > /dev/null
done
printf 'AWF_SMOKE_IMAGE_TAG=%s\n' "$AWF_SMOKE_IMAGE_TAG" >> "$GITHUB_ENV"
Loading
Loading