Skip to content

Enhance 'pipefail' warnings #6

@srcshelton

Description

@srcshelton

When a RUN block contains a pipeline, not having set pipefail results in:

/ER0001/ Set the SHELL option -o(-eo for Alpine image) pipefail before RUN with a pipe in

... whilst having set pipefail (correctly) by default gives:

/SC2039/ In POSIX sh, set option pipefail is undefined.

I'm not sure of a good solution to this since docker/podman/buildah use the container's sh rather than a bundled standardised version - the -s option can be set on the command-line, but is there a directive which sets this and can be used inline in a file.

Also, using set -o pipefail at the top of a block containing a pipeline doesn't quell the warning when the pipeline (for which pipefail is now active) is encountered - in fact, all of these generate ER0001:

RUN set -o pipefail ; \
    ... \
    cmd1 | cmd2
RUN set -o pipefail && \
    ... \
    cmd1 | cmd2
RUN ... \
    set -o pipefail ; cmd1 | cmd2
RUN ... \
    set -o pipefail && cmd1 | cmd2

... so I'm unsure as to what syntax can be used to avoid triggering this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions