Skip to content

Fixed some race condition issues in the C++ ContainerManager module. #10415

Fixed some race condition issues in the C++ ContainerManager module.

Fixed some race condition issues in the C++ ContainerManager module. #10415

Workflow file for this run

# Copyright 2021 iLogtail Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: E2E Test
on:
pull_request:
paths-ignore:
- "changes/**"
- "config_server/**"
- "docs/**"
- "example_config/**"
- "k8s_template/**"
- "licenses/**"
- "CHANGELOG.md"
push:
branches:
- main
- 1.*
- 2.*
- 3.*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# 生成E2E测试用例列表
GenerateE2ETestCasesList:
runs-on: ubuntu-latest
outputs:
cases: ${{ steps.discover.outputs.cases }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Discover Test Cases
id: discover
run: |
# 使用JSON格式输出用例列表
cases=($(find test/e2e/test_cases -mindepth 1 -maxdepth 1 -type d -printf "%f\n"))
# 检查是否找到用例
if [ ${#cases[@]} -eq 0 ]; then
echo "Error: No test cases found"
exit 1
fi
# 转换为JSON数组格式
json="["
for i in "${!cases[@]}"; do
json+="\"${cases[$i]}\""
if [ $i -lt $((${#cases[@]}-1)) ]; then
json+=","
fi
done
json+="]"
# 输出JSON到文件和控制台
echo "$json" > cases.json
cat cases.json
echo "cases=$json" >> $GITHUB_OUTPUT
# 生成e2e镜像
GenerateE2ETestImage:
runs-on: arc-runner-set-ilogtail
timeout-minutes: 60
permissions:
packages: write
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Set custom submodule URL and fetch
run: |
SUBMODULE_PATH="core/_thirdparty/coolbpf"
git config submodule.$SUBMODULE_PATH.url "https://github.com/aliyun/coolbpf.git"
git submodule update --init
cd $SUBMODULE_PATH
echo "Current commit: $(git rev-parse HEAD)"
- name: Build Image
run: |
docker build \
--tag aliyun/loongcollector:0.0.1 \
--file ./docker/Dockerfile_edge_linux \
--build-arg VERSION=0.0.1 \
--build-arg BUILD_LOGTAIL_UT=OFF \
--build-arg ENABLE_COMPATIBLE_MODE=ON \
--build-arg ENABLE_STATIC_LINK_CRT=ON \
--build-arg WITHOUTGDB=ON \
--build-arg WITHSPL=ON \
--build-arg MAKE_JOBS=16 \
--build-arg HOST_OS=Linux \
.
- name: Export Image to Tar
run: docker save -o image.tar aliyun/loongcollector:0.0.1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: loongcollector-image
path: image.tar
# E2E测试
E2E:
runs-on: ubuntu-latest
needs:
- GenerateE2ETestCasesList
- GenerateE2ETestImage
strategy:
matrix:
test_case: ${{ fromJson(needs.GenerateE2ETestCasesList.outputs.cases) }}
fail-fast: false
timeout-minutes: 60
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.12
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Update Docker-compose to v2
run: |
sudo curl -SL https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: loongcollector-image
- name: Import Image from Tar
run: docker load -i ./image.tar
- name: E2E Behavior Test Case ${{ matrix.test_case }}
env:
TEST_CASE: ${{ matrix.test_case }}
run: |
./scripts/e2e.sh e2e
# E2E测试 - Docker Engine版本兼容性测试
E2EWithDockerEngineVersions:
runs-on: ubuntu-22.04
needs:
- GenerateE2ETestImage
strategy:
matrix:
docker_engine_version: ["29.1", "28.5", "27.5", "26.1", "25.0", "24.0", "23.0", "20.10"]
test_case: ["input_container_stdio", "input_docker_static_file"]
fail-fast: false
timeout-minutes: 60
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.12
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Install Docker Engine ${{ matrix.docker_engine_version }}
run: |
# 移除现有的docker(包括docker-ce)
sudo apt-get remove -y docker docker-engine docker.io docker-ce docker-ce-cli containerd runc 2>/dev/null || true
sudo apt-get purge -y docker docker-engine docker.io docker-ce docker-ce-cli containerd runc 2>/dev/null || true
# 安装依赖
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
apt-transport-https
# 添加Docker官方GPG密钥
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# 设置Docker仓库
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 更新包列表
sudo apt-get update
# 根据版本号确定要安装的版本
VERSION="${{ matrix.docker_engine_version }}"
# 查找可用的docker-ce版本
AVAILABLE_VERSIONS=$(apt-cache madison docker-ce | awk '{print $3}' | sort -V)
echo "Available Docker CE versions:"
echo "$AVAILABLE_VERSIONS"
# 根据主版本号匹配
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
# 查找匹配的版本,选择最高的小版本
MATCHED_VERSION=$(echo "$AVAILABLE_VERSIONS" | grep "^5:$MAJOR\.$MINOR\." | tail -1)
if [ -z "$MATCHED_VERSION" ]; then
# 如果找不到精确匹配,尝试匹配主版本号,选择最高版本
MATCHED_VERSION=$(echo "$AVAILABLE_VERSIONS" | grep "^5:$MAJOR\." | tail -1)
fi
if [ -n "$MATCHED_VERSION" ]; then
echo "Installing Docker CE version: $MATCHED_VERSION"
sudo apt-get install -y --allow-downgrades docker-ce=$MATCHED_VERSION docker-ce-cli=$MATCHED_VERSION containerd.io
else
echo "Warning: Exact version $VERSION not found, trying to install latest version in major version $MAJOR"
LATEST_MAJOR=$(echo "$AVAILABLE_VERSIONS" | grep "^5:$MAJOR\." | tail -1)
if [ -n "$LATEST_MAJOR" ]; then
echo "Installing latest available version in major version $MAJOR: $LATEST_MAJOR"
sudo apt-get install -y --allow-downgrades docker-ce=$LATEST_MAJOR docker-ce-cli=$LATEST_MAJOR containerd.io
else
echo "::warning::Docker $VERSION is not available on this Ubuntu version"
echo "Available versions:"
echo "$AVAILABLE_VERSIONS"
echo "Skipping Docker $VERSION test"
exit 0
fi
fi
# 启动Docker服务
sudo systemctl start docker || sudo service docker start
sudo systemctl enable docker || true
# 等待Docker服务就绪
sleep 5
# 输出Docker Engine版本信息
echo "========================================="
echo "Docker Engine Version Information:"
echo "========================================="
docker --version
echo ""
echo "Docker Engine Server Version:"
docker version --format '{{.Server.Version}}'
echo "========================================="
- name: Update Docker-compose to v2
run: |
sudo curl -SL https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: loongcollector-image
- name: Check if Docker is installed
id: check_docker
run: |
if command -v docker &> /dev/null; then
echo "docker_installed=true" >> $GITHUB_OUTPUT
echo "Docker is installed"
else
echo "docker_installed=false" >> $GITHUB_OUTPUT
echo "Docker is not installed, skipping test"
fi
- name: Import Image from Tar
if: steps.check_docker.outputs.docker_installed == 'true'
run: docker load -i ./image.tar
- name: E2E Test with Docker Engine ${{ matrix.docker_engine_version }} - ${{ matrix.test_case }}
if: steps.check_docker.outputs.docker_installed == 'true'
env:
TEST_CASE: ${{ matrix.test_case }}
run: |
./scripts/e2e.sh e2e
actions-timeline:
needs: [E2E, E2EWithDockerEngineVersions]
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- uses: Kesin11/actions-timeline@v2