Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 8
- uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: '1.24'
- name: test
shell: bash
run: |
Expand All @@ -26,6 +26,8 @@ jobs:
mkdir -p "$workdir"
mv "$HOME/work/kubecomps/kubecomps" "$workdir/"

sudo apt-get install -y build-essential librados-dev

export GOPATH="$HOME/go"
export GO111MODULE=off
cd "$workdir/kubecomps"
Expand Down
55 changes: 37 additions & 18 deletions scripts/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ get_current_arch() {
echo $current_arch
}

ALLARCH=("amd64" "arm64" "riscv64")

pushd $(cd "$(dirname "$0")"; pwd) > /dev/null
readlink_mac $(basename "$0")
cd "$(dirname "$REAL_PATH")"
Expand Down Expand Up @@ -128,7 +130,7 @@ get_image_name() {
local arch=$2
local is_all_arch=$3
local img_name="$REGISTRY/$component:$TAG"
if [[ "$is_all_arch" == "true" || "$arch" == arm64 || "$arch" == riscv64 ]]; then
if [[ -n "$arch" && "$is_all_arch" == "true" ]]; then
img_name="${img_name}-$arch"
fi
echo $img_name
Expand Down Expand Up @@ -179,19 +181,21 @@ general_build(){

make_manifest_image() {
local component=$1
local arch=$2
local img_name=$(get_image_name $component "" "false")
if [[ "$DRY_RUN" == "true" ]]; then
echo "[$(readlink -f ${BASH_SOURCE}):${LINENO} ${FUNCNAME[0]}] return for DRY_RUN"
return
fi

docker buildx imagetools create -t $img_name \
$img_name-amd64 \
$img_name-riscv64 \
$img_name-arm64
docker manifest inspect ${img_name} | grep -wq amd64
docker manifest inspect ${img_name} | grep -wq arm64
docker manifest inspect ${img_name} | grep -wq riscv64
CMD="docker buildx imagetools create -t ${img_name} "
for ac in "${ALLARCH[@]}"; do
if [[ "${arch}" == "all" || "${arch}" == *"$ac"* ]]; then
CMD="${CMD} ${img_name}-${ac}"
fi
done
echo "$CMD"
$CMD
}

ALL_COMPONENTS=$(ls cmd | grep -v '.*cli$' | xargs)
Expand All @@ -211,22 +215,37 @@ fi
cd $SRC_DIR
mkdir -p $SRC_DIR/_output

show_update_cmd() {
local component=$1
local spec=$1
local name=$1
local tag=$TAG

echo "kubectl patch oc -n onecloud default --type='json' -p='[{op: replace, path: /spec/${spec}/imageName, value: ${name}},{"op": "replace", "path": "/spec/${spec}/repository", "value": "${REGISTRY}"},{"op": "add", "path": "/spec/${spec}/tag", "value": "${tag}"}]'"
}

for component in $COMPONENTS; do
if [[ $component == *cli ]]; then
echo "Please build image for climc"
continue
fi
echo "Start to build component: $component"

case "$ARCH" in
all)
for arch in "arm64" "amd64" "riscv64"; do
general_build $component $arch "true"
done
make_manifest_image $component
;;
*)
multiarch=""
for ac in "${ALLARCH[@]}"; do
if [[ "$ARCH" == "$ac" ]]; then
# single arch
general_build $component $ARCH "false"
;;
esac
elif [[ "$ARCH" == "all" || "$ARCH" == *"$ac"* ]]; then
multiarch="true"
general_build $component $ac "true"
fi
done
if [[ "$multiarch" == "true" ]]; then
make_manifest_image $component $ARCH
fi
done

for component in $COMPONENTS; do
show_update_cmd $component
done
Loading