@@ -681,10 +681,34 @@ def add_volumes(
681
681
any_path_okay : bool = False ,
682
682
) -> None :
683
683
"""Append volume mappings to the runtime option list."""
684
- staging_dir = tempfile .mkdtemp ()
685
- pathmapper .reset_stagedir (staging_dir )
686
- stage_files (pathmapper , symlink = False )
687
- self .append_volume (runtime , staging_dir , staging_dir )
684
+ container_outdir = self .builder .outdir
685
+ for key , vol in (itm for itm in pathmapper .items () if itm [1 ].staged ):
686
+ host_outdir_tgt = None # type: Optional[str]
687
+ if vol .target .startswith (container_outdir + "/" ):
688
+ host_outdir_tgt = os .path .join (
689
+ self .outdir , vol .target [len (container_outdir ) + 1 :]
690
+ )
691
+ if not host_outdir_tgt and not any_path_okay :
692
+ raise WorkflowException (
693
+ "No mandatory DockerRequirement, yet path is outside "
694
+ "the designated output directory, also know as "
695
+ "$(runtime.outdir): {}" .format (vol )
696
+ )
697
+ if vol .type in ("File" , "Directory" ):
698
+ self .add_file_or_directory_volume (runtime , vol , host_outdir_tgt )
699
+ elif vol .type == "WritableFile" :
700
+ self .add_writable_file_volume (
701
+ runtime , vol , host_outdir_tgt , tmpdir_prefix
702
+ )
703
+ elif vol .type == "WritableDirectory" :
704
+ self .add_writable_directory_volume (
705
+ runtime , vol , host_outdir_tgt , tmpdir_prefix
706
+ )
707
+ elif vol .type in ["CreateFile" , "CreateWritableFile" ]:
708
+ new_path = self .create_file_and_add_volume (
709
+ runtime , vol , host_outdir_tgt , secret_store , tmpdir_prefix
710
+ )
711
+ pathmapper .update (key , new_path , vol .target , vol .type , vol .staged )
688
712
689
713
def run (
690
714
self ,
0 commit comments