Skip to content

Commit

Permalink
Fix libtelio/drop override in moose builds
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszWojciechO committed Oct 25, 2024
1 parent 50a71ef commit 1b6486f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
21 changes: 11 additions & 10 deletions ci/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export CGO_LDFLAGS="${CGO_LDFLAGS:-""} -Wl,-z,relro,-z,now"
# In order to enable additional features, provide `FEATURES` environment variable
tags="${FEATURES:-"telio drop"}"

source "${WORKDIR}"/ci/set_bindings_version.sh libtelio
source "${WORKDIR}"/ci/set_bindings_version.sh libdrop

if [[ $tags == *"moose"* ]]; then
# Set correct events domain in case compiling with moose
if [[ "${ENVIRONMENT}" == "prod" ]]; then
Expand All @@ -71,21 +74,19 @@ if [[ $tags == *"moose"* ]]; then
-X 'main.EventsDomain=${events_domain:-""}' \
-X 'main.EventsSubdomain=${EVENTS_SUBDOMAIN:-""}'"

# Apply moose patch in case compiling with moose
git apply "${WORKDIR}"/contrib/patches/add_moose.diff || \
# If applying fails try reverting and applying again
(git apply -R "${WORKDIR}"/contrib/patches/add_moose.diff && \
git apply "${WORKDIR}"/contrib/patches/add_moose.diff)
go mod edit -require=moose/[email protected]
go mod edit -require=moose/[email protected]
go mod edit -replace=moose/events=./third-party/moose-events/nordvpnapp/moosenordvpnappgo
go mod edit -replace=moose/worker=./third-party/moose-worker/mooseworkergo
function revert_moose_patch {
cd "${WORKDIR}"
git apply -R "${WORKDIR}"/contrib/patches/add_moose.diff
go mod edit -droprequire=moose/events
go mod edit -droprequire=moose/worker
go mod edit -dropreplace=moose/events
go mod edit -dropreplace=moose/worker
}
trap revert_moose_patch EXIT
fi

source "${WORKDIR}"/ci/set_bindings_version.sh libtelio
source "${WORKDIR}"/ci/set_bindings_version.sh libdrop

for program in ${!names_map[*]}; do # looping over keys
pushd "${WORKDIR}/cmd/${program}"
# BUILDMODE can be no value and `go` does not like empty parameter ''
Expand Down
6 changes: 5 additions & 1 deletion ci/set_bindings_version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
set -euxo pipefail

# source "${WORKDIR}/ci/export_lib_versions.sh"
function get_current_version {
partial_module_path=$1
#
full_module_path=$(go list -m all | grep $partial_module_path)
}

declare -A LIB_NAME_TO_PACKAGE=(
[libtelio]=github.com/NordSecurity/libtelio-go
Expand Down

0 comments on commit 1b6486f

Please sign in to comment.