@@ -31,20 +31,20 @@ func Test_Actionlint(t *testing.T) {
3131
3232 t .Run ("Test_actionlint_error" , func (t * testing.T ) {
3333 t .Parallel ()
34- container := base ()
34+ container := base ("" )
3535 require .NotNil (t , container )
3636
3737 _ , err := container .
3838 WithMountedDirectory ("/tmp" , c .Host ().Directory ("./test/testdata/" )).
3939 WithWorkdir ("/tmp" ).
4040 WithExec ([]string {"sh" , "-c" , "find . -type f -name '*.yml' -print0 | xargs -0 actionlint" }).
41- Stdout (ctx )
41+ Stderr (ctx )
4242 require .Error (t , err )
43- require .Contains (t , err .Error (), "exit code" )
43+ require .Contains (t , err .Error (), "exit code: 123 " )
4444 })
4545 t .Run ("Test_actionlint_version" , func (t * testing.T ) {
4646 t .Parallel ()
47- container := base ()
47+ container := base ("" )
4848 require .NotNil (t , container )
4949
5050 out , err := container .
@@ -55,7 +55,7 @@ func Test_Actionlint(t *testing.T) {
5555 })
5656 t .Run ("Test_shellcheck_version" , func (t * testing.T ) {
5757 t .Parallel ()
58- container := base ()
58+ container := base ("" )
5959 require .NotNil (t , container )
6060
6161 out , err := container .
@@ -66,19 +66,18 @@ func Test_Actionlint(t *testing.T) {
6666 })
6767}
6868
69- func base () * dagger.Container {
70- install := c .Container ().
71- From ("golang:alpine" ).
72- WithExec ([]string {
73- "go" , "install" ,
74- "github.com/rhysd/actionlint/cmd/actionlint@latest" ,
75- })
76-
77- shellcheck := c .Container ().
78- From ("koalaman/shellcheck-alpine:stable" )
79-
80- return c .Container ().
81- From ("cgr.dev/chainguard/wolfi-base:latest" ).
82- WithFile ("/usr/bin/actionlint" , install .File ("/go/bin/actionlint" )).
83- WithFile ("/usr/bin/shellcheck" , shellcheck .File ("/bin/shellcheck" ))
69+ func base (
70+ image string ,
71+ ) * dagger.Container {
72+
73+ defaultImageRepository := "rhysd/actionlint"
74+ var ctr * dagger.Container
75+
76+ if image != "" {
77+ ctr = c .Container ().From (image )
78+ } else {
79+ ctr = c .Container ().From (defaultImageRepository )
80+ }
81+
82+ return ctr
8483}
0 commit comments