From b05206d17d6a7a3fadd689c6674f805344aafd00 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 5 Feb 2025 10:02:59 +0100 Subject: [PATCH] tests/cstrans-df-run: cover the --shell-form option Related: https://issues.redhat.com/browse/KFLUXBUGS-1943 Related: https://issues.redhat.com/browse/OSH-809 Closes: https://github.com/csutils/csdiff/pull/217 --- tests/cstrans-df-run/0001-sf-stdout.txt | 38 ++++++++++++ tests/cstrans-df-run/0002-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0003-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0004-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0005-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0006-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0007-sf-stdout.txt | 79 +++++++++++++++++++++++++ tests/cstrans-df-run/0008-sf-stdout.txt | 13 ++++ tests/cstrans-df-run/0009-sf-stdout.txt | 61 +++++++++++++++++++ tests/cstrans-df-run/0010-sf-stdout.txt | 38 ++++++++++++ tests/cstrans-df-run/0011-sf-stdout.txt | 24 ++++++++ tests/cstrans-df-run/CMakeLists.txt | 14 ++++- tests/cstrans-df-run/sync.zsh | 9 ++- 13 files changed, 336 insertions(+), 5 deletions(-) create mode 100644 tests/cstrans-df-run/0001-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0002-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0003-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0004-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0005-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0006-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0007-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0008-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0009-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0010-sf-stdout.txt create mode 100644 tests/cstrans-df-run/0011-sf-stdout.txt diff --git a/tests/cstrans-df-run/0001-sf-stdout.txt b/tests/cstrans-df-run/0001-sf-stdout.txt new file mode 100644 index 00000000..06ead6fb --- /dev/null +++ b/tests/cstrans-df-run/0001-sf-stdout.txt @@ -0,0 +1,38 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager +ARG BUILD_PROMU=false +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'cd ${ALERTMANAGER_GOPATH} && yum install -y prometheus-promu && make build && yum clean all' + +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager +COPY --from=builder ${ALERTMANAGER_GOPATH}/amtool /bin/amtool +COPY --from=builder ${ALERTMANAGER_GOPATH}/alertmanager /bin/alertmanager +COPY --from=builder ${ALERTMANAGER_GOPATH}/examples/ha/alertmanager.yml /etc/alertmanager/alertmanager.yml + +EXPOSE 9093 +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'mkdir -p /alertmanager' +VOLUME [ "/alertmanager" ] +WORKDIR /etc/alertmanager +ENTRYPOINT [ "/bin/alertmanager" ] +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " \ + name="openshift/ose-prometheus-alertmanager" \ + License="ASL 2.0" \ + io.k8s.display-name="Prometheus Alert Manager" \ + io.openshift.build.source-location="https://github.com/openshift/prometheus-alertmanager" \ + io.openshift.build.commit.url="https://github.com/openshift/prometheus-alertmanager/commit/39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \ + version="v4.1.0" \ + io.openshift.build.commit.id="39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \ + release="201905191700" \ + vendor="Red Hat" \ + io.openshift.tags="openshift,prometheus" + diff --git a/tests/cstrans-df-run/0002-sf-stdout.txt b/tests/cstrans-df-run/0002-sf-stdout.txt new file mode 100644 index 00000000..c72c78fd --- /dev/null +++ b/tests/cstrans-df-run/0002-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'cd ${ALERTMANAGER_GOPATH} && yum install -y prometheus-promu && make build && yum clean all' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0003-sf-stdout.txt b/tests/cstrans-df-run/0003-sf-stdout.txt new file mode 100644 index 00000000..c8773311 --- /dev/null +++ b/tests/cstrans-df-run/0003-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'make' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0004-sf-stdout.txt b/tests/cstrans-df-run/0004-sf-stdout.txt new file mode 100644 index 00000000..26f84bbc --- /dev/null +++ b/tests/cstrans-df-run/0004-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'go' 'build' '--verbose' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0005-sf-stdout.txt b/tests/cstrans-df-run/0005-sf-stdout.txt new file mode 100644 index 00000000..2d81fd0f --- /dev/null +++ b/tests/cstrans-df-run/0005-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'echo \"OK\"' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0006-sf-stdout.txt b/tests/cstrans-df-run/0006-sf-stdout.txt new file mode 100644 index 00000000..2d81fd0f --- /dev/null +++ b/tests/cstrans-df-run/0006-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'echo \"OK\"' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0007-sf-stdout.txt b/tests/cstrans-df-run/0007-sf-stdout.txt new file mode 100644 index 00000000..198dacd5 --- /dev/null +++ b/tests/cstrans-df-run/0007-sf-stdout.txt @@ -0,0 +1,79 @@ +# +# This is the OpenShift ovn overlay network image. +# it provides an overlay network using ovs/ovn/ovn-kube +# +# The standard name for this image is ovn-kube + +# Notes: +# This is for a build where the ovn-kubernetes utilities +# are built in this Dockerfile and included in the image (instead of the rpm) +# + +FROM openshift/golang-builder:1.10 AS builder +ENV SOURCE_GIT_COMMIT=674977b1fdf0f966970179b9fae338f8347b2dfe SOURCE_GIT_TAG=674977b + +WORKDIR /go-controller +COPY go-controller/ . + +# build the binaries +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'make' + +FROM openshift/ose-cli:v4.1.0-201905191700 AS cli +ENV SOURCE_GIT_COMMIT=674977b1fdf0f966970179b9fae338f8347b2dfe SOURCE_GIT_TAG=674977b + +FROM openshift/ose-base:v4.1.0-201905191700 +ENV SOURCE_GIT_COMMIT=674977b1fdf0f966970179b9fae338f8347b2dfe SOURCE_GIT_TAG=674977b + +USER root + +ENV PYTHONDONTWRITEBYTECODE yes + +# install needed rpms - openvswitch must be 2.9.2 or higher +# install selinux-policy first to avoid a race +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'yum install -y \tselinux-policy && \tyum clean all' + +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'yum install -y \tPyYAML bind-utils \topenssl \tnumactl-libs \tfirewalld-filesystem \tlibpcap \thostname \t\"openvswitch2.11\" \t\"openvswitch2.11-ovn-common\" \t\"openvswitch2.11-ovn-central\" \t\"openvswitch2.11-ovn-host\" \t\"openvswitch2.11-ovn-vtep\" \t\"openvswitch2.11-devel\" \tcontainernetworking-plugins \tiproute strace socat && \tyum clean all' + +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'rm -rf /var/cache/yum' + +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'mkdir -p /var/run/openvswitch && mkdir -p /etc/cni/net.d && mkdir -p /opt/cni/bin && mkdir -p /usr/libexec/cni/' + +COPY --from=builder /go-controller/_output/go/bin/ovnkube /usr/bin/ +COPY --from=builder /go-controller/_output/go/bin/ovn-kube-util /usr/bin/ +COPY --from=builder /go-controller/_output/go/bin/ovn-k8s-cni-overlay /usr/libexec/cni/ovn-k8s-cni-overlay + +COPY --from=cli /usr/bin/oc /usr/bin +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'ln -s /usr/bin/oc /usr/bin/kubectl' + +# copy git commit number into image +COPY .git/HEAD /root/.git/HEAD +COPY .git/refs/heads/ /root/.git/refs/heads/ + +# ovnkube.sh is the entry point. This script examines environment +# variables to direct operation and configure ovn +COPY dist/images/ovnkube.sh /root/ +COPY dist/images/ovn-debug.sh /root/ +# override the rpm's ovn_k8s.conf with this local copy +COPY dist/images/ovn_k8s.conf /etc/openvswitch/ovn_k8s.conf + + + +WORKDIR /root +ENTRYPOINT /root/ovnkube.sh + +LABEL \ + io.k8s.description="This is a component of OpenShift Container Platform that provides an overlay network using ovn." \ + com.redhat.component="ose-ovn-kubernetes-container" \ + maintainer="Phil Cameron " \ + name="openshift/ose-ovn-kubernetes" \ + License="GPLv2+" \ + io.k8s.display-name="ovn kubernetes" \ + io.openshift.build.source-location="https://github.com/openshift/ovn-kubernetes" \ + summary="This is a component of OpenShift Container Platform that provides an overlay network using ovn." \ + io.openshift.build.commit.url="https://github.com/openshift/ovn-kubernetes/commit/674977b1fdf0f966970179b9fae338f8347b2dfe" \ + version="v4.1.0" \ + io.openshift.build.commit.id="674977b1fdf0f966970179b9fae338f8347b2dfe" \ + release="201905231545" \ + vendor="Red Hat" \ + io.openshift.tags="openshift" + diff --git a/tests/cstrans-df-run/0008-sf-stdout.txt b/tests/cstrans-df-run/0008-sf-stdout.txt new file mode 100644 index 00000000..fa6c67d8 --- /dev/null +++ b/tests/cstrans-df-run/0008-sf-stdout.txt @@ -0,0 +1,13 @@ +FROM openshift/golang-builder:1.11 AS builder +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 +COPY . ${ALERTMANAGER_GOPATH} +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'echo \tOK\n' +FROM ubi7:7.6-159 +ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11 + +CMD [ "--storage.path=/alertmanager" ] + +LABEL \ + io.k8s.description="This is the Prometheus Alert Manager image." \ + com.redhat.component="golang-github-prometheus-alertmanager-container" \ + maintainer="OpenShift Development " diff --git a/tests/cstrans-df-run/0009-sf-stdout.txt b/tests/cstrans-df-run/0009-sf-stdout.txt new file mode 100644 index 00000000..8bf1f3b3 --- /dev/null +++ b/tests/cstrans-df-run/0009-sf-stdout.txt @@ -0,0 +1,61 @@ +FROM ubi8/s2i-core:rhel8.1 + +# RHSCL rh-nginx114 image. + +EXPOSE 8080 +EXPOSE 8443 + +ENV NAME=nginx \ + NGINX_VERSION=1.14 \ + NGINX_SHORT_VER=114 \ + VERSION=0 + +ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \ + DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ +protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ +image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \ +as a base image for other applications based on nginx $NGINX_VERSION web server. \ +Nginx server image can be extended using source-to-image tool." + +LABEL summary="${SUMMARY}" \ + description="${DESCRIPTION}" \ + io.k8s.description="${DESCRIPTION}" \ + io.k8s.display-name="Nginx ${NGINX_VERSION}" \ + io.openshift.expose-services="8080:http" \ + io.openshift.expose-services="8443:https" \ + io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_VER}" \ + com.redhat.component="${NAME}-${NGINX_SHORT_VER}-container" \ + name="rhel8/${NAME}-${NGINX_SHORT_VER}" \ + version="1" \ + maintainer="SoftwareCollections.org " \ + help="For more information visit https://github.com/sclorg/${NAME}-container" \ + usage="s2i build rhel8/${NAME}-${NGINX_SHORT_VER}:latest " + +ENV NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \ + NGINX_CONF_PATH=/etc/nginx/nginx.conf \ + NGINX_DEFAULT_CONF_PATH=${APP_ROOT}/etc/nginx.default.d \ + NGINX_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/nginx \ + NGINX_APP_ROOT=${APP_ROOT} \ + NGINX_LOG_PATH=/var/log/nginx + +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'yum -y module enable nginx:$NGINX_VERSION && INSTALL_PKGS=\"nss_wrapper bind-utils gettext hostname nginx\" && yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && rpm -V $INSTALL_PKGS && yum clean all' + +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH + +# Copy extra files to the image. +COPY ./root/ / + +# In order to drop the root user, we have to make some directories world +# writeable as OpenShift default security model is to run the container under +# random UID. +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'sed -i -f ${NGINX_APP_ROOT}/nginxconf-fed.sed ${NGINX_CONF_PATH} && chmod a+rwx ${NGINX_CONF_PATH} && mkdir -p ${NGINX_APP_ROOT}/etc/nginx.d/ && mkdir -p ${NGINX_APP_ROOT}/etc/nginx.default.d/ && mkdir -p ${NGINX_APP_ROOT}/src/nginx-start/ && mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && mkdir -p ${NGINX_LOG_PATH} && chmod -R a+rwx ${NGINX_APP_ROOT}/etc && chmod -R a+rwx /var/lib/nginx && chmod -R a+rwx ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && chown -R 1001:0 ${NGINX_APP_ROOT} && chown -R 1001:0 /var/lib/nginx && chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && chmod -R a+rwx /var/run && chown -R 1001:0 /var/run && rpm-file-permissions' + +USER 1001 + +# Not using VOLUME statement since it's not working in OpenShift Online: +# https://github.com/sclorg/httpd-container/issues/30 +# VOLUME ["/usr/share/nginx/html"] +# VOLUME ["/var/log/nginx/"] + +CMD $STI_SCRIPTS_PATH/usage diff --git a/tests/cstrans-df-run/0010-sf-stdout.txt b/tests/cstrans-df-run/0010-sf-stdout.txt new file mode 100644 index 00000000..d6b7934e --- /dev/null +++ b/tests/cstrans-df-run/0010-sf-stdout.txt @@ -0,0 +1,38 @@ +#@follow_tag(registry-proxy.engineering.redhat.com/rh-osbs/openshift-golang-builder:v1.19.10-202306161322.el8.g42c8e14) +FROM registry-proxy.engineering.redhat.com/rh-osbs/openshift-golang-builder:v1.19.10-202306161322.el8.g42c8e14 AS builder + +COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR +WORKDIR $REMOTE_SOURCE_DIR/app +USER root +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'dnf install -y --setopt=tsflags=nodocs git' +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'sed -i \'s/CGO_ENABLED=0 //;s/containers_image_openpgp/& strictfipsruntime/\' Makefile' +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'go mod vendor && GOEXPERIMENT=strictfipsruntime make build VERSION=${CI_CONTAINER_VERSION}' + +#@follow_tag(registry.redhat.io/ubi8/podman) +FROM registry.redhat.io/ubi8/podman:8.8-14.1697647490 + +LABEL com.redhat.component="quay-builder-container" +LABEL name="quay/quay-builder-rhel8" +LABEL version=${CI_CONTAINER_VERSION} +LABEL io.k8s.display-name="Red Hat Quay - Builder" +LABEL io.k8s.description="Red Hat Quay image builder" +LABEL summary="Red Hat Quay image builder" +LABEL maintainer "hgovinda@redhat.com" + +COPY --from=builder $REMOTE_SOURCE_DIR/app/bin/quay-builder /usr/local/bin/quay-builder +COPY --from=builder $REMOTE_SOURCE_DIR/app/buildpack/ssh-git.sh /ssh-git.sh +COPY --from=builder $REMOTE_SOURCE_DIR/app/entrypoint.sh /home/podman/entrypoint.sh + +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'set -ex\t; dnf install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False git wget \t; dnf -y update && dnf -y -q clean all' + +# Rootless/unprivileged buildah configurations +# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' $'touch /etc/subgid /etc/subuid && chmod g=u /etc/subgid /etc/subuid /etc/passwd && echo \'podman:100000:65536\' > /etc/subuid && echo \'podman:100000:65536\' > /etc/subgid && \tmkdir -p /home/podman/.config/containers && (echo \'[storage]\';echo \'driver = \"vfs\"\') > /home/podman/.config/containers/storage.conf && sed -i \'s/short-name-mode=\"enforcing\"/short-name-mode=\"permissive\"/g\' /etc/containers/registries.conf && \tmkdir /certs /home/podman/.config/cni && chown podman:podman /certs /home/podman/.config/cni' + +VOLUME ["/tmp", "/certs"] + +WORKDIR /home/podman + +USER podman + +ENTRYPOINT ["sh", "/home/podman/entrypoint.sh"] diff --git a/tests/cstrans-df-run/0011-sf-stdout.txt b/tests/cstrans-df-run/0011-sf-stdout.txt new file mode 100644 index 00000000..06a457a0 --- /dev/null +++ b/tests/cstrans-df-run/0011-sf-stdout.txt @@ -0,0 +1,24 @@ +## Python cuda base ################################################################# +FROM cuda-base AS python-cuda-base + +ENV VIRTUAL_ENV=/opt/vllm +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +# install cuda and common dependencies +RUN --mount=type=cache,target=/root/.cache/pip --mount=type=bind,source=requirements-common.txt,target=requirements-common.txt --mount=type=bind,source=requirements-cuda.txt,target=requirements-cuda.txt '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'pip install -r requirements-cuda.txt' + +## Development ################################################################# +FROM python-cuda-base AS dev + +# install build and runtime dependencies +RUN --mount=type=cache,target=/root/.cache/pip --mount=type=bind,source=requirements-common.txt,target=requirements-common.txt --mount=type=bind,source=requirements-cuda.txt,target=requirements-cuda.txt --mount=type=bind,source=requirements-dev.txt,target=requirements-dev.txt --mount=type=bind,source=requirements-lint.txt,target=requirements-lint.txt --mount=type=bind,source=requirements-test.txt,target=requirements-test.txt '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'pip3 install -r requirements-cuda.txt -r requirements-dev.txt' + +## Builder ##################################################################### +FROM dev AS build + +# install build dependencies +RUN --mount=type=cache,target=/root/.cache/pip --mount=type=bind,source=requirements-build.txt,target=requirements-build.txt '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'pip install -r requirements-build.txt' + +# install compiler cache to speed up compilation leveraging local or remote caching +# git is required for the cutlass kernels +RUN '/opt/cov-sa-2019.09/bin/cov-build' '--dir=/cov' '--append-log' 'sh' '-c' 'rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && rpm -ql epel-release && microdnf install -y git ccache && microdnf clean all' diff --git a/tests/cstrans-df-run/CMakeLists.txt b/tests/cstrans-df-run/CMakeLists.txt index daee18c7..8ef4c395 100644 --- a/tests/cstrans-df-run/CMakeLists.txt +++ b/tests/cstrans-df-run/CMakeLists.txt @@ -16,15 +16,23 @@ # along with csdiff. If not, see . # a generic template for cstrans-df-run tests -macro(test_cstrans_df_run tst) +macro(test_cstrans_df_run_core tst opt tag) set(test_data_prefix "${CMAKE_CURRENT_SOURCE_DIR}/${tst}") set(cmd "${CMAKE_BINARY_DIR}/src/cstrans-df-run") - set(cmd "${cmd} -- /opt/cov-sa-2019.09/bin/cov-build --dir=/cov --append-log") + set(cmd "${cmd} ${opt} -- /opt/cov-sa-2019.09/bin/cov-build --dir=/cov --append-log") set(cmd "${cmd} <${test_data_prefix}-stdin.txt") - set(cmd "${cmd} | ${diffcmd} ${test_data_prefix}-stdout.txt -") + set(cmd "${cmd} | ${diffcmd} ${test_data_prefix}${tag}-stdout.txt -") add_test_wrap("cstrans-df-run-${tst}" "${cmd}") endmacro() +macro(test_cstrans_df_run tst) + # add default test using exec form + test_cstrans_df_run_core(${tst} "" "") + + # add another test using shell form + test_cstrans_df_run_core(${tst} "--shell-form" "-sf") +endmacro() + # cstrans-df-run tests test_cstrans_df_run(0001) test_cstrans_df_run(0002) diff --git a/tests/cstrans-df-run/sync.zsh b/tests/cstrans-df-run/sync.zsh index ae57d797..dcbe28bf 100755 --- a/tests/cstrans-df-run/sync.zsh +++ b/tests/cstrans-df-run/sync.zsh @@ -12,10 +12,15 @@ else tests=( "$@" ) fi +TEST_BIN=${PROJECT_ROOT}/csdiff_build/src/cstrans-df-run + for tst in "${tests[@]}"; do tst=${tst%-stdin.txt} - ${PROJECT_ROOT}/csdiff_build/src/cstrans-df-run \ - ${TEST_ARGS[@]} \ + ${TEST_BIN} ${TEST_ARGS[@]} \ < ${tst}-stdin.txt \ > ${tst}-stdout.txt + + ${TEST_BIN} --shell-form ${TEST_ARGS[@]} \ + < ${tst}-stdin.txt \ + > ${tst}-sf-stdout.txt done