Skip to content

Commit db37930

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

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}..."
@@ -159,7 +176,7 @@ git clone -q -b v${GITALY_SERVER_VERSION} --depth 1 ${GITLAB_GITALY_URL} ${GITLA
159176
make -C ${GITLAB_GITALY_BUILD_DIR} install
160177
mkdir -p ${GITLAB_GITALY_INSTALL_DIR}
161178
# The following line causes some issues. However, according to
162-
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5512> and
179+
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5512> and
163180
# <https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5671> there seems to
164181
# be some attempts to remove ruby from gitaly.
165182
#
@@ -176,7 +193,7 @@ rm -rf ${GITLAB_GITALY_BUILD_DIR}
176193

177194
# remove go
178195
go clean --modcache
179-
rm -rf ${GITLAB_BUILD_DIR}/go${GOLANG_VERSION}.linux-amd64.tar.gz ${GOROOT}
196+
rm -rf ${GITLAB_BUILD_DIR:?}/${GOLANG_ARCHIVE} ${GOROOT}
180197

181198
# remove HSTS config from the default headers, we configure it in nginx
182199
exec_as_git sed -i "/headers\['Strict-Transport-Security'\]/d" ${GITLAB_INSTALL_DIR}/app/controllers/application_controller.rb

0 commit comments

Comments
 (0)