Skip to content

Move ee files from OSS to private repo script #5858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*ee.rs
24 changes: 23 additions & 1 deletion backend/substitute_ee_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ root_dirpath="$(cd "${script_dirpath}/.." && pwd)"

REVERT="NO"
COPY="NO"
MOVE_NEW_FILES="NO"
EE_CODE_DIR="../windmill-ee-private/"

while [[ $# -gt 0 ]]; do
Expand All @@ -15,6 +16,7 @@ while [[ $# -gt 0 ]]; do
# this to work (commit hooks should prevent this from happening, as well as the fact
# that we're using symlinks by default).
REVERT="YES"
MOVE_NEW_FILES="YES"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that the -r|--revert case automatically sets MOVE_NEW_FILES="YES", which doesn't align with the expected behavior. This forces the move functionality to run whenever reverting, even if not explicitly requested. Consider removing this line to keep the revert functionality focused on its primary purpose, allowing users to explicitly combine flags when needed.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended

shift
;;
-c|--copy)
Expand All @@ -25,6 +27,11 @@ while [[ $# -gt 0 ]]; do
COPY="YES"
shift # past argument
;;
-m|--move-new-files)
# This moves all new EE files from the public repository to the private repository.
MOVE_NEW_FILES="YES"
shift # past argument
;;
-d|--dir)
# Path to the local directory of the windmill-ee-private repository. By defaults, it
# assumes it is cloned next to the Windmill OSS repo.
Expand Down Expand Up @@ -64,7 +71,7 @@ if [ "$REVERT" == "YES" ]; then
ce_file="${root_dirpath}/backend/${ce_file}"
rm ${ce_file}
done
else
elif [ "$MOVE_NEW_FILES" == "NO" ]; then
# This replaces all files in current repo with alternative EE files in windmill-ee-private
for ee_file in $(find "${EE_CODE_DIR}" -name "*ee.rs"); do
ce_file="${ee_file/${EE_CODE_DIR}/}"
Expand All @@ -78,3 +85,18 @@ else
fi
done
fi

if [ "$MOVE_NEW_FILES" == "YES" ]; then
for ce_file in $(find "${root_dirpath}"/backend/windmill-*/src/ -name "*ee.rs"); do
backend_dirpath="${root_dirpath}/backend/"
ee_file="${ce_file/${backend_dirpath}/}"
ee_file="${EE_CODE_DIR}${ee_file}"
if [ ! -f "${ee_file}" ]; then
mv "${ce_file}" "${ee_file}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the target directory for the moved file exists (e.g., use mkdir -p $(dirname "${ee_file}")) before executing mv.

Suggested change
mv "${ce_file}" "${ee_file}"
mkdir -p "$(dirname \"${ee_file}\")" && mv "${ce_file}" "${ee_file}"

if [ ! "$REVERT" == "YES" ]; then
ln -s "${ee_file}" "${ce_file}"
fi
echo "File moved '${ce_file}' -->> '${ee_file}'"
fi
done
fi