Files
sealos/.github/workflows/import-patch-image.yml
cuisongliu 56d75a9b6d fix(dependencies): replace gcc-aarch64-linux-gnu with binutils-aarch6… (#6766)
* fix(dependencies): replace gcc-aarch64-linux-gnu with binutils-aarch64-linux-gnu in Dockerfile and YAML files

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* fix(ci): update runs-on configuration for arm64 architecture in CI scripts

Signed-off-by: cuisongliu <cuisongliu@qq.com>

* fix(ci): update runs-on configuration for arm64 architecture in CI scripts

Signed-off-by: cuisongliu <cuisongliu@qq.com>

---------

Signed-off-by: cuisongliu <cuisongliu@qq.com>
2026-03-05 20:01:57 +08:00

237 lines
7.8 KiB
YAML
Executable File

name: Import Patch Images Package
env:
# Common versions
GO_VERSION: "1.25"
PROJECT_PATH: "./lifecycle"
on:
workflow_call:
inputs:
e2e:
required: false
type: boolean
default: false
arch:
required: true
type: string
default: amd64
image:
required: false
type: boolean
default: true
target_pull:
required: false
type: boolean
default: false
jobs:
resolve-modules-arch:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
if: ${{ (inputs.target_pull == false) }}
uses: actions/checkout@v4
- name: Checkout by Pull Request Target
uses: actions/checkout@v4
if: ${{ (inputs.target_pull == true) }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Resolve Modules
id: set-matrix
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
INPUT_ARCH: ${{ inputs.arch }}
run: bash "./${PROJECT_PATH}/scripts/resolve-patch-modules.sh" "${INPUT_ARCH}" "true"
resolve-modules:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
if: ${{ (inputs.target_pull == false) }}
uses: actions/checkout@v4
- name: Checkout by Pull Request Target
uses: actions/checkout@v4
if: ${{ (inputs.target_pull == true) }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Resolve Modules
id: set-matrix
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
INPUT_ARCH: ${{ inputs.arch }}
run: bash "./${PROJECT_PATH}/scripts/resolve-patch-modules.sh" "${INPUT_ARCH}"
build:
needs: [ resolve-modules ]
runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }}
strategy:
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
steps:
- name: Checkout
if: ${{ (inputs.target_pull == false) }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout by Pull Request Target
uses: actions/checkout@v4
if: ${{ (inputs.target_pull == true) }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Dependencies
run: sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
- name: Install Dependencies
if: ${{ (matrix.binary == 'sealos' || matrix.binary == 'sealctl') && matrix.arch == 'arm64' }}
run: |
sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Build Binaries
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
MATRIX_BINARY: ${{ matrix.binary }}
MATRIX_ARCH: ${{ matrix.arch }}
run: |
cd "${PROJECT_PATH}" && make build BINS="${MATRIX_BINARY}" PLATFORM="linux_${MATRIX_ARCH}"
- name: Save Binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}-${{ matrix.arch }}
path: ${{ env.PROJECT_PATH }}/bin/linux_${{ matrix.arch}}/${{ matrix.binary }}
test:
runs-on: ubuntu-24.04
if: ${{ (inputs.e2e == true) }}
steps:
- name: Checkout
if: ${{ (inputs.target_pull == false) }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout by Pull Request Target
uses: actions/checkout@v4
if: ${{ (inputs.target_pull == true) }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Dependencies
run: sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
- name: Build E2e Test
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
run: |
cd "${PROJECT_PATH}" && go install github.com/onsi/ginkgo/v2/ginkgo
cd test/e2e && ginkgo build .
- name: Save E2e Test
uses: actions/upload-artifact@v4
with:
name: e2e.test
path: ${{ env.PROJECT_PATH }}/test/e2e/e2e.test
docker:
needs: [ resolve-modules-arch,build ]
runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }}
if: ${{ (inputs.image == true) }}
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix: ${{ fromJson(needs.resolve-modules-arch.outputs.matrix) }}
steps:
- name: Checkout
if: ${{ (inputs.target_pull == false) }}
uses: actions/checkout@v4
- name: Checkout by Pull Request Target
uses: actions/checkout@v4
if: ${{ (inputs.target_pull == true) }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: Download lvscare
uses: actions/download-artifact@v4
with:
name: lvscare-${{ matrix.arch }}
path: ${{ env.PROJECT_PATH }}/docker/lvscare
- name: Download sealctl
uses: actions/download-artifact@v4
with:
name: sealctl-${{ matrix.arch }}
path: ${{ env.PROJECT_PATH }}/docker/patch
- name: Download image-cri-shim
uses: actions/download-artifact@v4
with:
name: image-cri-shim-${{ matrix.arch }}
path: ${{ env.PROJECT_PATH }}/docker/patch
- name: Download sealos
uses: actions/download-artifact@v4
with:
name: sealos-${{ matrix.arch }}
path: ${{ env.PROJECT_PATH }}/docker/sealos
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Chmod a+x for docker
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
run: |
chmod a+x "${PROJECT_PATH}/docker/sealos"/*
chmod a+x "${PROJECT_PATH}/docker/patch"/*
chmod a+x "${PROJECT_PATH}/docker/lvscare"/*
- name: Build and Push lvscare Image
uses: docker/build-push-action@v6
with:
context: ${{ env.PROJECT_PATH }}/docker/lvscare
file: ${{ env.PROJECT_PATH }}/docker/lvscare/Dockerfile.main
push: true
build-args: Bin=lvscare
platforms: linux/${{ matrix.arch }}
tags: localhost:5000/${{ github.repository_owner }}/lvscare:${{ env.GIT_COMMIT_SHORT_SHA }}-${{ matrix.arch }}
- name: Build and Save Cluster Images
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
ARCH: ${{ matrix.arch }}
OWNER: ${{ github.repository_owner }}
run: |
"${PROJECT_PATH}/docker/patch/save-cluster-images.sh"
- name: Upload Cluster Images
uses: actions/upload-artifact@v4
with:
name: patch-image-${{ matrix.arch }}.tar
path: patch-${{ matrix.arch }}.tar
- name: Delete Artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
lvscare-${{ matrix.arch }}
sealctl-${{ matrix.arch }}
image-cri-shim-${{ matrix.arch }}
failOnError: false