Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(convert): handle conversion of multiple ENV in oneline in Dockerfile #479

Merged
merged 1 commit into from Aug 7, 2023

Conversation

darshilgit
Copy link
Contributor

@darshilgit darshilgit commented Aug 4, 2023

What type of PR is this?
Bug

Which issue does this PR fix:

# kind1: ENV needs a default value
ENV foo /bar
# kind2: you can also write
ENV foo=/bar
# kind3: multiple ENV in oneline
ENV TEST_PATH="/usr/share/test/bin:$PATH" \
    TEST_PATHS_CONFIG="/etc/test/test.ini" \
    TEST_PATHS_DATA="/var/lib/test" \
    TEST_PATHS_HOME="/usr/share/test" \
    TEST_PATHS_LOGS="/var/log/test" \
    TEST_PATHS_PLUGINS="/var/lib/test/plugins" \
    TEST_PATHS_PROVISIONING="/etc/test/provisioning"

The PR adds support for the 3rd kind

What does this PR do / Why do we need it:
For the stacker convert to handle Dockerfile with ENV defined in the form:

ENV TEST_PATH="/usr/share/test/bin:$PATH" \
    TEST_PATHS_CONFIG="/etc/test/test.ini" \
    TEST_PATHS_DATA="/var/lib/test" \
    TEST_PATHS_HOME="/usr/share/test" \
    TEST_PATHS_LOGS="/var/log/test" \
    TEST_PATHS_PLUGINS="/var/lib/test/plugins" \
    TEST_PATHS_PROVISIONING="/etc/test/provisioning"

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

 ✓ convert a Dockerfile

1 test, 0 failures

Automation added to e2e: enhanced test/convert.bats

Will this break upgrades or downgrades?
No

Does this PR introduce any user-facing change?: No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@darshilgit darshilgit force-pushed the fix-convert-docker-env branch 3 times, most recently from c502319 to 8fb2dd2 Compare August 4, 2023 05:59
@darshilgit darshilgit marked this pull request as ready for review August 4, 2023 05:59
@darshilgit darshilgit changed the title fix(convert): handle conversion env assigned with "=" fix(convert): handle conversion of ENV in Dockerfile assigned with "=" Aug 4, 2023
pkg/stacker/convert.go Outdated Show resolved Hide resolved
@darshilgit darshilgit changed the title fix(convert): handle conversion of ENV in Dockerfile assigned with "=" fix(convert): handle conversion of multiline ENV in Dockerfile Aug 4, 2023
@darshilgit darshilgit force-pushed the fix-convert-docker-env branch 2 times, most recently from dfaeb13 to 5e9205f Compare August 4, 2023 21:53
Signed-off-by: Darshil Parikh <darshil.parikh@gmail.com>
@darshilgit darshilgit changed the title fix(convert): handle conversion of multiline ENV in Dockerfile fix(convert): handle conversion of multiple ENV in oneline in Dockerfile Aug 4, 2023
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rchincha rchincha merged commit ac051d2 into project-stacker:main Aug 7, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants