This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from grammarly/f-fix-onbuild-variables-expansion
Expand variables at the time of ONBUILD command execution
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package tests | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestEnvExpansion(t *testing.T) { | ||
|
||
err := runRockerBuildWithOptions(` | ||
FROM alpine | ||
ENV foo=bar | ||
ENV qux=replaced-$foo | ||
RUN touch /$qux | ||
RUN ls -l /replaced-bar`, "--no-cache") | ||
|
||
assert.Nil(t, err, "should expand variable in ENV command") | ||
} | ||
|
||
func TestEnvExpansionInOnbuild(t *testing.T) { | ||
|
||
err := runRockerBuildWithOptions(` | ||
FROM alpine | ||
ENV foo=bar | ||
ONBUILD ENV qux=replaced-onbuild-$foo | ||
TAG bla | ||
FROM bla | ||
RUN touch /$qux | ||
RUN ls -l /replaced-onbuild-bar`, "--no-cache") | ||
|
||
assert.Nil(t, err, "should expand variable in ONBUILD command") | ||
} |