Skip to content

Commit fbf3508

Browse files
committed
Add support to build arm64 image
Stolen from sameersbn#2732 Signed-off-by: Hermann Mayer <[email protected]>
1 parent d347652 commit fbf3508

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

assets/build/install.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,27 @@ RUBY_SRC_URL=https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION%.*}/ruby-${RUBY
1414

1515
GEM_CACHE_DIR="${GITLAB_BUILD_DIR}/cache"
1616

17+
# check system platform
18+
# TODO: cover as many variations as possible (depending on the platform supported by golang)
19+
case "$(uname -m)" in
20+
"x86_64")
21+
PLATFORM_NAME="amd64"
22+
;;
23+
"aarch64")
24+
PLATFORM_NAME="arm64"
25+
;;
26+
*)
27+
echo "The platform not supported ($(uname -a))"
28+
exit 1
29+
esac
30+
31+
GOLANG_ARCHIVE="go${GOLANG_VERSION}.linux-${PLATFORM_NAME}.tar.gz"
32+
1733
GOROOT=/tmp/go
1834
PATH=${GOROOT}/bin:$PATH
1935

2036
export GOROOT PATH
37+
export GOPROXY="https://proxy.golang.org"
2138

2239
# TODO Verify, if this is necessary or not.
2340
# BUILD_DEPENDENCIES="gcc g++ make patch pkg-config cmake paxctl \
@@ -109,9 +126,9 @@ BUNDLER_VERSION="$(grep "BUNDLED WITH" ${GITLAB_INSTALL_DIR}/Gemfile.lock -A 1 |
109126
gem install bundler:"${BUNDLER_VERSION}"
110127

111128
# download golang
112-
echo "Downloading Go ${GOLANG_VERSION}..."
113-
wget -cnv https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz -P ${GITLAB_BUILD_DIR}/
114-
tar -xf ${GITLAB_BUILD_DIR}/go${GOLANG_VERSION}.linux-amd64.tar.gz -C /tmp/
129+
echo "Downloading Go ${GOLANG_VERSION} for ${PLATFORM_NAME}..."
130+
wget -cnv https://storage.googleapis.com/golang/${GOLANG_ARCHIVE} -P ${GITLAB_BUILD_DIR}/
131+
tar -xf ${GITLAB_BUILD_DIR}/${GOLANG_ARCHIVE} -C /tmp/
115132

116133
# install gitlab-shell
117134
echo "Downloading gitlab-shell v.${GITLAB_SHELL_VERSION}..."
@@ -156,7 +173,7 @@ git clone -q -b v${GITALY_SERVER_VERSION} --depth 1 ${GITLAB_GITALY_URL} ${GITLA
156173
make -C ${GITLAB_GITALY_BUILD_DIR} install
157174
mkdir -p ${GITLAB_GITALY_INSTALL_DIR}
158175
# The following line causes some issues. However, according to
159-
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5512> and
176+
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5512> and
160177
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5671> there seems to
161178
# be some attempts to remove ruby from gitaly.
162179
#
@@ -173,7 +190,7 @@ rm -rf ${GITLAB_GITALY_BUILD_DIR}
173190

174191
# remove go
175192
go clean --modcache
176-
rm -rf ${GITLAB_BUILD_DIR}/go${GOLANG_VERSION}.linux-amd64.tar.gz ${GOROOT}
193+
rm -rf ${GITLAB_BUILD_DIR:?}/${GOLANG_ARCHIVE} ${GOROOT}
177194

178195
# revert `rake gitlab:setup` changes from gitlabhq/gitlabhq@a54af831bae023770bf9b2633cc45ec0d5f5a66a
179196
exec_as_git sed -i 's/db:reset/db:setup/' ${GITLAB_INSTALL_DIR}/lib/tasks/gitlab/setup.rake

0 commit comments

Comments
 (0)