File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,15 @@ pub(crate) struct BuildVariant {
41
41
impl BuildVariant {
42
42
pub ( super ) async fn run ( & self ) -> Result < ( ) > {
43
43
let project = project:: load_or_find_project ( self . project_path . clone ( ) ) . await ?;
44
+ let token = project. token ( ) ;
44
45
let tempdir = tools_tempdir ( ) ?;
45
46
install_tools ( & tempdir) . await ?;
46
47
let makefile_path = tempdir. path ( ) . join ( "Makefile.toml" ) ;
47
48
let packages_dir =
48
49
TempDir :: new ( ) . context ( "Unable to create a tempdir for Twoliter's packages" ) ?;
49
50
50
51
let sdk_container = DockerContainer :: new (
51
- "sdk" ,
52
+ format ! ( "sdk-{}" , token ) ,
52
53
project
53
54
. sdk ( & self . arch )
54
55
. context ( "The project was missing an sdk" ) ?
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use log::{debug, trace};
5
5
use non_empty_string:: NonEmptyString ;
6
6
use serde:: de:: Error ;
7
7
use serde:: { Deserialize , Deserializer , Serialize , Serializer } ;
8
+ use sha2:: { Digest , Sha512 } ;
8
9
use std:: fmt;
9
10
use std:: path:: { Path , PathBuf } ;
10
11
use tokio:: fs;
@@ -115,6 +116,13 @@ impl Project {
115
116
pub ( crate ) fn toolchain ( & self , arch : & str ) -> Option < ImageArchUri > {
116
117
self . toolchain_name ( ) . map ( |s| s. uri ( arch) )
117
118
}
119
+
120
+ pub ( crate ) fn token ( & self ) -> String {
121
+ let mut d = Sha512 :: new ( ) ;
122
+ d. update ( self . filepath ( ) . display ( ) . to_string ( ) ) ;
123
+ let digest = hex:: encode ( d. finalize ( ) ) ;
124
+ ( digest[ ..12 ] ) . to_string ( )
125
+ }
118
126
}
119
127
120
128
/// A base name for an image that can be suffixed using a naming convention. For example,
You can’t perform that action at this time.
0 commit comments