From 2bc342f0de04c758c4d6a61f3705cb41c5f9d564 Mon Sep 17 00:00:00 2001 From: FanZhang526 <13652410944@163.com> Date: Thu, 10 Oct 2024 14:20:12 +0800 Subject: [PATCH] Delete internal build script --- build/Dockerfile | 22 ----------- build/Makefile | 35 ------------------ build/build.sh | 96 ------------------------------------------------ 3 files changed, 153 deletions(-) delete mode 100644 build/Dockerfile delete mode 100644 build/Makefile delete mode 100644 build/build.sh diff --git a/build/Dockerfile b/build/Dockerfile deleted file mode 100644 index fe3294e..0000000 --- a/build/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# eg: docker build --target xxx --platform linux/amd64 --build-arg VER=${VER} -f Dockerfile -t xxx:${VER} . -ARG VER - -# build huawei-cosi-driver image -FROM busybox:stable-glibc as huawei-cosi-driver -LABEL version="${VER}" -LABEL maintainers="Huawei COSI Authors" -LABEL description="Huawei COSI Driver" - -ARG binary=./huawei-cosi-driver -COPY ${binary} huawei-cosi-driver -ENTRYPOINT ["/huawei-cosi-driver"] - -# build huawei-cosi-liveness-probe image -FROM busybox:stable-glibc as huawei-cosi-liveness-probe -LABEL version="${VER}" -LABEL maintainers="Huawei COSI Authors" -LABEL description="Huawei COSI Driver Liveness Probe" - -ARG binary=./huawei-cosi-liveness-probe -COPY ${binary} huawei-cosi-liveness-probe -ENTRYPOINT ["/huawei-cosi-liveness-probe"] \ No newline at end of file diff --git a/build/Makefile b/build/Makefile deleted file mode 100644 index 74867c2..0000000 --- a/build/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# usage: make -f Makefile VER={VER} PLATFORM={PLATFORM} RELEASE_VER=${RELEASE_VER} - -# (required) [x.y.x] -VER=VER -# (required) [X86 ARM] -PLATFORM=PLATFORM -# (Optional) [2.5.RC1 2.5.RC2 ...] eSDK Version -RELEASE_VER=RELEASE_VER - -export GO111MODULE=on -export GOPATH:=$(GOPATH):$(shell pwd) - -Build_Version = github.com/huawei/cosi-driver/pkg/utils/version.buildVersion -Build_Arch = github.com/huawei/cosi-driver/pkg/utils/version.buildArch -flag = -ldflags '-w -s -linkmode "external" -extldflags "-Wl,-z,now" -X "${Build_Version}=${VER}" -X "${Build_Arch}=${PLATFORM}"' -buildmode=pie - -# Platform [X86, ARM] -ifeq (${PLATFORM}, X86) -env = CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2" GOOS=linux GOARCH=amd64 -else -env = CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2" GOOS=linux GOARCH=arm64 -endif - -all:PREPARE BUILD - -PREPARE: - rm -rf ./${PACKAGE_NAME} - mkdir -p ./${PACKAGE_NAME} - -BUILD: - go mod tidy -# usage: [env] go build [-o output] [flags] packages - ${env} go build -o ./${PACKAGE_NAME}/huawei-cosi-driver ${flag} -buildmode=pie ../cmd/driver - ${env} go build -o ./${PACKAGE_NAME}/huawei-cosi-liveness-probe ${flag} -buildmode=pie ../cmd/livenessprobe - diff --git a/build/build.sh b/build/build.sh deleted file mode 100644 index 7600d0a..0000000 --- a/build/build.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. -# -# 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. -# -set -e -workdir=$(cd $(dirname $0); pwd) - -export PACKAGE_NAME="eSDK_${RELEASE_VER}_COSI_V${VER}_${PLATFORM}_64" -export GOPROXY=http://mirrors.tools.huawei.com/goproxy/ -export GOSUMDB=off -# shellcheck disable=SC2164 -# shellcheck disable=SC2154 -if [ "${isRelease}" == "true" ]; then - echo "buildVersion=${ENV_RELEASE_VERSION}" > buildInfo.properties -else - echo "buildVersion=${RELEASE_VER}.$(date "+%Y%m%d%H%M%S")" > buildInfo.properties -fi - -### step 1: build the binary -# shellcheck disable=SC2164 -cd ${workdir} -make -f Makefile VER="${VER}" PLATFORM="${PLATFORM}" RELEASE_VER="${RELEASE_VER}" - -### step 2: load the image -if [ "${PLATFORM}" == "ARM" ]; then - wget http://10.29.160.97/busybox-arm.tar - docker load -i busybox-arm.tar - docker tag busybox:1.36.1 busybox-arm:stable-glibc - sed -i 's/busybox:stable-glibc/busybox-arm:stable-glibc/g' Dockerfile -else - wget http://10.29.160.97/busybox-x86.tar - docker load -i busybox-x86.tar - docker tag busybox:1.36.1 busybox-x86:stable-glibc - sed -i 's/busybox:stable-glibc/busybox-x86:stable-glibc/g' Dockerfile -fi - -### step 3: build the image -function build_image() { - # shellcheck disable=SC2164 - cp -rf Dockerfile ./"${PACKAGE_NAME}"/Dockerfile - # shellcheck disable=SC2164 - cd ./"${PACKAGE_NAME}"/ - echo "create image dir" - mkdir -p ../release/image/ - # shellcheck disable=SC2054 - local images=("huawei-cosi-driver" "huawei-cosi-liveness-probe") - # shellcheck disable=SC2068 - for img in ${images[@]}; do - echo "build the ${img} image" - chmod +x "${img}" - # shellcheck disable=SC2086 - docker build -f Dockerfile -t "${img}":${VER} --target "${img}" --build-arg VER=${VER} . - docker save "${img}":"${VER}" -o "${img}"-"${VER}".tar - mv "${img}"-"${VER}".tar ../release/image/ - done -} -build_image - -### step 4: pack the package -echo "pack deploy files" -cp -rf ../../helm ../release - -echo "pack example files" -cp -rf ../../examples ../release - -# shellcheck disable=SC2164 -cd ../release - -# set version in values.yaml and Chart.yaml -sed -i "s/{{version}}/${VER}/g" helm/values.yaml - -# parse ${VAR} to Semantic Version style -# Charts https://helm.sh/docs/topics/charts/ -# Semantic Version https://semver.org/lang/zh-CN/` -# example: -# 2.0.0.B070 -> 2.0.0-B070 -# 2.0.0 -> 2.0.0 -chart_version=$(echo ${VER} | sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\)\./\1-/') -sed -i "s/{{version}}/${chart_version}/g" helm/Chart.yaml - -# shellcheck disable=SC2035 -zip -rq -o eSDK_Huawei_Storage_"${RELEASE_VER}"_COSI_V"${VER}"_"${PLATFORM}"_64.zip * -mkdir ${workdir}/../../output -cp eSDK_Huawei_Storage_"${RELEASE_VER}"_COSI_V"${VER}"_"${PLATFORM}"_64.zip ${workdir}/../../output