From 68b503323c1730a4d8213e2f60bda9fe1fb94751 Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Oct 31 2018 03:53:30 +0000 Subject: Revert "CI/CD: Install build dependencies at runtime" This reverts commit 225cd5ec2edc7683d377712b2e577eaa4a006e9c. I did try running sudo on OpenShift and found it worked (maybe I logged into another cluster with looser policies applied?). But on UpShift Prod it is not allowed to run setuid programs (including sudo). So please revert this change. Dependencies rarely change. We could introduce some manual operations to deal with that before there is a real solution. So let's just rebuild the Jenkins slave image with new dependencies. --- diff --git a/openshift/containers/jenkins-slave/Dockerfile b/openshift/containers/jenkins-slave/Dockerfile index c8630e8..8df3a7a 100644 --- a/openshift/containers/jenkins-slave/Dockerfile +++ b/openshift/containers/jenkins-slave/Dockerfile @@ -10,7 +10,7 @@ USER root ARG TINI_VERSION=0.18.0 RUN dnf -y install 'dnf-command(builddep)' dnf-utils git mock-core-configs tar gzip skopeo \ - sudo wget postgresql make rpmdevtools rpmlint \ + wget postgresql make rpmdevtools rpmlint \ python3-flake8 python3-pylint python3-pytest \ python3-sphinx python3-sphinxcontrib-httpdomain \ origin-clients \ @@ -23,9 +23,6 @@ RUN dnf -y install 'dnf-command(builddep)' dnf-utils git mock-core-configs tar g # clean up && dnf clean all -# Allow OpenShift assigned user to use sudo -RUN echo '%root ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/root-group - # install build dependencies for WaiverDB COPY waiverdb.spec /usr/local/src/waiverdb/waiverdb.spec RUN cd /usr/local/src/waiverdb \ @@ -33,7 +30,5 @@ RUN cd /usr/local/src/waiverdb \ && dnf clean all \ && cd / && rm -rf /usr/local/src/waiverdb WORKDIR /var/lib/jenkins/ -# Install entrypoint.sh -COPY openshift/containers/jenkins-slave/entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/usr/local/bin/tini", "--", "/entrypoint.sh", "jenkins-slave"] +ENTRYPOINT ["/usr/local/bin/tini", "--", "jenkins-slave"] USER 1000 diff --git a/openshift/containers/jenkins-slave/entrypoint.sh b/openshift/containers/jenkins-slave/entrypoint.sh deleted file mode 100755 index c2cb419..0000000 --- a/openshift/containers/jenkins-slave/entrypoint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Dynamically associate a username to OpenShift assigned UIDs. -# See: https://docs.openshift.org/latest/creating_images/guidelines.html#openshift-origin-specific-guidelines - -export USER_ID=$(id -u) -export GROUP_ID=$(id -g) - -# Skip for root user -if [ x"$USER_ID" != x"0" ]; then - echo "jenkins:x:${USER_ID}:${GROUP_ID}:jenkins:${HOME}:/bin/bash" >> /etc/passwd -fi - -exec "$@" diff --git a/openshift/pipelines/templates/waiverdb-dev.Jenkinsfile b/openshift/pipelines/templates/waiverdb-dev.Jenkinsfile index d8de73c..95a779b 100644 --- a/openshift/pipelines/templates/waiverdb-dev.Jenkinsfile +++ b/openshift/pipelines/templates/waiverdb-dev.Jenkinsfile @@ -94,8 +94,6 @@ pipeline { env.TEMP_TAG = env.WAIVERDB_CONTAINER_VERSION + '-jenkins-' + currentBuild.id } sh 'cp conf/settings.py.example conf/settings.py' - // install build dependencies - sh 'dnf -y builddep waiverdb.spec' } } stage('Run checks') {