Merge branch 'ci/168-offline-fast-path' into tmp/168-download
This commit is contained in:
commit
18f834df36
5 files changed
+35
-28
No files matched your search
@@ -59,9 +59,11 @@ jobs:
|
||||
run: |
|
||||
if sha256sum --quiet -c /opt/ci-pins.sha256; then
|
||||
echo "The pin files match the ci image; using the baked tools."
|
||||
# -r adds a user namespace: a job container lacks CAP_SYS_ADMIN for a plain unshare -n.
|
||||
echo "OFFLINE=unshare -rn --" >> "$GITHUB_ENV"
|
||||
echo "::notice::The tool steps run without network; a download fails the job (bake it into images/ci)."
|
||||
# A job container may not unshare, so the network is cut by environment: pip, curl,
|
||||
# git over HTTPS and Python's urllib fail; a raw socket is not caught.
|
||||
printf '%s\n' PIP_NO_INDEX=1 http_proxy=http://127.0.0.1:9 https_proxy=http://127.0.0.1:9 \
|
||||
HTTP_PROXY=http://127.0.0.1:9 HTTPS_PROXY=http://127.0.0.1:9 no_proxy= NO_PROXY= >> "$GITHUB_ENV"
|
||||
echo "::notice::Later steps run with a dead proxy; a download fails the job (bake it into images/ci)."
|
||||
else
|
||||
echo "::warning::requirements-dev.txt, requirements-dev.lock, requirements.yml," \
|
||||
"extensions/molecule/requirements.yml or .pre-commit-config.yaml differ from the ci image;" \
|
||||
@@ -77,7 +79,7 @@ jobs:
|
||||
- name: Run pre-commit on all files
|
||||
run: |
|
||||
export PATH="/opt/venv/bin:$PATH"
|
||||
$OFFLINE pre-commit run --all-files --show-diff-on-failure
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
# Image pins (scripts/check_image_versions.py): a pin in a workflow must name an
|
||||
# image of the matrix. Not a pre-commit hook: a change to .pre-commit-config.yaml
|
||||
@@ -85,7 +87,7 @@ jobs:
|
||||
- name: Check image pins
|
||||
run: |
|
||||
export PATH="/opt/venv/bin:$PATH"
|
||||
$OFFLINE python3 scripts/check_image_versions.py pins
|
||||
python3 scripts/check_image_versions.py pins
|
||||
|
||||
# A pull request from a renovate/ branch may only move version, tag, digest and pin
|
||||
# lines (scripts/check_bot_pr_diff.py), so the bot's automerge cannot change workflow
|
||||
@@ -112,11 +114,12 @@ jobs:
|
||||
else
|
||||
echo "::notice::$BASE_REF has no scripts/check_bot_pr_diff.py yet; running the pull request's copy"
|
||||
fi
|
||||
$OFFLINE python3 -E -s "$guard" "$HEAD_REF" "$BASE_REF"
|
||||
python3 -E -s "$guard" "$HEAD_REF" "$BASE_REF"
|
||||
|
||||
# Online: a new network namespace has loopback down, and the image has no ip to bring it up for the fake registry.
|
||||
# Without the guard: an empty no_proxy would send the fake registry on 127.0.0.1 to the dead proxy.
|
||||
- name: Test the repository scripts
|
||||
run: |
|
||||
unset PIP_NO_INDEX http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
|
||||
export PATH="/opt/venv/bin:$PATH"
|
||||
python3 -m unittest discover -s tests/scripts
|
||||
|
||||
@@ -132,7 +135,7 @@ jobs:
|
||||
echo "gitleaks binary not found in the pre-commit cache" >&2
|
||||
exit 1
|
||||
fi
|
||||
$OFFLINE "$GITLEAKS" git --verbose --redact --log-opts="origin/main..$SHA"
|
||||
"$GITLEAKS" git --verbose --redact --log-opts="origin/main..$SHA"
|
||||
|
||||
# commit-msg stage hooks do not run under --all-files, so each commit's message is given to
|
||||
# every commit-msg hook (Conventional Commits, refuse-agent-trailers); --no-verify skips them locally.
|
||||
@@ -146,5 +149,5 @@ jobs:
|
||||
for sha in $(git rev-list --no-merges "origin/main..$SHA"); do
|
||||
git log -1 --format=%B "$sha" > "$MSG_FILE"
|
||||
echo "Checking $sha"
|
||||
$OFFLINE pre-commit run --hook-stage commit-msg --commit-msg-filename "$MSG_FILE"
|
||||
pre-commit run --hook-stage commit-msg --commit-msg-filename "$MSG_FILE"
|
||||
done
|
||||
Reference in new issue
Block a user