Signed-off-by: Joyce <mail@joycejang.com>
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"github.com/docker/docker/builder" |
| 7 | 7 |
"github.com/docker/docker/builder/remotecontext/git" |
| 8 | 8 |
"github.com/docker/docker/pkg/archive" |
| 9 |
+ "github.com/sirupsen/logrus" |
|
| 9 | 10 |
) |
| 10 | 11 |
|
| 11 | 12 |
// MakeGitContext returns a Context from gitURL that is cloned in a temporary directory. |
| ... | ... |
@@ -21,9 +22,14 @@ func MakeGitContext(gitURL string) (builder.Source, error) {
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
defer func() {
|
| 24 |
- // TODO: print errors? |
|
| 25 |
- c.Close() |
|
| 26 |
- os.RemoveAll(root) |
|
| 24 |
+ err := c.Close() |
|
| 25 |
+ if err != nil {
|
|
| 26 |
+ logrus.WithField("action", "MakeGitContext").WithField("module", "builder").WithField("url", gitURL).WithError(err).Error("error while closing git context")
|
|
| 27 |
+ } |
|
| 28 |
+ err = os.RemoveAll(root) |
|
| 29 |
+ if err != nil {
|
|
| 30 |
+ logrus.WithField("action", "MakeGitContext").WithField("module", "builder").WithField("url", gitURL).WithError(err).Error("error while removing path and children of root")
|
|
| 31 |
+ } |
|
| 27 | 32 |
}() |
| 28 | 33 |
return FromArchive(c) |
| 29 | 34 |
} |