Skip to content

Commit

Permalink
feat: static file plugin upload & curl plugin via github resources
Browse files Browse the repository at this point in the history
  • Loading branch information
vanderheijden86 committed May 18, 2024
1 parent 8b3cfa7 commit aca8b40
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/node_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -190,26 +190,39 @@ def cp(plan, node_name, src, dest):


def download_to_path_and_untar(plan, node_name, url, dest):
# Install curl
plan.exec(
service_name=node_name,
recipe=ExecRecipe(
command=["/bin/sh", "-c",
"apt update --allow-insecure-repositories && apt-get install curl -y --allow-unauthenticated"]
)
)
plan.print("Downloading {0} to {1}".format(url, dest))

# Download the file
download_path = "/static_files/subnet_vm.tar.gz"
plan.print("Downloading {0} to {1}".format(url, download_path))
plan.exec(
service_name=node_name,
recipe=ExecRecipe(
command=["/bin/sh", "-c", "curl {0} -o {1}".format(url, dest)]
command=["/bin/sh", "-c", "mkdir -p /static_files/ && curl -L {0} -o {1}".format(url, download_path)]
)
)
plan.print("Untaring {0} to {1}".format(dest, ABS_PLUGIN_DIRPATH))

# Untar the downloaded file
plan.print("Untaring {0}".format(download_path))
plan.exec(
service_name=node_name,
recipe=ExecRecipe(
# untar above downloaded file
command=["/bin/sh", "-c", "tar -zxvf {0} -C /avalanchego/build/plugins/".format(dest)]
command=["/bin/sh", "-c", "mkdir -p /avalanchego/build/plugins && tar -zxvf {0} -C /static_files/".format(download_path)]
)
)

# Move the extracted binary to the destination
plan.print("Moving extracted binary to {0}".format(dest))
plan.exec(
service_name=node_name,
recipe=ExecRecipe(
command=["/bin/sh", "-c", "mv /static_files/subnet-evm {0}".format(dest)]
)
)

0 comments on commit aca8b40

Please sign in to comment.