Skip to content

Catch yum update/upgrade but ignore other update/upgrade in RUN#111

Open
cassiussa wants to merge 4 commits intoprojectatomic:masterfrom
cassiussa:master
Open

Catch yum update/upgrade but ignore other update/upgrade in RUN#111
cassiussa wants to merge 4 commits intoprojectatomic:masterfrom
cassiussa:master

Conversation

@cassiussa
Copy link

When RUN has the word yum and at some later point the same RUN also contains update all, update, or upgrade, the condition was being met. However this can break some workflows.

For example, the following matches the condition pointlessly because of line 4. No actual yum upgrade happens here but the current conditions make it appear that way.

1 RUN yum install -y python2 py-setuptools \
2    && yum clean all \
3    && easy_install pip \
4    && pip install --upgrade pip

Instead, we can match by spaces and/or tabs using [ \t]+. This way yum, followed by any number of spaces or tabs, followed by update all, update, or upgrade would allow the above Dockerfile to pass but the below Dockerfile would fail correctly or as expected.

1 RUN yum   update \
2    && yum install -y python2 py-setuptools \
3    && yum clean all \
4    && easy_install pip \
5    && pip install --upgrade pip

The same change can probably be made to the other installer methods, such as apt-get etc.

@lphiri
Copy link
Collaborator

lphiri commented Aug 9, 2018

LGTM!

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.

3 participants

Comments