From 5aabcbd78d234c10b8274b0ae747c6dbed697ed6 Mon Sep 17 00:00:00 2001 From: Nicolas Gelot Date: Fri, 1 Oct 2021 11:22:19 +0200 Subject: [PATCH 1/4] Copy build-community script in Dockerfile --- .gitlab-ci.yml | 2 -- Dockerfile.community | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2df3114..df2bc7c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,8 +29,6 @@ build_prod: build_community: extends: .build_image - before_script: - - "mv build-community.sh src/build.sh" variables: IMAGE_TAG: $CI_COMMIT_REF_NAME-community IMAGE_TAG_RELEASE: community diff --git a/Dockerfile.community b/Dockerfile.community index 1444d9c..23fc214 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -134,6 +134,7 @@ VOLUME /root/.ssh # Copy required files ##################### COPY src/ /root/ +COPY build-community.sh /root/build.sh # Create missing directories ############################ -- GitLab From effec3b4f754b129088b6633c70b727f2d6a77ab Mon Sep 17 00:00:00 2001 From: Nicolas Gelot Date: Fri, 1 Oct 2021 11:24:42 +0200 Subject: [PATCH 2/4] Handle e tags without spam stdout --- Dockerfile | 2 +- Dockerfile.community | 2 +- build-community.sh | 3 +-- src/build.sh | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index eed5b20..10b203c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -143,7 +143,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick jq kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/Dockerfile.community b/Dockerfile.community index 23fc214..20f0563 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -154,7 +154,7 @@ RUN apt-get -qq update RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \ - curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ + curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick jq kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ diff --git a/build-community.sh b/build-community.sh index a6b156e..6d7fd08 100755 --- a/build-community.sh +++ b/build-community.sh @@ -133,8 +133,7 @@ for branch in ${BRANCH_NAME//,/ }; do yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>> "$repo_log" else TAG_PREFIX="" - curl https://gitlab.e.foundation/api/v4/projects/659/repository/tags | grep "\"name\":\"$branch\"" - if [ $? == 0 ] + if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q "${BRANCH_NAME}" then echo "Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" TAG_PREFIX="refs/tags/" diff --git a/src/build.sh b/src/build.sh index e494faf..9a280e8 100755 --- a/src/build.sh +++ b/src/build.sh @@ -87,7 +87,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] (Re)initializing branch repository" TAG_PREFIX="" - if curl https://gitlab.e.foundation/api/v4/projects/659/repository/tags | grep "\"name\":\"${BRANCH_NAME}\"" + if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q ${BRANCH_NAME} then echo "Branch name ${BRANCH_NAME} is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" TAG_PREFIX="refs/tags/" -- GitLab From 4b029ec2455a70adfd72077f639789daf4130a6d Mon Sep 17 00:00:00 2001 From: Nicolas Gelot Date: Fri, 1 Oct 2021 11:29:00 +0200 Subject: [PATCH 3/4] Enforce cleanup on lineageos and framework/base repo --- build-community.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-community.sh b/build-community.sh index 6d7fd08..f7f4e0c 100755 --- a/build-community.sh +++ b/build-community.sh @@ -123,7 +123,7 @@ for branch in ${BRANCH_NAME//,/ }; do if [ -d "$path" ]; then cd "$path" git reset -q --hard - git clean -q -fd + git clean -q -dffx cd "$SRC_DIR/$branch_dir" fi done -- GitLab From 7cdfe57e2928570968536b7327ee053926734d1d Mon Sep 17 00:00:00 2001 From: Nicolas Gelot Date: Fri, 1 Oct 2021 11:32:56 +0200 Subject: [PATCH 4/4] Unify logs with date prefix --- build-community.sh | 8 ++++---- src/build.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build-community.sh b/build-community.sh index f7f4e0c..91fa867 100755 --- a/build-community.sh +++ b/build-community.sh @@ -135,7 +135,7 @@ for branch in ${BRANCH_NAME//,/ }; do TAG_PREFIX="" if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q "${BRANCH_NAME}" then - echo "Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" + echo ">> [$(date)] Branch name $branch is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" TAG_PREFIX="refs/tags/" fi @@ -289,8 +289,8 @@ for branch in ${BRANCH_NAME//,/ }; do # Start the build echo ">> [$(date)] Starting build for $codename, $branch branch" | tee -a "$DEBUG_LOG" build_successful=false - echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - echo "Switch to Python2" + echo ">> [$(date)] ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + echo ">> [$(date)] Switch to Python2" ln -fs /usr/bin/python2 /usr/bin/python @@ -366,7 +366,7 @@ for branch in ${BRANCH_NAME//,/ }; do fi fi - echo "Switch back to Python3" + echo ">> [$(date)] Switch back to Python3" ln -fs /usr/bin/python3 /usr/bin/python fi done diff --git a/src/build.sh b/src/build.sh index 9a280e8..4c61f09 100755 --- a/src/build.sh +++ b/src/build.sh @@ -89,7 +89,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then TAG_PREFIX="" if curl -s https://gitlab.e.foundation/api/v4/projects/659/repository/tags | jq -r ".[].name" | grep -q ${BRANCH_NAME} then - echo "Branch name ${BRANCH_NAME} is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" + echo ">> [$(date)] Branch name ${BRANCH_NAME} is a tag on e/os/releases, prefix with refs/tags/ for 'repo init'" TAG_PREFIX="refs/tags/" fi yes | repo init -u "$REPO" -b "${TAG_PREFIX}${BRANCH_NAME}" @@ -196,8 +196,8 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Start the build echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" build_successful=false - echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - echo "Switch to Python2" + echo ">> [$(date)] ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + echo ">> [$(date)] Switch to Python2" ln -fs /usr/bin/python2 /usr/bin/python BRUNCH_DEVICE=${DEVICE} @@ -300,7 +300,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi - echo "Switch back to Python3" + echo ">> [$(date)] Switch back to Python3" ln -fs /usr/bin/python3 /usr/bin/python fi -- GitLab