Add a ENV tests with special chars in the values
| ... | ... |
@@ -3732,6 +3732,9 @@ ENV FROM hello/docker/world |
| 3732 | 3732 |
ENV TO /docker/world/hello |
| 3733 | 3733 |
ADD $FROM $TO |
| 3734 | 3734 |
RUN [ "$(cat $TO)" = "hello" ] |
| 3735 |
+ENV abc=def |
|
| 3736 |
+ENV ghi=$abc |
|
| 3737 |
+RUN [ "$ghi" = "def" ] |
|
| 3735 | 3738 |
` |
| 3736 | 3739 |
ctx, err := fakeContext(dockerfile, map[string]string{
|
| 3737 | 3740 |
"hello/docker/world": "hello", |
| ... | ... |
@@ -3774,6 +3777,26 @@ ENV abc 'yyy' |
| 3774 | 3774 |
RUN [ $abc = \'yyy\' ] |
| 3775 | 3775 |
ENV abc= |
| 3776 | 3776 |
RUN [ "$abc" = "" ] |
| 3777 |
+ |
|
| 3778 |
+# use grep to make sure if the builder substitutes \$foo by mistake |
|
| 3779 |
+# we don't get a false positive |
|
| 3780 |
+ENV abc=\$foo |
|
| 3781 |
+RUN [ "$abc" = "\$foo" ] && (echo "$abc" | grep foo) |
|
| 3782 |
+ENV abc \$foo |
|
| 3783 |
+RUN [ "$abc" = "\$foo" ] && (echo "$abc" | grep foo) |
|
| 3784 |
+ |
|
| 3785 |
+ENV abc=\'foo\' |
|
| 3786 |
+RUN [ "$abc" = "'foo'" ] |
|
| 3787 |
+ENV abc=\"foo\" |
|
| 3788 |
+RUN [ "$abc" = "\"foo\"" ] |
|
| 3789 |
+ENV abc "foo" |
|
| 3790 |
+RUN [ "$abc" = "\"foo\"" ] |
|
| 3791 |
+ENV abc 'foo' |
|
| 3792 |
+RUN [ "$abc" = "'foo'" ] |
|
| 3793 |
+ENV abc \'foo\' |
|
| 3794 |
+RUN [ "$abc" = "\\'foo\\'" ] |
|
| 3795 |
+ENV abc \"foo\" |
|
| 3796 |
+RUN [ "$abc" = "\\\"foo\\\"" ] |
|
| 3777 | 3797 |
` |
| 3778 | 3798 |
ctx, err := fakeContext(dockerfile, map[string]string{
|
| 3779 | 3799 |
"hello/docker/world": "hello", |