Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-offline-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,149 +49,149 @@

jobs:
build-offline-package:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
platform:
- amd64
- arm64

steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true

- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set version and platform variables
id: set-vars
run: |
PLATFORM="${{ matrix.platform }}"
REF_TYPE="${{ github.ref_type }}"
REF_NAME="${{ github.ref_name }}"

if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [ "$REF_TYPE" = "tag" ]; then
VERSION="$REF_NAME"
elif [ "$REF_TYPE" = "branch" ]; then
if [ "$REF_NAME" = "main" ]; then
VERSION="latest"
else
VERSION="${REF_NAME//\//-}"
fi
else
VERSION="latest"
fi

SOURCE_SUFFIX=""
FULL_SANDBOX_SUFFIX=""
INCLUDE_SOURCE="${{ inputs.include_source || false }}"
INCLUDE_FULL_SANDBOX="${{ inputs.include_full_sandbox || false }}"
IMAGE_SOURCE="${{ inputs.image_source || 'general' }}"
UPLOAD_TO_OBS="${{ (github.event_name == 'push' && github.ref_type == 'tag') || inputs.upload_to_obs }}"
if [ "$INCLUDE_SOURCE" = "true" ]; then
SOURCE_SUFFIX="-with-source"
fi
if [ "$INCLUDE_FULL_SANDBOX" = "true" ]; then
FULL_SANDBOX_SUFFIX="-with-full-sandbox"
fi

echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
echo "include-source=$INCLUDE_SOURCE" >> "$GITHUB_OUTPUT"
echo "include-full-sandbox=$INCLUDE_FULL_SANDBOX" >> "$GITHUB_OUTPUT"
echo "image-source=$IMAGE_SOURCE" >> "$GITHUB_OUTPUT"
echo "upload_to_obs=$UPLOAD_TO_OBS" >> "$GITHUB_OUTPUT"
echo "package-name=nexent-${VERSION}-${PLATFORM}${SOURCE_SUFFIX}${FULL_SANDBOX_SUFFIX}" >> "$GITHUB_OUTPUT"

- name: Set deployment components
id: set-components
run: |
COMPONENTS="infrastructure,application,data-process,supabase,terminal"

echo "components=$COMPONENTS" >> "$GITHUB_OUTPUT"
echo "Selected deployment components: $COMPONENTS"

- name: Build offline package
run: |
chmod +x deploy/offline/build_offline_package.sh

./deploy/offline/build_offline_package.sh \
--version "${{ steps.set-vars.outputs.version }}" \
--platform "${{ steps.set-vars.outputs.platform }}" \
--output-dir ./offline-output \
--include-source "${{ steps.set-vars.outputs.include-source }}" \
--include-sandbox-full "${{ steps.set-vars.outputs.include-full-sandbox }}" \
--image-source "${{ steps.set-vars.outputs.image-source }}" \
--components "${{ steps.set-components.outputs.components }}" \
--target all \
--package-name "${{ steps.set-vars.outputs.package-name }}" \
--compress true

- name: Show offline package
run: |
PACKAGE_NAME="${{ steps.set-vars.outputs.package-name }}"

echo "Package directory created by build script: ./offline-output"
echo "GitHub Actions will publish the final downloadable artifact as ${PACKAGE_NAME}.zip"

du -sh ./offline-output
find ./offline-output -maxdepth 2 -type f | sort | head -50

- name: Authenticate to Huawei Cloud
if: ${{ steps.set-vars.outputs.upload_to_obs == 'true' }}
uses: huaweicloud/auth-action@v1.1.0
with:
access_key_id: ${{ secrets.HUAWEI_OBS_ACCESSKEY }}
secret_access_key: ${{ secrets.HUAWEI_OBS_SECRETKEY }}
region: 'ap-southeast-1'

- name: Upload to Huawei Cloud OBS
if: ${{ steps.set-vars.outputs.upload_to_obs == 'true' }}
uses: huaweicloud/obs-helper@v1.0.0
with:
bucket_name: 'modelengine-software'
local_file_path: './${{ steps.set-vars.outputs.package-name }}.zip'
obs_file_path: 'nexent/${{ steps.set-vars.outputs.package-name }}.zip'
operation_type: 'upload'

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
path: './${{ steps.set-vars.outputs.package-name }}.zip'
if-no-files-found: error
retention-days: 30
archive: false

- name: Summary
run: |
echo ""
echo "========================================"
echo "Offline Package Build Summary"
echo "========================================"
echo "Version: ${{ steps.set-vars.outputs.version }}"
echo "Platform: ${{ steps.set-vars.outputs.platform }}"
echo "Package: ${{ steps.set-vars.outputs.package-name }}.zip"
echo "Note: the GitHub artifact zip contains the offline package contents directly."
echo "Components: ${{ steps.set-components.outputs.components }}"
echo "Include full sandbox: ${{ steps.set-vars.outputs.include-full-sandbox }}"
echo "Image source: ${{ steps.set-vars.outputs.image-source }}"
echo "Ref Type: ${{ github.ref_type }}"
echo "Ref Name: ${{ github.ref_name }}"
echo "========================================"
echo ""
echo "Package directory:"
ls -l .

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
25 changes: 1 addition & 24 deletions deploy/offline/build_offline_package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
# Copyright (c) 2025-2026 Huawei Technologies Co., Ltd. All rights reserved.

set -e

Expand Down Expand Up @@ -471,35 +470,13 @@ pull_all_images() {
echo "✅ All images pulled successfully"
}

docker_supports_save_platform() {
local api_versions client_api server_api api

# Platform-specific image export requires API 1.48 on both ends. The client
# API also reflects an explicit DOCKER_API_VERSION compatibility override.
api_versions="$(docker version --format '{{.Client.APIVersion}} {{.Server.APIVersion}}' 2>/dev/null)" || return 1
read -r client_api server_api <<< "$api_versions"

for api in "$client_api" "$server_api"; do
[[ "$api" =~ ^([0-9]+)\.([0-9]+)$ ]] || return 1
if (( 10#${BASH_REMATCH[1]} < 1 || (10#${BASH_REMATCH[1]} == 1 && 10#${BASH_REMATCH[2]} < 48) )); then
return 1
fi
done
return 0
}

save_image_to_tar() {
local image="$1"
local output_file="$2"
local save_args=(-o "$output_file")

if docker_supports_save_platform; then
save_args=(--platform "linux/$PLATFORM" "${save_args[@]}")
fi

echo "Saving image to tar: $output_file"

if docker save "${save_args[@]}" "$image"; then
if docker save -o "$output_file" "$image"; then
echo "✅ Saved: $output_file"
return 0
else
Expand Down
66 changes: 0 additions & 66 deletions test-e2e/changes/bugs/OFFLINE-EXPORT-PLATFORM-20261102.yaml

This file was deleted.

143 changes: 0 additions & 143 deletions test/backend/deploy/test_offline_image_export.py

This file was deleted.

Loading