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

Makefile: switch to POSIX mode to handle errors #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Dec 2, 2020

similar to docker/docker-ce-packaging#510 and moby/sys#19 (comment)

relates to docker/docker-ce-packaging#504 (comment)

.POSIX

The application shall ensure that this special target is specified without prerequisites
or commands. If it appears as the first non-comment line in the makefile, make shall
process the makefile as specified by this section; otherwise, the behavior of make is
unspecified.

Running the makefile with .POSIX runs shells with the -e options, which helps with
handling errors; without this, make can complet "succesfully", even if shell commands
in a target fail.

Note that this patch does not change behavior on macOS, which runs an older version of
GNU make that does not support these options.

@thaJeztah
Copy link
Member Author

@silvin-lubecki @tianon PTAL

silvin-lubecki
silvin-lubecki previously approved these changes Dec 2, 2020
Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM

> .POSIX
>
> The application shall ensure that this special target is specified without prerequisites
> or commands. If it appears as the first non-comment line in the makefile, make shall
> process the makefile as specified by this section; otherwise, the behavior of make is
> unspecified.

Running the makefile with `.POSIX` runs shells with the `-e` options, which helps with
handling errors; without this, make can complet "succesfully", even if shell commands
in a target fail.

Note that this patch does not change behavior on macOS, which runs an older version of
GNU make that does not support these options.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

Rebased to check if this catches the failure we currently have in automatic runc-version detection because containerd "master" switched to go.mod, therefore these lines now fail;

RUNC_REF?=$(shell grep "opencontainers/runc" "$(CONTAINERD_DIR)/vendor.conf" | awk '{print $$2}')
else
# TODO adjust GOVERSION and RUNC_REF macro to take CONTAINERD_REMOTE into account
GOVERSION?=$(shell curl -fsSL "https://raw.githubusercontent.com/containerd/containerd/$(REF)/contrib/Dockerfile.test" | grep "ARG GOLANG_VERSION" | awk -F'=' '{print $$2}')
RUNC_REF?=$(shell curl -fsSL "https://raw.githubusercontent.com/containerd/containerd/$(REF)/vendor.conf" | grep "opencontainers/runc" | awk '{print $$2}')

@thaJeztah
Copy link
Member Author

ok, that still didn't catch that problem; we can probably have a look at another approach for that

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.

2 participants