Skip to content

Commit

Permalink
Remove private bindings when compile script finishes
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Baranski <me@gbaranski.com>
Co-authored-by: Grzegorz Baranski <grzegorz.baranski@nordsec.com>
  • Loading branch information
bartoszWojciechO and gbaranski authored Jan 10, 2025
1 parent af23f1f commit a70aae6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ tags="${FEATURES:-"telio drop"}"
source "${WORKDIR}"/ci/set_bindings_version.sh libtelio
source "${WORKDIR}"/ci/set_bindings_version.sh libdrop

trap -- '${WORKDIR}/ci/remove_private_bindings.sh moose/events; ${WORKDIR}/ci/remove_private_bindings.sh moose/worker; ${WORKDIR}/ci/remove_private_bindings.sh quench' EXIT
if [[ $tags == *"moose"* ]]; then
# Set correct events domain in case compiling with moose
if [[ "${ENVIRONMENT}" == "prod" ]]; then
Expand Down
13 changes: 13 additions & 0 deletions ci/remove_private_bindings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# This script removes private module dependencies from go.mod by dropping the 'require' and 'replace' directives for a given module name.
# Usage: ./ci/remove_private_bindings.sh <MODULE>

bindings_name=$1

if [ -z "$bindings_name" ]; then
echo "error no bindings name provided"
exit 1
fi

go mod edit -droprequire="$bindings_name" || { echo "failed to drop require for $bindings_name"; exit 1; }
go mod edit -dropreplace="$bindings_name" || { echo "failed to drop replace for $bindings_name"; exit 1; }
1 change: 1 addition & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tags="internal"
# everything
if [ "${1:-""}" = "full" ]; then
# Apply moose patch in case compiling with moose
trap '${WORKDIR}/ci/remove_private_bindings.sh moose/events; ${WORKDIR}/ci/remove_private_bindings.sh moose/worker;' EXIT
source "${WORKDIR}"/ci/add_private_bindings.sh moose/events ./third-party/moose-events/moosenordvpnappgo/v15
source "${WORKDIR}"/ci/add_private_bindings.sh moose/worker ./third-party/moose-worker/mooseworkergo/v14

Expand Down

0 comments on commit a70aae6

Please sign in to comment.