cache dir for remote actions

This commit is contained in:
Casey Lee
2020-02-23 22:34:48 -08:00
parent 94591c58d7
commit 88041afb87
5 changed files with 76 additions and 111 deletions

View File

@@ -171,7 +171,7 @@ func (cr *containerReference) remove() common.Executor {
Force: true,
})
if err != nil {
return errors.WithStack(err)
logger.Error(errors.WithStack(err))
}
logger.Debugf("Removed container: %v", cr.id)

View File

@@ -1,52 +0,0 @@
package container
import (
"bytes"
"context"
"io/ioutil"
"testing"
"github.com/nektos/act/pkg/common"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
type rawFormatter struct{}
func (f *rawFormatter) Format(entry *logrus.Entry) ([]byte, error) {
return []byte(entry.Message), nil
}
func TestNewDockerRunExecutor(t *testing.T) {
if testing.Short() {
t.Skip("skipping slower test")
}
noopLogger := logrus.New()
noopLogger.SetOutput(ioutil.Discard)
buf := &bytes.Buffer{}
logger := logrus.New()
logger.SetOutput(buf)
logger.SetFormatter(&rawFormatter{})
ctx := common.WithLogger(context.Background(), logger)
runner := NewDockerRunExecutor(NewDockerRunExecutorInput{
Image: "hello-world",
Stdout: buf,
})
puller := NewDockerPullExecutor(NewDockerPullExecutorInput{
Image: "hello-world",
})
pipeline := common.NewPipelineExecutor(puller, runner)
err := pipeline(ctx)
assert.NoError(t, err)
actual := buf.String()
assert.Contains(t, actual, `docker pull hello-world`)
assert.Contains(t, actual, `docker run image=hello-world entrypoint=[] cmd=[]`)
assert.Contains(t, actual, `Hello from Docker!`)
}