grim/convey

Parents 14e4e891eda9
Children 35cb993e3262
Correctly expand environment variable's in convey/clean tasks' files argument
--- a/ChangeLog Sun Jan 21 21:44:40 2018 -0600
+++ b/ChangeLog Thu Jan 25 17:40:22 2018 -0600
@@ -1,6 +1,8 @@
0.13.2dev:
* Changed tasks names for bitbucket pipeline tasks.
* Abstracted the bitbucket pipeline script parsing to a library function.
+ * Fixed an issue where the files for clean tasks were not having their
+ variables expanded
0.13.1: 20180114
* Write warning, error, and fatal log messages to stderr. Fixed #156
--- a/intrinsic/clean.go Sun Jan 21 21:44:40 2018 -0600
+++ b/intrinsic/clean.go Thu Jan 25 17:40:22 2018 -0600
@@ -78,7 +78,12 @@
}
for _, pattern := range c.Files {
- matches, err := zglob.Glob(pattern)
+ expandedPattern, err := environment.Mapper(pattern, fullEnv)
+ if err != nil {
+ return err
+ }
+
+ matches, err := zglob.Glob(expandedPattern)
if err == os.ErrNotExist {
// Glob was an explicit name, but the file doesn't exist. Silently
// ignore this case, just as RemoveAll ignores no change to the FS.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/clean.yml Thu Jan 25 17:40:22 2018 -0600
@@ -0,0 +1,15 @@
+# This is a simple test that makes sure the clean task can remove files that
+# have an environment variable in their name.
+---
+environment:
+ - HOST_PATH=.
+tasks:
+ clean:
+ type: convey/clean
+ files:
+ - ${HOST_PATH}/dirty
+ - ${HOST_PATH}/**/bar.baz
+plans:
+ default:
+ stages:
+ - tasks: clean