Skip to content

fix: eliminate flaky OnetimeConfigUpdateUnittest via injectable clock… #36

fix: eliminate flaky OnetimeConfigUpdateUnittest via injectable clock…

fix: eliminate flaky OnetimeConfigUpdateUnittest via injectable clock… #36

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: Build Edge Image
on:
push:
branches:
- main
paths-ignore:
- "changes/**"
- "config_server/**"
- "docs/**"
- "example_config/**"
- "k8s_template/**"
- "licenses/**"
- "test/**"
- "tools/**"
- "CHANGELOG.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# 第一步:构建不同架构的安装包
build-linux:
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
df -hT $PWD
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.12
- 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 Linux ${{ matrix.arch }} package
env:
VERSION: edge
run: |
make dist
ls -la dist/
- name: Upload Linux ${{ matrix.arch }} artifacts
uses: actions/upload-artifact@v4
with:
name: loongcollector-edge.linux-${{ matrix.arch }}.tar.gz
path: dist/loongcollector-edge.linux-${{ matrix.arch }}.tar.gz
retention-days: 1
# 第二步:构建和上传 Docker 镜像
upload-images:
needs: build-linux
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
packages: write
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
df -hT $PWD
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Linux AMD64 artifacts
uses: actions/download-artifact@v4
with:
name: loongcollector-edge.linux-amd64.tar.gz
path: dist/
- name: Download Linux ARM64 artifacts
uses: actions/download-artifact@v4
with:
name: loongcollector-edge.linux-arm64.tar.gz
path: dist/
- name: List artifacts for Docker build
run: |
echo "Artifacts available for Docker build:"
ls -la dist/ || echo "No artifacts found"
- name: Build and push Docker images
run: |
VERSION="edge"
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
# 获取当前时间戳
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
TIMESTAMPED_TAG="edge-$TIMESTAMP"
echo "Building and pushing Docker images for version $VERSION and $TIMESTAMPED_TAG"
# 检查是否有Linux构建产物
LINUX_AMD64_FILE="dist/loongcollector-$VERSION.linux-amd64.tar.gz"
LINUX_ARM64_FILE="dist/loongcollector-$VERSION.linux-arm64.tar.gz"
if [ ! -f "$LINUX_AMD64_FILE" ] && [ ! -f "$LINUX_ARM64_FILE" ]; then
echo "Error: No Linux packages found for Docker build"
echo "Available files in dist/:"
ls -la dist/ || echo "dist/ directory is empty"
echo "Expected files:"
echo "- $LINUX_AMD64_FILE"
echo "- $LINUX_ARM64_FILE"
exit 1
fi
# 确定要构建的平台
PLATFORMS=""
if [ -f "$LINUX_AMD64_FILE" ]; then
PLATFORMS="$PLATFORMS,linux/amd64"
echo "Found Linux AMD64 package: $LINUX_AMD64_FILE"
fi
if [ -f "$LINUX_ARM64_FILE" ]; then
PLATFORMS="$PLATFORMS,linux/arm64"
echo "Found Linux ARM64 package: $LINUX_ARM64_FILE"
fi
# 移除开头的逗号
PLATFORMS=$(echo $PLATFORMS | sed 's/^,//')
echo "Building Docker images for platforms: $PLATFORMS"
# 构建并推送多架构镜像,同时打两个标签
docker buildx build --platform "$PLATFORMS" \
--file docker/Dockerfile_release \
--build-arg VERSION=$VERSION \
--build-arg HOST_OS=Linux \
--tag ghcr.io/$REPO_OWNER/loongcollector:$VERSION \
--tag ghcr.io/$REPO_OWNER/loongcollector:$TIMESTAMPED_TAG \
--push .
echo "Docker images pushed successfully:"
echo "- ghcr.io/$REPO_OWNER/loongcollector:$VERSION"
echo "- ghcr.io/$REPO_OWNER/loongcollector:$TIMESTAMPED_TAG"
# Benchmark:
# runs-on: ${{ matrix.runner }}
# timeout-minutes: 60
# strategy:
# matrix:
# test-agent:
# - "loongcollector-blackhole"
# - "loongcollector-spl-blackhole"
# - "filebeat-blackhole"
# - "fluentbit-blackhole"
# - "vector-blackhole"
# - "loongcollector-file"
# - "loongcollector-spl-file"
# - "loongcollector-cgo-file"
# - "filebeat-file"
# - "fluentbit-file"
# - "vector-file"
# python-version: [ 3.8 ]
# runner: [ ubuntu-latest ]
# fail-fast: false
# permissions:
# contents: write
# packages: read
# needs: [ Build-LoongCollector-Image ]
# steps:
# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: 1.23.12
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# - 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: Prepare test environment
# run: |
# pip3 install -r test/requirements.txt
# - name: Pull Docker image from GitHub Packages
# if: contains(matrix.test-agent, 'loongcollector')
# run: |
# REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
# echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $REPO_OWNER --password-stdin
# docker pull ghcr.io/$REPO_OWNER/loongcollector:edge
# docker tag ghcr.io/$REPO_OWNER/loongcollector:edge aliyun/loongcollector:0.0.1
# - name: Run benchmark for agent ${{ matrix.test-agent }}
# uses: nick-fields/retry@v3
# with:
# timeout_minutes: 10
# max_attempts: 3
# command: |
# set -ue
# ./scripts/e2e.sh benchmark performance "${{ matrix.test-agent }}"
# git stash
# - name: Upload benchmark result for agent ${{ matrix.test-agent }}
# uses: actions/upload-artifact@v4
# with:
# name: benchmark-results-${{ matrix.test-agent }}
# path: test/benchmark/report
# result:
# runs-on: ubuntu-latest
# timeout-minutes: 60
# needs: [ Benchmark ]
# steps:
# - name: Check out code
# uses: actions/checkout@v2
# with:
# submodules: false
# - name: Download benchmark results
# uses: actions/download-artifact@v4
# with:
# path: test/benchmark/report/
# merge-multiple: true
# - name: Display structure of downloaded files and merge
# run: |
# ls -R test/benchmark/report/
# ./scripts/benchmark_collect_result.sh
# ls -R test/benchmark/report/
# - name: Store benchmark result LoongCollector
# uses: benchmark-action/github-action-benchmark@v1
# with:
# name: benchmark
# tool: "customSmallerIsBetter"
# output-file-path: "test/benchmark/report/loongcollector_statistic_all.json"
# auto-push: false
# summary-always: true
# - name: Store benchmark result other agents
# run: |
# git checkout gh-pages
# mv test/benchmark/report/records_all.json dev/bench/records_all.js
# sed -i '1s/^\[/window.BENCHMARK_RECORDS = [/' dev/bench/records_all.js
# git add dev/bench/records_all.js
# last_commit_message=$(git log -1 --pretty=%B)
# git -c user.name=github-action-benchmark -c user.email=github@users.noreply.github.com commit --amend -m "$last_commit_message"
# - name: Push benchmark result
# run: git push 'https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/LoongCollector.git' gh-pages:gh-pages
actions-timeline:
needs: [upload-images]
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- uses: Kesin11/actions-timeline@v2