Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Reis
argotest
Commits
01da3151
Commit
01da3151
authored
Dec 14, 2018
by
Valentin Reis
Browse files
Make argotk $PWD-oblivious
parent
839af082
Pipeline
#4662
passed with stage
in 27 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
argotest/src/Argotest.hs
View file @
01da3151
...
...
@@ -23,7 +23,7 @@ import Data.Text as Text hiding (empty)
import
Data.Text.IO
as
Text
data
StackArgs
=
StackArgs
{
dargs
::
[
Text
]
--"Daemon arguments. Properly quote this."
{
dargs
::
[
Text
]
--"Daemon arguments. Properly quote this."
,
app
::
Text
--"Target application call, sh+path valid"
,
manifest
::
FilePath
--"Input file, manifest."
,
cmd_out
::
FilePath
--"Output file, application stdout"
...
...
@@ -37,7 +37,7 @@ instance Default StackArgs where
def
=
StackArgs
{
dargs
=
[]
,
app
=
"echo
\"
HelloWorld
\"
"
,
manifest
=
"
manifests/
basic.json"
,
manifest
=
"basic.json"
,
cmd_out
=
"cmd_out.log"
,
cmd_err
=
"cmd_err.log"
,
daemon_out
=
"daemon_out.log"
...
...
argotk.hs
View file @
01da3151
...
...
@@ -9,32 +9,37 @@ import Argotest
import
Turtle
import
Data.Default
import
Control.Concurrent.Async
import
System.Environment
import
System.Console.ANSI
import
System.Console.ANSI.Types
(
Color
)
import
Options.Applicative
import
System.Posix.Signals
import
Control.Monad
import
System.Environment.FindBin
opts
::
Parser
(
IO
()
)
opts
=
subparser
(
command
"clean"
(
info
(
pure
$
runClean
def
)
opts
::
StackArgs
->
Parser
(
IO
()
)
opts
sa
=
subparser
(
command
"clean"
(
info
(
pure
$
runClean
sa
)
(
progDesc
"Clean sockets, logfiles."
))
<>
command
"daemon"
(
info
(
pure
$
runDaemon
def
)
<>
command
"daemon"
(
info
(
pure
$
runDaemon
sa
)
(
progDesc
"Set up and launch the daemon in synchronous mode,
\
\
with properly cleaned sockets, logfiles."
))
<>
command
"application"
(
info
(
runApp
<$>
argument
str
idm
)
<>
command
"application"
(
info
(
runApp
sa
<$>
argument
str
idm
)
(
progDesc
"Setup stack and run an arbitrary command in a container."
))
<>
command
"helloworld"
(
info
(
pure
$
runHelloWorld
def
)
<>
command
"helloworld"
(
info
(
pure
$
runHelloWorld
sa
)
(
progDesc
"Setup stack and check that hello world app sends
\
\
message back to cmd."
))
<>
help
"Type of action to run"
)
main
::
IO
()
main
=
join
$
execParser
(
info
(
opts
<**>
helper
)
idm
)
main
=
do
manifests
<-
getEnv
"MANIFESTS"
let
sa
=
def
{
manifest
=
decodeString
manifests
</>
manifest
def
}
join
$
execParser
(
info
(
opts
sa
<**>
helper
)
idm
)
runApp
::
Text
->
IO
()
runApp
app
=
runSimpleStack
$
def
{
app
=
app
}
runApp
::
StackArgs
->
Text
->
IO
()
runApp
sa
app
=
runSimpleStack
$
sa
{
app
=
app
}
runHelloWorld
::
StackArgs
->
IO
()
runHelloWorld
a
@
StackArgs
{
..
}
=
do
...
...
default.nix
View file @
01da3151
...
...
@@ -43,6 +43,7 @@ in rec
p
.
unix
p
.
system-filepath
p
.
async
p
.
FindBin
(
pkgs
.
haskell
.
lib
.
doJailbreak
p
.
panpipe
)
]))
containers
...
...
@@ -52,6 +53,7 @@ in rec
amg
nrm
];
MANIFESTS
=
./manifests
;
};
test
=
pkgs
.
stdenv
.
mkDerivation
rec
{
...
...
@@ -62,11 +64,12 @@ in rec
name
=
"env"
;
env
=
pkgs
.
buildEnv
{
name
=
name
;
paths
=
buildInputs
;
};
buildInputs
=
[
(
hpkgs
.
ghcWithPackages
(
p
:
[
p
.
argotest
]))
(
hpkgs
.
ghcWithPackages
(
p
:
[
p
.
argotest
p
.
FindBin
]))
containers
amg
nrm
];
MANIFESTS
=
./manifests
;
};
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment