-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/cd: fix IPv6 requests not working with
fetch
- Fixes Docker build checks failing because `localhost` is resolving to IPv6. - Fixes external URL checks failing because external URLs are resolving to IPv6.
- Loading branch information
1 parent
8a5592f
commit cbfcb91
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
inputs: | ||
project-root: | ||
required: false | ||
default: '.' | ||
runs: | ||
using: composite | ||
steps: | ||
- | ||
name: Run prefer IPv4 script | ||
shell: bash | ||
run: ./.github/actions/force-ipv4/force-ipv4.sh | ||
working-directory: ${{ inputs.project-root }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
main() { | ||
if is_linux; then | ||
echo 'Configuring Linux...' | ||
# prefer_ipv4_on_linux TODO: Not working | ||
disable_ipv6_on_linux | ||
elif is_macos; then | ||
echo 'Configuring macOS...' | ||
disable_ipv6_on_macos | ||
fi | ||
} | ||
|
||
is_linux() { | ||
[[ "$(uname -s)" == "Linux" ]] | ||
} | ||
|
||
is_macos() { | ||
[[ "$(uname -s)" == "Darwin" ]] | ||
} | ||
|
||
disable_ipv6_on_linux() { | ||
# sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 | ||
# sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 | ||
# sudo sysctl -p | ||
|
||
# local -r sysctl_conf="/etc/sysctl.conf" | ||
# echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a "$sysctl_conf" > /dev/null | ||
# echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a "$sysctl_conf" > /dev/null | ||
# echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a "$sysctl_conf" > /dev/null | ||
} | ||
|
||
prefer_ipv4_on_linux() { | ||
local -r gai_conf="/etc/gai.conf" | ||
if [ ! -f "$gai_conf" ]; then | ||
echo "Creating $gai_conf since it doesn't exist..." | ||
touch "$gai_conf" | ||
fi | ||
echo "precedence ::ffff:0:0/96 100" | sudo tee -a "$gai_conf" > /dev/null | ||
echo "Configuration complete." | ||
} | ||
|
||
disable_ipv6_on_macos() { | ||
networksetup -listallnetworkservices \ | ||
| tail -n +2 \ | ||
| while IFS= read -r interface; do | ||
echo "Disabling IPv6 on: $interface" | ||
networksetup -setv6off "$interface" | ||
done | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters