mirror of
https://github.com/labring/sealos.git
synced 2026-08-29 01:39:49 +08:00
5d4c5b7a53
fix: workflow mutli call concurrency
166 lines
5.4 KiB
YAML
Executable File
166 lines
5.4 KiB
YAML
Executable File
name: CI Patch Images Package
|
|
|
|
env:
|
|
# Common versions
|
|
GO_VERSION: "1.25"
|
|
DEFAULT_OWNER: "labring"
|
|
PROJECT_PATH: "./lifecycle"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
push_mage:
|
|
description: "Push images"
|
|
required: false
|
|
type: boolean
|
|
push:
|
|
branches: ["main"]
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "**/*.md"
|
|
- "**/*.yaml"
|
|
- "CHANGELOG/**"
|
|
- "controllers/**"
|
|
- "service/**"
|
|
- "webhooks/**"
|
|
- "frontend/**"
|
|
pull_request:
|
|
branches: ["*"]
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "CHANGELOG/**"
|
|
- "**/*.md"
|
|
- "**/*.yaml"
|
|
- "CHANGELOG/**"
|
|
- "controllers/**"
|
|
- "service/**"
|
|
- "webhooks/**"
|
|
- "frontend/**"
|
|
|
|
# Avoid using ${{ github.workflow }} - when called via workflow_call, it inherits the caller's name causing conflicts
|
|
concurrency:
|
|
group: ci-patch-image-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
call_ci_workflow:
|
|
uses: ./.github/workflows/import-patch-image.yml
|
|
with:
|
|
arch: amd64,arm64
|
|
|
|
container-sealos:
|
|
needs: [call_ci_workflow]
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
if: ${{ (github.event_name == 'push') || (inputs.push_mage == true) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Expose git commit data
|
|
uses: rlespinasse/git-commit-data-action@v1
|
|
- # Add support for more platforms with QEMU (optional)
|
|
# https://github.com/docker/setup-qemu-action
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Download sealos
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: sealos-amd64
|
|
path: ${{ env.PROJECT_PATH }}/docker/sealos/bin/sealos-amd64
|
|
|
|
- name: Download sealos
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: sealos-arm64
|
|
path: ${{ env.PROJECT_PATH }}/docker/sealos/bin/sealos-arm64
|
|
|
|
- name: build (and publish) main sealos image
|
|
env:
|
|
REPOSITORY_OWNER: ${{ github.repository_owner }}
|
|
GIT_COMMIT_SHORT_SHA: ${{ env.GIT_COMMIT_SHORT_SHA }}
|
|
DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/sealos
|
|
working-directory: ${{ env.PROJECT_PATH }}/docker/sealos
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--label "org.opencontainers.image.source=https://github.com/${REPOSITORY_OWNER}/sealos" \
|
|
--label "org.opencontainers.image.description=sealos container image" \
|
|
--label "org.opencontainers.image.licenses=MIT" \
|
|
--push \
|
|
-t "${DOCKER_REPO}:${GIT_COMMIT_SHORT_SHA}" \
|
|
-f Dockerfile.main \
|
|
.
|
|
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--label "org.opencontainers.image.source=https://github.com/${REPOSITORY_OWNER}/sealos" \
|
|
--label "org.opencontainers.image.description=sealos container image" \
|
|
--label "org.opencontainers.image.licenses=MIT" \
|
|
--push \
|
|
-t "${DOCKER_REPO}:latest" \
|
|
-f Dockerfile.main \
|
|
.
|
|
build-on-cluster-patch-image:
|
|
if: ${{ (github.event_name == 'push') || (inputs.push_mage == true) }}
|
|
needs:
|
|
- call_ci_workflow
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
issues: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Install sealos
|
|
run: |
|
|
sudo bash ./.github/scripts/install.sh
|
|
- name: Expose git commit data
|
|
uses: rlespinasse/git-commit-data-action@v1
|
|
|
|
- name: Download amd64 patch image tar
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: patch-image-amd64.tar
|
|
path: /tmp/sealos/images/
|
|
- name: Download arm64 patch image tar
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: patch-image-arm64.tar
|
|
path: /tmp/sealos/images/
|
|
|
|
- name: Manifest Cluster Images
|
|
env:
|
|
REPOSITORY_OWNER: ${{ github.repository_owner }}
|
|
GH_PAT: ${{ secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
sudo sealos login -u "${REPOSITORY_OWNER}" -p "${GH_PAT}" --debug ghcr.io
|
|
sudo sealos load -i /tmp/sealos/images/patch-arm64.tar
|
|
sudo sealos load -i /tmp/sealos/images/patch-amd64.tar
|
|
sudo sealos images
|
|
bash ./scripts/manifest-cluster-images.sh
|
|
|
|
- name: Manifest Cluster Images for latest
|
|
env:
|
|
REPOSITORY_OWNER: ${{ github.repository_owner }}
|
|
GIT_COMMIT_SHORT_SHA: ${{ env.GIT_COMMIT_SHORT_SHA }}
|
|
run: |
|
|
sudo sealos tag "ghcr.io/${REPOSITORY_OWNER}/sealos-patch:${GIT_COMMIT_SHORT_SHA}-amd64" "ghcr.io/${REPOSITORY_OWNER}/sealos-patch:latest-amd64"
|
|
sudo sealos tag "ghcr.io/${REPOSITORY_OWNER}/sealos-patch:${GIT_COMMIT_SHORT_SHA}-arm64" "ghcr.io/${REPOSITORY_OWNER}/sealos-patch:latest-arm64"
|
|
sudo sealos images
|
|
bash ./scripts/manifest-cluster-images.sh "ghcr.io/${REPOSITORY_OWNER}/sealos-patch:latest"
|