From f4027f05118d75b959b726da5dbdc5be220c258a Mon Sep 17 00:00:00 2001 From: uazo Date: Wed, 30 Jun 2021 12:44:14 +0000 Subject: [PATCH] Improve dockerfiles --- images/bromite-build/Dockerfile | 3 ++- images/bromite-build/build_args.gni | 23 +++++++++++++++++++++ images/bromite-build/pre-start.sh | 5 ----- images/bromite-build/start-build.sh | 25 +++++++++++++++++++++-- images/bromite-source/Dockerfile | 2 +- images/goma-server/Dockerfile | 2 +- images/goma-server/install-goma-server.sh | 1 + images/goma-server/start-goma-server.sh | 2 ++ 8 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 images/bromite-build/build_args.gni diff --git a/images/bromite-build/Dockerfile b/images/bromite-build/Dockerfile index f6f877a..c496132 100644 --- a/images/bromite-build/Dockerfile +++ b/images/bromite-build/Dockerfile @@ -1,6 +1,6 @@ ARG VERSION -FROM localhost:5000/uazo/bromite:$VERSION +FROM uazo/bromite:$VERSION ARG VERSION ENV VERSION=$VERSION @@ -10,6 +10,7 @@ COPY pre-start.sh . COPY start-build.sh . COPY goma_auth.py . COPY casupload . +COPY build_args.gni . RUN sudo chmod +x ./start-build.sh \ && \ diff --git a/images/bromite-build/build_args.gni b/images/bromite-build/build_args.gni new file mode 100644 index 0000000..6558b1d --- /dev/null +++ b/images/bromite-build/build_args.gni @@ -0,0 +1,23 @@ + +declare_args() { + _is_debug_build = "" + target_cpu = "x86" +} + +_is_debug_build = getenv("TARGET_ISDEBUG") + +not_needed(["_target_build", "_is_debug_build"]) + +if(getenv("TARGET_CPU") != "") { + target_cpu = getenv("TARGET_CPU") +} +print("Target " + target_cpu) + +if(!(_is_debug_build == "")) { + print("Debug build on") + is_debug = true + is_official_build = false + dcheck_always_on = true + symbol_level = 1 + strip_debug_info = false +} diff --git a/images/bromite-build/pre-start.sh b/images/bromite-build/pre-start.sh index 4293cdc..315155a 100644 --- a/images/bromite-build/pre-start.sh +++ b/images/bromite-build/pre-start.sh @@ -12,8 +12,3 @@ cipd install infra/goma/client/linux-amd64 -root $WORKSPACE/goma echo "nomatter" >$WORKSPACE/.debug_auth_file sudo cp $WORKSPACE/goma_auth.py $WORKSPACE/goma/ - -cd chromium/src - -echo -e ${RED} -------- gn gen ${NC} -gn gen --args="$(cat ../../bromite/build/GN_ARGS) target_cpu=\"x86\" use_goma=true goma_dir=\"$WORKSPACE/goma\" " out/bromite diff --git a/images/bromite-build/start-build.sh b/images/bromite-build/start-build.sh index 5c8461e..7fd5057 100644 --- a/images/bromite-build/start-build.sh +++ b/images/bromite-build/start-build.sh @@ -21,12 +21,23 @@ $WORKSPACE/goma/goma_ctl.py ensure_start cd chromium/src +OUT_PRESENT=0 +test -d out/bromite && OUT_PRESENT=1 +if [[ OUT_PRESENT -eq 0 ]]; then + echo -e ${RED} -------- gn gen ${NC} + gn gen --args="import(\"../../bromite/build/GN_ARGS\") use_goma=true goma_dir=\"$WORKSPACE/goma\" $(cat ../../build_args.gni) " out/bromite + + echo -e ${RED} -------- gn args ${NC} + gn args out/bromite/ --list --short + gn args out/bromite/ --list >$WORKSPACE/artifacs/gn_list +fi + if [[ -z "${GOMAJOBS}" ]]; then GOMAJOBS=40 fi echo -e ${RED} -------- pre-cache toolchain ${NC} -../../casupload --cas-server=http://$REMOTEEXEC_ADDR --instance=default_instance \ +sudo ../../casupload --cas-server=unix:/tmp/proxy/bots.sock --instance=default_instance \ third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include \ third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/include \ third_party/llvm-build/Release+Asserts/lib \ @@ -37,6 +48,16 @@ echo -e ${RED} -------- pre-cache toolchain ${NC} echo -e ${RED} -------- start build ${NC} autoninja -j $GOMAJOBS -C out/bromite chrome_public_apk +echo -e ${RED} -------- end build ${NC} -bash +wget http://127.0.0.1:8088/logz?subproc-INFO -o out/artifacs/goma-client.log +cp out/bromite/apks/* $WORKSPACE/artifacs/ + +echo -e ${RED} -------- generating breakpad symbols ${NC} +autoninja -j $GOMAJOBS -C out/bromite minidump_stackwalk dump_syms +components/crash/content/tools/generate_breakpad_symbols.py --build-dir=out/bromite \ + --symbols-dir=$WORKSPACE/artifacs/symbols/ --binary=out/bromite/lib.unstripped/libchrome.so --clear --verbose +cp out/bromite/lib.unstripped/libchrome.so $WORKSPACE/artifacs/symbols/libchrome.lib.so +cp out/bromite/minidump_stackwalk $WORKSPACE/artifacs/symbols +cp out/bromite/dump_syms $WORKSPACE/artifacs/symbols diff --git a/images/bromite-source/Dockerfile b/images/bromite-source/Dockerfile index cd6c54e..d3e2bb5 100644 --- a/images/bromite-source/Dockerfile +++ b/images/bromite-source/Dockerfile @@ -1,6 +1,6 @@ ARG VERSION -FROM localhost:5000/uazo/chromium:$VERSION +FROM uazo/chromium:$VERSION ARG VERSION ENV VERSION=$VERSION diff --git a/images/goma-server/Dockerfile b/images/goma-server/Dockerfile index 647b8ab..75620f5 100644 --- a/images/goma-server/Dockerfile +++ b/images/goma-server/Dockerfile @@ -6,7 +6,7 @@ COPY config-file . RUN apt-get update \ && \ - apt-get -y install sudo wget git \ + apt-get -y install sudo wget git socat \ && \ sudo chmod +x ./install-goma-server.sh \ && \ diff --git a/images/goma-server/install-goma-server.sh b/images/goma-server/install-goma-server.sh index 61db901..612b1c4 100755 --- a/images/goma-server/install-goma-server.sh +++ b/images/goma-server/install-goma-server.sh @@ -12,6 +12,7 @@ echo -e ${RED} -------- install go 16.2 ${NC} wget https://golang.org/dl/go1.16.2.linux-amd64.tar.gz sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf go1.16.2.linux-amd64.tar.gz +rm go1.16.2.linux-amd64.tar.gz echo -e ${RED} -------- cloning goma-server ${NC} diff --git a/images/goma-server/start-goma-server.sh b/images/goma-server/start-goma-server.sh index 41f0f6f..fea1494 100755 --- a/images/goma-server/start-goma-server.sh +++ b/images/goma-server/start-goma-server.sh @@ -7,6 +7,8 @@ NC='\033[0m' # No Color echo -e ${RED} -------- start goma-server ${NC} +socat UNIX-LISTEN:/tmp/proxy/bots.sock,reuseaddr,fork TCP4:$REMOTEEXEC_ADDR & + cd ./goma-server/ /usr/local/go/bin/go run ./cmd/remoteexec_proxy/main.go \ --port 5050 \