Skip to content

Commit

Permalink
changed to spack_runner_image
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan committed Aug 24, 2023
1 parent f6154cf commit 80e2759
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wave-utils/src/main/java/io/seqera/wave/util/DockerHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ static public String spackFileToDockerFile(SpackOpts opts) {
return renderTemplate0("/templates/spack/dockerfile-spack-file.txt", binding, ignore);
}

static public String spackFileToSingularityFile(SpackOpts opts){
// create bindings
final Map<String,String> binding = spackBinding(opts);
// final ignored variables
final List<String> ignore = List.of("spack_runner_image");
// return the template
return renderTemplate0("/templates/spack/singularityfile-spack-file.txt", binding, ignore);
}


static private Map<String,String> spackBinding(SpackOpts opts) {
final Map<String,String> binding = new HashMap<>();
binding.put("add_commands", joinCommands(opts.commands));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bootstrap: docker
From: {{spack_runner_image}}
%files
/opt/spack-env /opt/spack-env
/opt/software /opt/software
/opt/._view /opt/._view
%post
{{add_commands}}
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,20 @@ class DockerHelperTest extends Specification {
apt-get update -y && apt-get install -y procps
'''.stripIndent()
}

def 'should create singularity content from spack file'(){
given:
def SPACK_OPTS = [ commands:['USER hola']]
expect:
DockerHelper.spackFileToSingularityFile(new SpackOpts(SPACK_OPTS)) =='''\
Bootstrap: docker
From: {{spack_runner_image}}
%files
/opt/spack-env /opt/spack-env
/opt/software /opt/software
/opt/._view /opt/._view
%post
USER hola'''.stripIndent()

}
}

0 comments on commit 80e2759

Please sign in to comment.