Skip to content

Commit

Permalink
feat: enable IPv6 support for container environments
Browse files Browse the repository at this point in the history
- Add extraction and logging of container IPv6 address
- Set container IPv6 as an environment variable
- Add step to use and display the container IPv6 address

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Jun 6, 2024
1 parent c3194c4 commit 6049c74
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ jobs:
# Extract the container IP from /etc/hosts
CONTAINER_IP=$(grep $(hostname) /etc/hosts | awk '{ print $1 }')
echo "Container IP: $CONTAINER_IP"
CONTAINER_IPV6=$(grep $(hostname) /etc/hosts | grep -oP '([a-fA-F0-9:]+:+)+[a-fA-F0-9]+')
echo "Container IPv6: $CONTAINER_IPV6"
# Set the container IP as an environment variable
echo "CONTAINER_IP=$CONTAINER_IP" >> $GITHUB_ENV
# Set the container IPv6 as an environment variable
echo "CONTAINER_IPV6=$CONTAINER_IPV6" >> $GITHUB_ENV
- name: Use Container IPv6
run: echo "The container IPv6 is ${{ env.CONTAINER_IPV6 }}"

- name: Use Container IP
run: echo "The container IP is ${{ env.CONTAINER_IP }}"

0 comments on commit 6049c74

Please sign in to comment.