Files
rancher/.github/workflows/integration-tests.yml
2025-12-02 13:24:40 -05:00

98 lines
3.7 KiB
YAML

name: Integration Tests
on:
workflow_call:
env:
TAG: v2.14-${{ github.sha }}-head
GIT_TAG: v2.14-${{ github.sha }}-head
HOST_ARCH: amd64
ARCH: amd64
PYTHON_VERSION: '3.11'
GOLANG_VERSION: '1.25'
IMAGE: ${{ github.repository_owner }}/rancher
IMAGE_AGENT: ${{ github.repository_owner }}/rancher-agent
REPO: ${{ github.repository_owner }}
jobs:
test:
runs-on:
- runs-on
- spot=false
- runner=16cpu-linux-x64
- run-id=${{ github.run_id }}
timeout-minutes: 60
env:
K3D_VERSION: v5.7.1
steps:
- name: Checkout code
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Configure Docker for cgroupfs
run: |
echo '{"exec-opts": ["native.cgroupdriver=cgroupfs"]}'| sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
- name: Setup Environment Variables
uses: ./.github/actions/setup-tag-env
- id: env
name: Setup Dependencies Env Variables
uses: ./.github/actions/setup-build-env
- name: Download Docker images artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: "/tmp"
merge-multiple: true
- name: Load server image
run: |
image_server_id=$(docker load --input /tmp/rancher-linux-amd64.tar 2>&1 | grep "Loaded image" | awk '{print $NF}')
if [ -z "$image_server_id" ]; then
echo "Error: Failed to load image from tarball!"
exit 1
fi
AMD_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "rancher/rancher:.*amd64.*$" | head -n 1)
echo "the image created is $AMD_IMAGE"
docker tag "$image_server_id" ${{ env.IMAGE }}:${{ env.TAG }}
docker image ls
docker rmi "$AMD_IMAGE"
docker image ls
- name: Load agent image
run: |
image_agent_id=$(docker load --input /tmp/rancher-agent-linux-amd64.tar 2>&1 | grep "Loaded image" | awk '{print $NF}')
if [ -z "$image_agent_id" ]; then
echo "Error: Failed to load image from tarball!"
exit 1
fi
AMD_IMAGE_AGENT=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "rancher/rancher-agent:.*amd64.*$" | head -n 1)
docker tag "$image_agent_id" ${{ env.IMAGE_AGENT }}:${{ env.TAG }}
echo "the image created is $AMD_IMAGE_AGENT"
docker image ls
docker rmi "$AMD_IMAGE_AGENT"
docker image ls
- name: Install k3d
run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash
- name: Check Python version
run: |
python -V
python3 -V
- name: Update dependencies
run: sudo apt-get update
- name: Install python and dependencies
run: sudo apt-get install -y python${{ env.PYTHON_VERSION }} python3-pip python3-dev libffi-dev libssl-dev
- name: Install tox and flake8
run: |
sudo pip3 install --upgrade pip
sudo pip3 install tox flake8
- name: KDM data
run: |
mkdir -p bin
curl -sLf https://releases.rancher.com/kontainer-driver-metadata/${{ steps.env.outputs.CATTLE_KDM_BRANCH }}/data.json > bin/data.json
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: Build Integration Setup
shell: bash
run: |
./tests/v2/integration/scripts/build-integration-setup
- name: Run Tests
shell: bash
run: sudo --preserve-env GOBIN=$(which go) ./scripts/gha/tests