From 4b094efafd876687cf25fe825cef68dc07f225b3 Mon Sep 17 00:00:00 2001 From: Bartosz Oleaczek <122802123+bartoszWojciechO@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:22:23 +0100 Subject: [PATCH] Add quench when building the application --- .env.sample | 1 + .gitmodules | 3 +++ ci/add_private_bindings.sh | 14 ++++++++++++++ ci/check_dependencies.sh | 9 +++++++++ ci/compile.sh | 7 ++++++- ci/test.sh | 3 ++- lib-versions.env | 1 + third-party/libquench-go | 1 + 8 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 ci/add_private_bindings.sh create mode 160000 third-party/libquench-go diff --git a/.env.sample b/.env.sample index 0646572c..990d82c6 100644 --- a/.env.sample +++ b/.env.sample @@ -5,6 +5,7 @@ SALT=f1nd1ngn3m0 # * telio # * drop # * moose - internal builds only +# * quench - internal builds only # * internal - internal builds only FEATURES=telio drop # Used for mage targets, when set to 1, fetching docker images will be skipped if it is already fetched. diff --git a/.gitmodules b/.gitmodules index 5e348b82..ef3460c6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "third-party/moose-worker"] path = third-party/moose-worker url = ../../../../moose/moose-events.git +[submodule "third-party/libquench-go"] + path = third-party/libquench-go + url = ../../libquench-go diff --git a/ci/add_private_bindings.sh b/ci/add_private_bindings.sh new file mode 100644 index 00000000..464f7f36 --- /dev/null +++ b/ci/add_private_bindings.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +bindings_name=$1 +bindings_path=$2 + +go mod edit -require="$bindings_name"@v0.0.0 +go mod edit -replace="$bindings_name"="$bindings_path" + +function revert_private_bindings { + go mod edit -droprequire="$bindings_name" + go mod edit -dropreplace="$bindings_name" +} + +trap revert_private_bindings EXIT \ No newline at end of file diff --git a/ci/check_dependencies.sh b/ci/check_dependencies.sh index 876bab5e..299e9594 100755 --- a/ci/check_dependencies.sh +++ b/ci/check_dependencies.sh @@ -23,6 +23,10 @@ libmoose_worker_artifact_url="${LIBMOOSE_WORKER_ARTIFACTS_URL}/${LIBMOOSE_WORKER libmoose_worker_zipfile="${temp_dir}/libmoose-worker-${LIBMOOSE_WORKER_VERSION}.zip" libmoose_worker_dst="${temp_dir}/libmoose-worker-${LIBMOOSE_WORKER_VERSION}" +libquench_artifact_url="${LIBQUENCH_ARTIFACTS_URL}/${LIBQUENCH_VERSION}/linux.zip" +libquench_zipfile="${temp_dir}/libquench-${LIBQUENCH_VERSION}.zip" +libquench_dst="${temp_dir}/libquench-${LIBQUENCH_VERSION}" + lib_versions_file="${WORKDIR}/lib-versions.env" checkout_completed_flag_file="${lib_root}/checkout-completed-flag" @@ -109,6 +113,7 @@ fetch_gitlab_artifact "${libdrop_artifact_url}" "${libdrop_zipfile}" if [[ "${FEATURES:-""}" == *internal* ]]; then fetch_gitlab_artifact "${libmoose_nordvpnapp_artifact_url}" "${libmoose_nordvpnapp_zipfile}" fetch_gitlab_artifact "${libmoose_worker_artifact_url}" "${libmoose_worker_zipfile}" + fetch_gitlab_artifact "${libquench_artifact_url}" "${libquench_zipfile}" fi # ====================[ Unzip files ]========================= @@ -119,6 +124,7 @@ unzip -o "${libdrop_zipfile}" -d "${temp_dir}" && mv "${temp_dir}/libdrop" "${li if [[ "${FEATURES:-""}" == *internal* ]]; then unzip -o "${libmoose_nordvpnapp_zipfile}" -d "${temp_dir}" && mv "${temp_dir}/out" "${libmoose_nordvpnapp_dst}" unzip -o "${libmoose_worker_zipfile}" -d "${temp_dir}" && mv "${temp_dir}/out" "${libmoose_worker_dst}" + unzip -o "${libquench_zipfile}" -d "${temp_dir}" && mv "${temp_dir}/dist" "${libquench_dst}" fi # ====================[ Copy to bin/deps/libs ]========================= @@ -140,6 +146,9 @@ if [[ "${FEATURES:-""}" == *internal* ]]; then # moose worker copy_to_libs "${libmoose_worker_dst}/worker/bin/worker/linux" "libmooseworker.so" + + # libquench + copy_to_libs "${libquench_dst}/linux/release" "libquench.so" fi # remove leftovers diff --git a/ci/compile.sh b/ci/compile.sh index 12843954..052cfa37 100755 --- a/ci/compile.sh +++ b/ci/compile.sh @@ -74,7 +74,12 @@ if [[ $tags == *"moose"* ]]; then -X 'main.EventsDomain=${events_domain:-""}' \ -X 'main.EventsSubdomain=${EVENTS_SUBDOMAIN:-""}'" - source "${WORKDIR}"/ci/add_moose.sh + source "${WORKDIR}"/ci/add_private_bindings.sh moose/events ./third-party/moose-events/moosenordvpnappgo/v14 + source "${WORKDIR}"/ci/add_private_bindings.sh moose/worker ./third-party/moose-worker/mooseworkergo/v14 +fi + +if [[ $tags == *"quench"* ]]; then + source "${WORKDIR}"/ci/add_private_bindings.sh quench ./third-party/libquench-go fi for program in ${!names_map[*]}; do # looping over keys diff --git a/ci/test.sh b/ci/test.sh index cdbdc215..0ca4e5cd 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -18,7 +18,8 @@ tags="internal" # everything if [ "${1:-""}" = "full" ]; then # Apply moose patch in case compiling with moose - source "${WORKDIR}"/ci/add_moose.sh + source "${WORKDIR}"/ci/add_private_bindings.sh moose/events ./third-party/moose-events/moosenordvpnappgo/v14 + source "${WORKDIR}"/ci/add_private_bindings.sh moose/worker ./third-party/moose-worker/mooseworkergo/v14 excluded_packages="thisshouldneverexist" excluded_categories="root,link" diff --git a/lib-versions.env b/lib-versions.env index 0ffde2e9..0d94dbb7 100644 --- a/lib-versions.env +++ b/lib-versions.env @@ -7,3 +7,4 @@ LIBTELIO_VERSION=v5.0.3 LIBDROP_VERSION=v8.1.1 LIBMOOSE_NORDVPNAPP_VERSION=v14.3.0-nordVpnApp LIBMOOSE_WORKER_VERSION=v14.3.0-worker +LIBQUENCH_VERSION=v0.0.16 diff --git a/third-party/libquench-go b/third-party/libquench-go new file mode 160000 index 00000000..76bb1326 --- /dev/null +++ b/third-party/libquench-go @@ -0,0 +1 @@ +Subproject commit 76bb1326780c5dcc5cae2f9b8e169548192ec9ff