Skip to content

Commit

Permalink
Get version from the folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipinofficial11 committed Dec 19, 2023
1 parent ad2e033 commit f3924ff
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/main/scripts/run_cdap_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import shutil
import argparse
import re
import configparser


def run_shell_command(cmd):
Expand All @@ -38,6 +39,18 @@ def get_sandbox_version(directory_path):
return version


def get_hydrator_branch(gitmodules_path, submodule_path):
config = configparser.ConfigParser()
config.read(gitmodules_path)

# Check if the submodule exists in the .gitmodules file
if config.has_section(f"submodule \"{submodule_path}\""):
branch = config.get(f"submodule \"{submodule_path}\"", "branch")
return branch
else:
return None


# Parse command line optional arguments
parser = argparse.ArgumentParser()
parser.add_argument('--testRunner', help='TestRunner class to execute tests')
Expand All @@ -52,8 +65,25 @@ def get_sandbox_version(directory_path):
my_env["_JAVA_OPTIONS"] = "-Xmx32G"
# Building the plugins
os.chdir("..")
# Create a logic to clone cdap-build repo based on cdap branch and then from cdap-build repo get hydrator branch
cdap_build_branch = "develop"
cdap_build_repository_url = "https://github.com/cdapio/cdap-build.git"
subprocess.run(["git", "clone", "-b", cdap_build_branch, cdap_build_repository_url])

# .gitmodules file path and hydrator submodule path.
gitmodules_path = "./cdap-build/.gitmodules"
submodule_path = "app-artifacts/hydrator-plugins"
branch = get_hydrator_branch(gitmodules_path, submodule_path)

if branch is not None:
print(f"The branch of submodule '{submodule_path}' is: {branch}")
else:
print(f"Submodule '{submodule_path}' not found in .gitmodules file.")


hydrator_repository_branch = branch
hydrator_repository_url = "https://github.com/cdapio/hydrator-plugins.git"
subprocess.run(["git", "clone", hydrator_repository_url])
subprocess.run(["git", "clone", "-b", hydrator_repository_branch, hydrator_repository_url])
os.chdir("./hydrator-plugins")
run_shell_command("git submodule update --init --recursive --remote")
run_shell_command("mvn clean install -DskipTests")
Expand Down

0 comments on commit f3924ff

Please sign in to comment.