async def push_docker_images( request: PublishDockerImageRequest, docker: DockerBinary, options: DockerOptions ) -> PublishProcesses: tags = tuple( chain.from_iterable( cast(BuiltDockerImage, image).tags for pkg in request.packages for image in pkg.artifacts ) ) if request.field_set.skip_push.value: return PublishProcesses( [ PublishPackages( names=tags, description=f"(by `{request.field_set.skip_push.alias}` on {request.field_set.address})", ), ] ) env = await Get(Environment, EnvironmentRequest(options.env_vars)) processes = zip(tags, docker.push_image(tags, env)) return PublishProcesses( [ PublishPackages( names=(tag,), process=InteractiveProcess.from_process(process), ) for tag, process in processes ] )
async def debug_python_test(field_set: PythonTestFieldSet) -> TestDebugRequest: if field_set.is_conftest_or_type_stub(): return TestDebugRequest(None) setup = await Get(TestSetup, TestSetupRequest(field_set, is_debug=True)) return TestDebugRequest( InteractiveProcess.from_process(setup.process, forward_signals_to_process=False) )
async def setup_shunit2_debug_test( field_set: Shunit2FieldSet) -> TestDebugRequest: setup = await Get(TestSetup, TestSetupRequest(field_set)) return TestDebugRequest( InteractiveProcess.from_process(setup.process, forward_signals_to_process=False, restartable=True))
async def push_docker_images( request: PublishDockerImageRequest, docker: DockerBinary, options: DockerOptions ) -> PublishProcesses: tags = tuple( chain.from_iterable( cast(BuiltDockerImage, image).tags for pkg in request.packages for image in pkg.artifacts ) ) if request.field_set.skip_push.value: return PublishProcesses( [ PublishPackages( names=tags, description=f"(by `{request.field_set.skip_push.alias}` on {request.field_set.address})", ), ] ) process = docker.push_image(tags) return PublishProcesses( [ PublishPackages( names=tags, process=InteractiveProcess.from_process(process) if process else None, ), ] )
async def twine_upload(request: PublishToPyPiRequest, twine_subsystem: TwineSubsystem) -> PublishProcesses: dists = tuple(artifact.relpath for pkg in request.packages for artifact in pkg.artifacts if artifact.relpath) if twine_subsystem.skip or not dists: return PublishProcesses() # Too verbose to provide feedback as to why some packages were skipped? skip = None if request.field_set.skip_twine.value: skip = f"(by `{request.field_set.skip_twine.alias}` on {request.field_set.address})" elif not request.field_set.repositories.value: # I'd rather have used the opt_out mechanism on the field set, but that gives no hint as to # why the target was not applicable.. skip = f"(no `{request.field_set.repositories.alias}` specified for {request.field_set.address})" if skip: return PublishProcesses([ PublishPackages( names=dists, description=skip, ), ]) twine_pex, packages_digest, config_files = await MultiGet( Get( VenvPex, PexRequest( output_filename="twine.pex", internal_only=True, requirements=twine_subsystem.pex_requirements(), interpreter_constraints=twine_subsystem. interpreter_constraints, main=twine_subsystem.main, ), ), Get(Digest, MergeDigests(pkg.digest for pkg in request.packages)), Get(ConfigFiles, ConfigFilesRequest, twine_subsystem.config_request()), ) input_digest = await Get( Digest, MergeDigests((packages_digest, config_files.snapshot.digest))) pex_proc_requests = [] twine_envs = await MultiGet( Get(Environment, EnvironmentRequest, twine_env_request(repo)) for repo in request.field_set.repositories.value) for repo, env in zip(request.field_set.repositories.value, twine_envs): pex_proc_requests.append( VenvPexProcess( twine_pex, argv=twine_upload_args(twine_subsystem, config_files, repo, dists), input_digest=input_digest, extra_env=twine_env(env, repo), description=repo, )) processes = await MultiGet( Get(Process, VenvPexProcess, request) for request in pex_proc_requests) return PublishProcesses( PublishPackages( names=dists, process=InteractiveProcess.from_process(process), description=process.description, data=PublishOutputData({"repository": process.description}), ) for process in processes)
async def debug_python_test(field_set: PythonTestFieldSet) -> TestDebugRequest: if field_set.is_conftest(): return TestDebugRequest(None) setup = await Get(TestSetup, TestSetupRequest(field_set, is_debug=True)) return TestDebugRequest(InteractiveProcess.from_process(setup.process))
async def debug_python_test(field_set: PythonTestFieldSet) -> TestDebugRequest: setup = await Get(TestSetup, TestSetupRequest(field_set, is_debug=True)) return TestDebugRequest( InteractiveProcess.from_process(setup.process, forward_signals_to_process=False, restartable=True))