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

fix: return code 1 if the execution fails #140

Merged
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
3 changes: 2 additions & 1 deletion package_io/build-spec.star
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def create_service_for_build_spec(plan, service_name, image, build_file):
def create_edit_and_build_spec(plan, service_name, image, chain_name, command, build_file):
service = create_service_for_build_spec(plan, service_name, image, build_file)

plan.exec(service_name = service_name, recipe = command)
result = plan.exec(service_name = service_name, recipe = command)
plan.verify(result["code"], "==", 0)

plan.store_service_files(service_name = service_name, src = "/tmp/{0}.json".format(chain_name), name = service_name)

Expand Down
9 changes: 6 additions & 3 deletions parachain/build-spec.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ def create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_
"-c",
"{0} build-spec --chain=/build/{1}.json --raw --disable-default-bootnode > /tmp/{1}-raw.json".format(binary, chain_name),
])
plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
result = plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
plan.verify(result["code"], "==", 0)

command = ExecRecipe(command = [
"/bin/sh",
"-c",
"{0} export-genesis-wasm --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-wasm".format(binary, chain_name),
])
plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
result = plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
plan.verify(result["code"], "==", 0)

command = ExecRecipe(command = [
"/bin/sh",
"-c",
"{0} export-genesis-state --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-state".format(binary, chain_name),
])
plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
result = plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command)
plan.verify(result["code"], "==", 0)

# command = ExecRecipe(command = [
# "/bin/sh",
Expand Down
14 changes: 9 additions & 5 deletions parachain/register-para-id.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ constant = import_module("../package_io/constant.star")
def register_para_id(plan, alice_ip):
plan.upload_files(src = "./static_files/javascript", name = "javascript")
test = build_spec.create_service_for_build_spec(plan, constant.PARA_SLOT_REGISTER_SERVICE_NAME, constant.NODE_IMAGE, "javascript")
plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && npm i "]))
plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && node register ws://{0}:9944 //Alice ".format(alice_ip)]))
result = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && npm i "]))
plan.verify(result["code"], "==", 0)
result = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && node register ws://{0}:9944 //Alice ".format(alice_ip)]))
plan.verify(result["code"], "==", 0)
para_id = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cat /tmp/para.json | tr -d '\n\r'"]))

plan.verify(para_id["code"], "==", 0)
plan.remove_service(test.name)
return para_id["output"]

Expand All @@ -25,7 +27,9 @@ def onboard_genesis_state_and_wasm(plan, para_id, chain_name, alice_ip):
),
)

plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && npm i "]))
plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && node onboard ws://{0}:9944 //Alice {1} /build/{2}-genesis-state /build/{2}-genesis-wasm".format(alice_ip, para_id, chain_name)]))
result = plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && npm i "]))
plan.verify(result["code"], "==", 0)
result = plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && node onboard ws://{0}:9944 //Alice {1} /build/{2}-genesis-state /build/{2}-genesis-wasm".format(alice_ip, para_id, chain_name)]))
plan.verify(result["code"], "==", 0)

plan.remove_service(service.name)
Loading