def final_aci(context: Context, control: dict) -> None: project.log("acbuild", context.project.pkgbase, "version", context.project.full_version) with acbuild.Build(context.branch) as b: b.set_name("homeworld.mit.edu/" + context.project.pkgbase) if "set-exec" in control: b.set_exec(*control["set-exec"].split(" ")) b.label_add("version", context.project.full_version) for x in os.listdir(context.outputdir): b.copy_in(os.path.join(context.outputdir, x), "/" + x) for port in control.get("ports", []): b.port_add(port["name"], port["protocol"], port["port"]) b.write(context.project.get_output_path(context.branch))
def perform_acbuild(context: Context, name: str, stage: str, exec: str = None, copy: list = (), env: dict = None, mounts: dict = None, labels: dict = None, ports: list = ()): project.log("acbuild", "building container", name) with acbuild.Build(context.branch) as build: build.set_name(name) if exec is not None: build.set_exec(exec) for copyentry in copy: output, input, stageent = copyentry["output"], copyentry.get( "input"), copyentry.get("stage") if [input, stageent].count(None) != 1: raise Exception( "acbuild/copy must have either input or stage, not both!") if input is not None: build.copy_in(context.input(input), output) else: build.copy_in(context.stage(stageent), output) if env is not None: for key, value in env.items(): build.env_add(key, value) if mounts is not None: for key, value in mounts.items(): build.mount_add(key, value) if labels is not None: for key, value in labels.items(): build.label_add(key, value) if ports is not None: for port in ports: build.port_add(port["name"], port["protocol"], port["port"]) build.write(context.stage(stage))