Skip to content

Commit

Permalink
Merge pull request containers#12218 from vrothberg/pause-catatonit
Browse files Browse the repository at this point in the history
infra container: replace pause with catatonit
  • Loading branch information
openshift-merge-robot authored Nov 16, 2021
2 parents f031bd2 + c8790bf commit 197ebe8
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 117 deletions.
23 changes: 4 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ ifdef HOMEBREW_PREFIX
endif
endif

# For building pause/pause.c
GCC ?= gcc
PAUSE_CFLAGS = -Os -static -Wall -Werror -DVERSION=v$(RELEASE_VERSION)

###
### Primary entry-point targets
###
Expand All @@ -201,7 +197,7 @@ default: all
all: binaries docs

.PHONY: binaries
binaries: podman podman-remote rootlessport pause
binaries: podman podman-remote rootlessport ## Build podman, podman-remote and rootlessport binaries

# Extract text following double-# for targets, as their description for
# the `help` target. Otherwise These simple-substitutions are resolved
Expand Down Expand Up @@ -379,12 +375,6 @@ bin/rootlessport: .gopathok $(SOURCES) go.mod go.sum
.PHONY: rootlessport
rootlessport: bin/rootlessport

bin/pause: pause/pause.c
$(GCC) $(PAUSE_CFLAGS) pause/pause.c -o bin/pause

.PHONY: pause
pause: bin/pause

###
### Secondary binary-build targets
###
Expand Down Expand Up @@ -744,7 +734,7 @@ install.remote-nobuild:
install.remote: podman-remote install.remote-nobuild

.PHONY: install.bin-nobuild
install.bin-nobuild: install.pause
install.bin-nobuild:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
install ${SELINUXOPT} -m 755 bin/podman $(DESTDIR)$(BINDIR)/podman
test -z "${SELINUXOPT}" || chcon --verbose --reference=$(DESTDIR)$(BINDIR)/podman bin/podman
Expand Down Expand Up @@ -798,10 +788,8 @@ install.docker-docs-nobuild:
.PHONY: install.docker-docs
install.docker-docs: docker-docs install.docker-docs-nobuild

.PHONY: install.pause
install.pause: pause
install ${SELINUXOPT} -m 755 -d $(DESTDIR)$(LIBEXECPODMAN)/pause
install ${SELINUXOPT} -m 755 bin/pause $(DESTDIR)$(LIBEXECPODMAN)/pause/pause
.PHONY: install.docker-full
install.docker-full: install.docker install.docker-docs

.PHONY: install.systemd
ifneq (,$(findstring systemd,$(BUILDTAGS)))
Expand Down Expand Up @@ -832,9 +820,6 @@ else
install.systemd:
endif

.PHONY: install.pause
install.pause: pause

.PHONY: install.tools
install.tools: .install.goimports .install.gitvalidation .install.md2man .install.ginkgo .install.golangci-lint .install.bats ## Install needed tools

Expand Down
7 changes: 7 additions & 0 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ die_unknown() {
die "Unknown/unsupported \$$var_name '$var_value'"
}

msg "************************************************************"
msg "FIXME: force-install catatonit 0.17.0 until CI images are updated"
msg "************************************************************"
# FIXME: this is just a temporary workaround to force-install
# catatonit 0.17.0. Please remove once the images are updated.
./hack/install_catatonit.sh --force

msg "************************************************************"
msg "Setting up runtime environment"
msg "************************************************************"
Expand Down
2 changes: 1 addition & 1 deletion contrib/spec/podman.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ BuildRequires: libselinux-devel
BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: systemd-devel
Requires: catatonit >= 0.1.7
Requires: containers-common
Requires: conmon
Requires: containernetworking-plugins >= 0.6.0-3
Expand Down Expand Up @@ -529,7 +530,6 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%{_usr}/lib/tmpfiles.d/podman.conf
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/rootlessport
%{_libexecdir}/%{name}/pause/pause

%if 0%{?with_devel}
%files -n libpod-devel -f devel.file-list
Expand Down
33 changes: 17 additions & 16 deletions hack/install_catatonit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ CATATONIT_PATH="${BASE_PATH}/catatonit"
CATATONIT_VERSION="v0.1.7"
set -e

if [ -f $CATATONIT_PATH ]; then
if [ -f $CATATONIT_PATH ] && [ -z "$1" ]; then
echo "skipping ... catatonit is already installed"
else
echo "installing catatonit to $CATATONIT_PATH"
buildDir=$(mktemp -d)
git clone https://github.com/openSUSE/catatonit.git $buildDir
exit 0
fi

pushd $buildDir
echo `pwd`
git reset --hard ${CATATONIT_VERSION}
autoreconf -fi
./configure
make
install ${SELINUXOPT} -d -m 755 $BASE_PATH
install ${SELINUXOPT} -m 755 catatonit $CATATONIT_PATH
popd
echo "installing catatonit to $CATATONIT_PATH"
buildDir=$(mktemp -d)
git clone https://github.com/openSUSE/catatonit.git $buildDir

rm -rf $buildDir
fi
pushd $buildDir
echo `pwd`
git reset --hard ${CATATONIT_VERSION}
autoreconf -fi
./configure
make
install ${SELINUXOPT} -d -m 755 $BASE_PATH
install ${SELINUXOPT} -m 755 catatonit $CATATONIT_PATH
popd

rm -rf $buildDir
69 changes: 0 additions & 69 deletions pause/pause.c

This file was deleted.

13 changes: 5 additions & 8 deletions pkg/specgen/generate/pod_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@ func buildPauseImage(rt *libpod.Runtime, rtConfig *config.Config) (string, error
return imageName, nil
}

// NOTE: Having the pause binary in its own directory keeps the door
// open for replacing the image building with using an overlay root FS.
// The latter turned out to be complex and error prone (see #11956) but
// we may be able to come up with a proper solution at a later point in
// time.
pausePath, err := rtConfig.FindHelperBinary("pause/pause", false)
// Also look into the path as some distributions install catatonit in
// /usr/bin.
catatonitPath, err := rtConfig.FindHelperBinary("catatonit", true)
if err != nil {
return "", fmt.Errorf("finding pause binary: %w", err)
}

buildContent := fmt.Sprintf(`FROM scratch
COPY %s /pause
ENTRYPOINT ["/pause"]`, pausePath)
COPY %s /catatonit
ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)

tmpF, err := ioutil.TempFile("", "pause.containerfile")
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/apiv2/40-pods.at
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ t GET libpod/pods/fakename/top 404 \
.cause="no such pod"

t GET libpod/pods/foo/top 200 \
.Processes[0][-1]="/pause" \
.Processes[0][-1]="/catatonit -P" \
.Titles[-1]="COMMAND"

t GET libpod/pods/foo/top?ps_args=args,pid 200 \
.Processes[0][0]="/pause" \
.Processes[0][0]="/catatonit -P" \
.Processes[0][1]="1" \
.Titles[0]="COMMAND" \
.Titles[1]="PID" \
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/pod_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@ var _ = Describe("Podman pod create", func() {
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
Expect(check1).Should(Exit(0))
Expect(check1.OutputToString()).To(Equal("/pause"))
Expect(check1.OutputToString()).To(Equal("/catatonit -P"))

// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2).Should(Exit(0))
Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
Expect(check2.OutputToString()).To(Equal("/catatonit:[-P]"))
})

It("podman create pod with --infra-command", func() {
Expand Down

0 comments on commit 197ebe8

Please sign in to comment.