[installer] Add occlum golang debian installer

This commit is contained in:
Zheng, Qi 2022-11-01 18:42:18 +08:00 committed by volcano
parent 64c75e6d40
commit 4871f15e14
5 changed files with 23 additions and 18 deletions

@ -12,6 +12,10 @@ on:
description: 'Need build new glibc package? <Y/N>' description: 'Need build new glibc package? <Y/N>'
required: true required: true
default: 'N' default: 'N'
update_golang:
description: 'Need build new golang package? <Y/N>'
required: true
default: 'N'
only_test: only_test:
description: 'Only Test? <Y/N>' description: 'Only Test? <Y/N>'
required: true required: true
@ -75,6 +79,10 @@ jobs:
if: github.event.inputs.update_glibc == 'Y' if: github.event.inputs.update_glibc == 'Y'
run: docker exec ubuntu bash -c "cd /root/workspace/occlum/tools/installer/deb; make glibc" run: docker exec ubuntu bash -c "cd /root/workspace/occlum/tools/installer/deb; make glibc"
- name: Build golang toolchain package
if: github.event.inputs.update_golang == 'Y'
run: docker exec ubuntu bash -c "cd /root/workspace/occlum/tools/installer/deb; make golang"
- name: Prepare tools and keys # Since aptly still use gpg1 by default, we all use gpg1 as gpg tool. - name: Prepare tools and keys # Since aptly still use gpg1 by default, we all use gpg1 as gpg tool.
run: docker exec ubuntu bash -c 'apt-get update; apt-get install -y tree apt-utils gnupg reprepro rng-tools aptly; rm -rf /root/.gnupg; run: docker exec ubuntu bash -c 'apt-get update; apt-get install -y tree apt-utils gnupg reprepro rng-tools aptly; rm -rf /root/.gnupg;
echo "${{ secrets.DEB_PRIVATE_KEY }}" > /root/deb_private_key; gpg1 --allow-secret-key-import --import /root/deb_private_key; echo "${{ secrets.DEB_PRIVATE_KEY }}" > /root/deb_private_key; gpg1 --allow-secret-key-import --import /root/deb_private_key;

@ -17,11 +17,9 @@ C_TOOLCHAIN_PACKAGE_NAME := occlum-toolchains-gcc
# When updating the toolchain packages for Deb, please first update RPM configuration. And then # When updating the toolchain packages for Deb, please first update RPM configuration. And then
# update the "changelog" file accordingly. # update the "changelog" file accordingly.
MUSL_VERSION := 0.27.0 MUSL_VERSION := 0.27.0
GOLAN_VERSION := 0.16.0 GOLAN_VERSION := 1.18.4
GLIBC_VERSION := 2.31 GLIBC_VERSION := 2.31
GO_PATCH = $(PROJECT_DIR)/tools/toolchains/golang/adapt-golang-to-occlum.patch
.PHONY: all main config_files main_deps musl-gcc deps_c glibc deps_glibc clean clean-build .PHONY: all main config_files main_deps musl-gcc deps_c glibc deps_glibc clean clean-build
all: main all: main
@ -77,7 +75,6 @@ deps_golang:
mkdir -p $(TARGET_DIR) mkdir -p $(TARGET_DIR)
mkdir -p $(DEB_BUILD_DIR)/occlum-toolchains-golang mkdir -p $(DEB_BUILD_DIR)/occlum-toolchains-golang
cp -r toolchains/golang $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian cp -r toolchains/golang $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian
cp -t $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian $(GO_PATCH) $(PROJECT_DIR)/tools/installer/rpm/toolchains/golang/occlum-go.sh
glibc: deps_glibc glibc: deps_glibc
cd $(DEB_BUILD_DIR)/occlum-toolchains-glibc ; \ cd $(DEB_BUILD_DIR)/occlum-toolchains-glibc ; \

@ -1,5 +1,11 @@
occlum-toolchains-golang (1.18.4-1) unstable; urgency=medium
* Upgrade golang version to 1.18.4
-- Qi Zheng <huaiqing.zq@antgroup.com> Tue, 1 Nov 2022 17:16:9 +0000
occlum-toolchains-golang (0.16.0-1) unstable; urgency=medium occlum-toolchains-golang (0.16.0-1) unstable; urgency=medium
* Initial release * Initial release
-- Chunyang Hui <sanqian.hcy@antfin.com> Tue, 18 Aug 2020 14:37:39 +0000 -- Chunyang Hui <sanqian.hcy@antfin.com> Tue, 18 Aug 2020 14:37:39 +0000

@ -0,0 +1 @@
export PATH="$PATH:/opt/occlum/toolchains/golang/bin"

@ -9,12 +9,9 @@ export install_dir = $(buildroot)/opt/occlum/toolchains/golang
SHELL = /bin/bash SHELL = /bin/bash
# Needed by musl-cross-make config # go1.18.4_for_occlum or go1.16.3_for_occlum
TARGET = x86_64-linux-musl GO_BRANCH = go1.18.4_for_occlum
GCC_VER = 8.3.0 GO_REPO = https://github.com/occlum/go.git
GO_VERSION = 1.13.7
GO_REPO = https://github.com/golang/go/archive/go$(GO_VERSION).tar.gz
GO_PATCH = adapt-golang-to-occlum.patch
.ONESHELL: prepare override_dh_install .ONESHELL: prepare override_dh_install
@ -27,19 +24,15 @@ prepare:
rm -rf $(install_dir) rm -rf $(install_dir)
mkdir -p $(tmp_build_dir) mkdir -p $(tmp_build_dir)
cd $(tmp_build_dir) cd $(tmp_build_dir)
wget $(GO_REPO) git clone -b $(GO_BRANCH) $(GO_REPO) .
tar -xvzf go$(GO_VERSION).tar.gz
cd go-go$(GO_VERSION)
patch -p1 < $(deb_build_dir)/$(name)/debian/$(GO_PATCH)
override_dh_auto_build: prepare override_dh_auto_build: prepare
cd $(tmp_build_dir)/go-go$(GO_VERSION)/src; \ cd $(tmp_build_dir)/src; \
export GO_LDFLAGS="-compressdwarf=false"; \
./make.bash ./make.bash
override_dh_install: override_dh_install:
mkdir -p $(buildroot)/opt/occlum/toolchains mkdir -p $(buildroot)/opt/occlum/toolchains
mv $(tmp_build_dir)/go-go$(GO_VERSION)/ $(install_dir) mv $(tmp_build_dir)/ $(install_dir)
rm -rf $(install_dir)/.git* rm -rf $(install_dir)/.git*
cat > $(install_dir)/bin/occlum-go <<EOF cat > $(install_dir)/bin/occlum-go <<EOF
#!/bin/bash #!/bin/bash