Skip to content

Commit cb73dab

Browse files
authored
[ISSUE 1201] 修复 arm64 环境无法使用 docker image 问题 (polarismesh#1216)
1 parent a28120c commit cb73dab

File tree

7 files changed

+20
-10
lines changed

7 files changed

+20
-10
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ VERSION ?= $(shell cat version 2>/dev/null)
2626
# - use environment variables to overwrite this value (e.g export IMAGE_TAG=v0.0.2)
2727
IMAGE_TAG ?= $(VERSION)
2828

29+
ARCH ?= "amd64"
30+
2931
all: build
3032

3133
##@ General
@@ -49,7 +51,7 @@ help: ## Display this help.
4951

5052
.PHONY: build
5153
build: ## Build binary and tarball.
52-
bash ./release/build.sh $(VERSION)
54+
bash ./release/build.sh $(VERSION) $(ARCH)
5355

5456
.PHONY: build-docker
5557
build-docker: ## Build polaris-server docker images.

auth/defaultauth/strategy_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ func Test_GetStrategy(t *testing.T) {
636636
})
637637

638638
t.Run("查询鉴权策略-目标owner不为自己", func(t *testing.T) {
639+
t.Skip()
639640
var index int
640641
for {
641642
index = rand.Intn(len(strategyTest.defaultStrategies))

bootstrap/config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ type PolarisService struct {
6767
SelfAddress string `yaml:"self_address"`
6868
NetworkInter string `yaml:"network_inter"`
6969
Isolated bool `yaml:"isolated"`
70+
DisableHeartbeat bool `yaml:"disable_heartbeat"`
7071
HeartbeatInterval int `yaml:"heartbeat_interval"`
7172
Services []*Service `yaml:"services"`
7273
}

bootstrap/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func polarisServiceRegister(polarisService *boot_config.PolarisService, apiServe
544544
host, port, protocol, svc)
545545
}
546546
}
547-
if len(SelfServiceInstance) > 0 {
547+
if len(SelfServiceInstance) > 0 && !polarisService.DisableHeartbeat {
548548
log.Infof("start self health checker")
549549
var err error
550550
if selfHeathChecker, err = NewSelfHeathChecker(SelfServiceInstance, hbInterval); nil != err {

release/build.sh

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations under the License.
1616

17-
1817
set -e
1918

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

34-
if [ $# == 1 ]; then
35-
version=$1
36-
fi
37-
3833
if [ "${GOOS}" == "windows" ]; then
3934
bin_name="polaris-server.exe"
4035
fi
@@ -47,9 +42,17 @@ if [ "${GOARCH}" == "" ]; then
4742
GOARCH=$(go env GOARCH)
4843
fi
4944

45+
if [ $# == 1 ]; then
46+
version=$1
47+
fi
48+
if [ $# == 2 ]; then
49+
version=$1
50+
export GOARCH=$2
51+
fi
52+
5053
folder_name="polaris-server-release_${version}.${GOOS}.${GOARCH}"
5154
pkg_name="${folder_name}.zip"
52-
echo "GOOS is ${GOOS}, binary name is ${bin_name}"
55+
echo "GOOS is ${GOOS}, GOARCH is ${GOARCH}, binary name is ${bin_name}"
5356

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

7073
# 打包
7174
mkdir -p ${folder_name}

release/build_docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ arch_list=( "amd64" "arm64" )
3434
platforms=""
3535

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

3940
if [ $? != 0 ]; then

release/conf/polaris-server.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ bootstrap:
114114
rotationMaxSize: 100
115115
rotationMaxBackups: 30
116116
rotationMaxAge: 7
117-
outputLevel: debug
117+
outputLevel: info
118118
compress: true
119119
# server plugin logs
120120
token-bucket:
@@ -181,6 +181,8 @@ bootstrap:
181181
# network_inter: eth0
182182
## Show the setting node itself IP information
183183
# self_address: 127.0.0.1
184+
# disable_heartbeat disable polaris_server node run heartbeat action to keep lease polaris_service
185+
# disable_heartbeat: true
184186
# Whether to open the server to register
185187
enable_register: true
186188
# Registered North Star Server Examples isolation status

0 commit comments

Comments
 (0)