Skip to content
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

[YUNIKORN-2425] Use 'go mod edit' to replace internal module references #170

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 17 additions & 10 deletions tools/build-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,30 @@ def update_dep_ref_k8shim(local_repo_path):
mod_file = os.path.join(local_repo_path, "go.mod")
if not os.path.isfile(mod_file):
fail("k8shim go.mod does not exist")
with open(mod_file, "a") as file_object:
file_object.write("\n")
file_object.write("replace github.com/apache/yunikorn-core => ../core \n")
file_object.write(
"replace github.com/apache/yunikorn-scheduler-interface => ../scheduler-interface \n")

path = os.getcwd()
os.chdir(local_repo_path)
command = ['go', 'mod', 'edit']
command.extend(['-replace', 'github.com/apache/yunikorn-core=../core'])
command.extend(['-replace', 'github.com/apache/yunikorn-scheduler-interface=../scheduler-interface'])
retcode = subprocess.call(command)
if retcode:
fail("failed to update k8shim go.mod references")
os.chdir(path)

# core depends on scheduler-interface
def update_dep_ref_core(local_repo_path):
print("updating dependency for core")
mod_file = os.path.join(local_repo_path, "go.mod")
if not os.path.isfile(mod_file):
fail("core go.mod does not exist")
with open(mod_file, "a") as file_object:
file_object.write("\n")
file_object.write(
"replace github.com/apache/yunikorn-scheduler-interface => ../scheduler-interface \n")
path = os.getcwd()
os.chdir(local_repo_path)
command = ['go', 'mod', 'edit']
command.extend(['-replace', 'github.com/apache/yunikorn-scheduler-interface=../scheduler-interface'])
retcode = subprocess.call(command)
if retcode:
fail("failed to update core go.mod references")
os.chdir(path)


# update go mod in the repos
Expand Down
Loading