Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker image pull to client-server job workflow #182

141 changes: 136 additions & 5 deletions .github/workflows/sc-client-server-deb10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,50 @@ on:
- '.dockerignore'
- 'sai.env'

env:
DOCKER_BASE: 'dockerfiles/bullseye/Dockerfile'
yuriilisovskyi marked this conversation as resolved.
Show resolved Hide resolved
DOCKER_REDIS: 'npu/broadcom/BCM56850/saivs/Dockerfile'
DOCKER_THRIFT: 'npu/broadcom/BCM56850/saivs/Dockerfile.saithrift'
REDIS_RPC: 0
THRIFT_RPC: 0

jobs:
build-sc-server:
name: Build SAI Challenger server image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Update submodules
run: git submodule update --init

- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT

- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_RPC=1" >> $GITHUB_ENV
fi
done
for file in "$DOCKER_BASE" "$DOCKER_THRIFT" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "THRIFT_RPC=1" >> $GITHUB_ENV
fi
done

- name: Build server Docker image
run: ./build.sh -i server -o deb10
if: ${{ env.REDIS_RPC == '1' }}

- name: Pull SAI-C server
run: ./run.sh -i server -o deb10
if: ${{ env.REDIS_RPC == '0' }}

- name: Save server Docker image
run: docker save sc-server-trident2-saivs > sc-server.tar
- name: Upload server image
Expand All @@ -45,19 +79,58 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Update submodules
run: git submodule update --init

- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT

- name: Check what Docker images have to be rebuild
run: |
changed_files=$(git diff --name-only origin/HEAD | xargs)
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
if [[ "$changed_files" == *"$file"* ]]; then
echo "REDIS_RPC=1"
fi
done
for file in "$DOCKER_BASE" "$DOCKER_THRIFT" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "THRIFT_RPC=1" >> $GITHUB_ENV
fi
done

- name: Build client Docker image
run: ./build.sh -i client -o deb10 --nosnappi
- name: Build client Docker image with SAI thrift
run: ./build.sh -i client -s thrift -o deb10 --nosnappi
if: ${{ env.REDIS_RPC == '1' }}
- name: Build thrift client Docker image
run: ./build.sh -i client -o deb11 -s thrift --nosnappi
if: ${{ env.THRIFT_RPC == '1' }}

- name: Pull SAI-C client
run: ./run.sh -i client -o deb10
if: ${{ env.REDIS_RPC == '0' }}
- name: Pull SAI-C thrift client
run: ./run.sh -i client -s thrift -o deb10
if: ${{ env.THRIFT_RPC == '0' }}

- name: Save client Docker image
run: docker save sc-client > sc-client.tar
- name: Upload client Docker image
uses: actions/upload-artifact@v3
with:
name: Client Image
path: sc-client.tar
- name: Save SAI Thrift client Docker image
yuriilisovskyi marked this conversation as resolved.
Show resolved Hide resolved
run: docker save sc-thrift-client > sc-thrift-client.tar
- name: Upload SAI Thrift client Docker image
uses: actions/upload-artifact@v3
with:
name: Client Thrift Image
path: sc-thrift-client.tar

run-sc-tests:
name: Run SAI Challenger tests in client-server mode
Expand All @@ -67,6 +140,7 @@ jobs:
- uses: actions/checkout@v3
- name: Update submodules.
run: git submodule update --init

- name: Download client Docker image
uses: actions/download-artifact@v3
with:
Expand All @@ -87,18 +161,75 @@ jobs:
uses: geekyeggo/delete-artifact@v2
with:
name: Server Image
- name: Start SAI-C client

- name: Start SAI-C in client mode
yuriilisovskyi marked this conversation as resolved.
Show resolved Hide resolved
run: ./run.sh -i client -o deb10
- name: Wait for the client to get the IP address first
run: sleep 5s
- name: Start SAI-C server
run: ./run.sh -i server -a trident2 -t saivs -o deb10
- name: Start SAI-C in server mode
run: ./run.sh -i server -o deb10
- name: Update SAI-C server package
run: ./exec.sh -i server --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
- name: Update SAI-C client package
run: ./exec.sh -i client --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
- name: Create veth links between client and server dockers
run: sudo ./veth-create-host.sh sc-server-trident2-saivs-run sc-client-run

- name: Run functional test cases
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k "test_l2_basic"
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k \
"test_acl_ut or test_bridge_ut or (test_switch_ut and not sai_map_list_t) or test_vrf_ut or test_port_ut.py"
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v test_l2_basic_dd.py

- name: Start SAI-C in client mode
run: ./run.sh -i client -o deb10 stop
- name: Start SAI-C in server mode
run: ./run.sh -i server -o deb10 stop

- name: Download SAI Thrift client Docker image
uses: actions/download-artifact@v3
with:
name: Client Thrift Image
- name: Load client image
run: docker load < sc-thrift-client.tar
- name: Download SAI Thrift server Docker image
uses: actions/download-artifact@v3
with:
name: Server Thrift Image
- name: Load server image
run: docker load < sc-server.tar
- name: Delete SAI Thrift client image artifact
uses: geekyeggo/delete-artifact@v2
with:
name: Client Thrift Image
- name: Delete SAI Thrift server image artifact
uses: geekyeggo/delete-artifact@v2
with:
name: Server Thrift Image

- name: Start SAI-C in client mode with SAI thrift
run: ./run.sh -i client -s thrift -o deb10
- name: Wait for the client to get the IP address first
run: sleep 5s
- name: Start SAI-C in server mode with SAI thrift
run: ./run.sh -i server -s thrift -o deb10
- name: Update SAI-C package
run: ./exec.sh --no-tty -s thrift -i server pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.THRIFT_RPC == '0' }}
- name: Update SAI-C package
run: ./exec.sh --no-tty -s thrift -i client pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.THRIFT_RPC == '0' }}
- name: Create veth links between client and server dockers
run: sudo ./veth-create-host.sh sc-thrift-server-trident2-saivs-run sc-thrift-client-run
- name: Run thrift tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic.py -v test_vrf.py -v test_dc_t1.py
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic_dd.py
- name: Run thrift unit tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py
- name: Run thrift sairedis tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "test_sairec"
Loading
Loading