summaryrefslogtreecommitdiffstats
path: root/src/endpoint/configured.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-11-11 17:04:11 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-11-11 17:05:39 +0100
commitf1626ac35ef0c8359e4a342a564a3365d96bce1c (patch)
tree3e291e3902cbe0c11bb41eb842fd2a6558430074 /src/endpoint/configured.rs
parentdbb931d96ce53ee8f94ac8604985e4408576974e (diff)
Copy package source to container before running build
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/endpoint/configured.rs')
-rw-r--r--src/endpoint/configured.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs
index c8108d9..110da7b 100644
--- a/src/endpoint/configured.rs
+++ b/src/endpoint/configured.rs
@@ -204,6 +204,29 @@ impl Endpoint {
.build();
let container = self.docker.containers().get(&container_id);
+ { // copy source to container
+ use tokio::io::AsyncReadExt;
+
+ let pkgsource = job.package_source();
+ let source_path = pkgsource.path();
+ let destination = PathBuf::from("/inputs").join({
+ source_path.file_name().ok_or_else(|| anyhow!("Not a file: {}", source_path.display()))?
+ });
+ let mut buf = vec![];
+ tokio::fs::OpenOptions::new()
+ .create(false)
+ .create_new(false)
+ .append(false)
+ .write(false)
+ .read(true)
+ .open(source_path)
+ .await?
+ .read_to_end(&mut buf)
+ .await?;
+
+
+ let _ = container.copy_file_into(destination, &buf).await?;
+ }
{ // Copy all Path artifacts to the container
job.resources()
.into_iter()