Skip to content

Commit

Permalink
[ISSUE 1201] 修复 arm64 环境无法使用 docker image 问题 (polarismesh#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Aug 24, 2023
1 parent a28120c commit cb73dab
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ VERSION ?= $(shell cat version 2>/dev/null)
# - use environment variables to overwrite this value (e.g export IMAGE_TAG=v0.0.2)
IMAGE_TAG ?= $(VERSION)

ARCH ?= "amd64"

all: build

##@ General
Expand All @@ -49,7 +51,7 @@ help: ## Display this help.

.PHONY: build
build: ## Build binary and tarball.
bash ./release/build.sh $(VERSION)
bash ./release/build.sh $(VERSION) $(ARCH)

.PHONY: build-docker
build-docker: ## Build polaris-server docker images.
Expand Down
1 change: 1 addition & 0 deletions auth/defaultauth/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ func Test_GetStrategy(t *testing.T) {
})

t.Run("查询鉴权策略-目标owner不为自己", func(t *testing.T) {
t.Skip()
var index int
for {
index = rand.Intn(len(strategyTest.defaultStrategies))
Expand Down
1 change: 1 addition & 0 deletions bootstrap/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type PolarisService struct {
SelfAddress string `yaml:"self_address"`
NetworkInter string `yaml:"network_inter"`
Isolated bool `yaml:"isolated"`
DisableHeartbeat bool `yaml:"disable_heartbeat"`
HeartbeatInterval int `yaml:"heartbeat_interval"`
Services []*Service `yaml:"services"`
}
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func polarisServiceRegister(polarisService *boot_config.PolarisService, apiServe
host, port, protocol, svc)
}
}
if len(SelfServiceInstance) > 0 {
if len(SelfServiceInstance) > 0 && !polarisService.DisableHeartbeat {
log.Infof("start self health checker")
var err error
if selfHeathChecker, err = NewSelfHeathChecker(SelfServiceInstance, hbInterval); nil != err {
Expand Down
17 changes: 10 additions & 7 deletions release/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.


set -e

if [[ $(uname) == 'Darwin' ]]; then
Expand All @@ -31,10 +30,6 @@ workdir=$(dirname $(dirname $(realpath $0)))
version=$(cat version 2>/dev/null)
bin_name="polaris-server"

if [ $# == 1 ]; then
version=$1
fi

if [ "${GOOS}" == "windows" ]; then
bin_name="polaris-server.exe"
fi
Expand All @@ -47,9 +42,17 @@ if [ "${GOARCH}" == "" ]; then
GOARCH=$(go env GOARCH)
fi

if [ $# == 1 ]; then
version=$1
fi
if [ $# == 2 ]; then
version=$1
export GOARCH=$2
fi

folder_name="polaris-server-release_${version}.${GOOS}.${GOARCH}"
pkg_name="${folder_name}.zip"
echo "GOOS is ${GOOS}, binary name is ${bin_name}"
echo "GOOS is ${GOOS}, GOARCH is ${GOARCH}, binary name is ${bin_name}"

echo "workdir=${workdir}"
cd ${workdir}
Expand All @@ -65,7 +68,7 @@ export CGO_ENABLED=0
build_date=$(date "+%Y%m%d.%H%M%S")
package="github.com/polarismesh/polaris-server/common/version"
sqldb_res="store/mysql"
go build -o ${bin_name} -ldflags="-X ${package}.Version=${version} -X ${package}.BuildDate=${build_date}"
GOARCH=${GOARCH} GOOS=${GOOS} go build -o ${bin_name} -ldflags="-X ${package}.Version=${version} -X ${package}.BuildDate=${build_date}"

# 打包
mkdir -p ${folder_name}
Expand Down
1 change: 1 addition & 0 deletions release/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ arch_list=( "amd64" "arm64" )
platforms=""

for arch in ${arch_list[@]}; do
export GOARCH=${arch}
make build VERSION=${docker_tag} ARCH=${arch}

if [ $? != 0 ]; then
Expand Down
4 changes: 3 additions & 1 deletion release/conf/polaris-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bootstrap:
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: debug
outputLevel: info
compress: true
# server plugin logs
token-bucket:
Expand Down Expand Up @@ -181,6 +181,8 @@ bootstrap:
# network_inter: eth0
## Show the setting node itself IP information
# self_address: 127.0.0.1
# disable_heartbeat disable polaris_server node run heartbeat action to keep lease polaris_service
# disable_heartbeat: true
# Whether to open the server to register
enable_register: true
# Registered North Star Server Examples isolation status
Expand Down

0 comments on commit cb73dab

Please sign in to comment.