Skip to content

Commit

Permalink
add artcommon to install
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwindasr authored and MartinPl0 committed Nov 20, 2023
1 parent 9dd835f commit 0a87b3d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
45 changes: 22 additions & 23 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ LABEL name="art-bot" \
description="art-bot container image" \
maintainer="OpenShift Automated Release Tooling (ART) Team <[email protected]>"

# the build will need to run inside the firewall to access internal resources.
# install Red Hat IT Root CA and RCM repos
# This build will need to be run inside the firewall to access internal resources.
# Install Red Hat IT Root CA and RCM repos, runtime dependencies, and upgrade pip
RUN curl -o /etc/pki/ca-trust/source/anchors/RH-IT-Root-CA.crt --fail -L \
https://certs.corp.redhat.com/certs/2015-IT-Root-CA.pem \
&& curl -o /etc/pki/ca-trust/source/anchors/2022-IT-Root-CA.pem --fail -L \
Expand All @@ -16,15 +16,16 @@ RUN curl -o /etc/pki/ca-trust/source/anchors/RH-IT-Root-CA.crt --fail -L \
krb5-workstation git rsync \
python3 python3-certifi python3-rpm python3-rhmsg \
# development dependencies
gcc krb5-devel python3-devel python3-pip python3-setuptools \
# other tools
gcc krb5-devel python3-devel python3-pip \
bash-completion vim tmux wget curl iputils procps-ng psmisc net-tools iproute \
# install brewkoji
koji brewkoji \
&& dnf clean all
&& dnf clean all \
# upgrade pip
&& pip3 install --upgrade pip

# Install OpenShift Client
ARG OC_VERSION=candidate
# include oc client
RUN wget -O /tmp/openshift-client-linux-"$OC_VERSION".tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/"$OC_VERSION"/openshift-client-linux.tar.gz \
&& tar -C /usr/local/bin -xzf /tmp/openshift-client-linux-"$OC_VERSION".tar.gz oc kubectl \
&& rm /tmp/openshift-client-linux-"$OC_VERSION".tar.gz
Expand All @@ -35,38 +36,36 @@ ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the "dev" user
RUN groupadd --gid "$USER_GID" "$USERNAME" \
&& useradd --uid "$USER_UID" --gid "$USER_GID" -m "$USERNAME" \
# give access to its files
&& mkdir -p /workspaces/art-bot \
&& mkdir -p /workspaces/{elliott,doozer}{,-working-dir} \
&& mkdir -p /home/"$USERNAME"/.config/{elliott,doozer,art-bot} \
&& mkdir -p /home/"$USERNAME"/.docker \
&& mkdir -p /workspaces/art-bot /workspaces/{elliott,doozer}{,-working-dir} \
/home/"$USERNAME"/.config/{elliott,doozer,art-bot} /home/"$USERNAME"/.docker \
&& chown -R "${USER_UID}:${USER_GID}" /home/"$USERNAME" /workspaces \
&& chmod -R 0755 /home/"$USERNAME" \
&& chmod -R 0777 /workspaces \
# and allow it passwordless sudo
&& echo "$USERNAME" ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/"$USERNAME" \
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/"$USERNAME" \
&& chmod 0440 /etc/sudoers.d/"$USERNAME"

USER "$USER_UID"
# Set work directory
WORKDIR /workspaces/art-bot

# install dependencies (allow even openshift's random user to see)
ENV PATH=/home/"$USERNAME"/.local/bin:/home/"$USERNAME"/bin:"$PATH"
# Clone art-tools and run install.sh script
RUN git clone https://github.com/openshift-eng/art-tools.git /art-tools \
&& cd /art-tools \
&& ./install.sh

# Install dependencies from requirements.txt
COPY requirements.txt ./
RUN umask a+rx && pip3 install --upgrade \
"git+https://github.com/openshift-eng/art-tools.git#egg=rh-doozer&subdirectory=doozer" \
"git+https://github.com/openshift-eng/art-tools.git#egg=rh-elliott&subdirectory=elliott" \
-r ./requirements.txt
RUN pip3 install --upgrade -r requirements.txt

# install art-bot and default configs
# Install art-bot and default configs
COPY container/krb5-redhat.conf /etc/krb5.conf
COPY . /tmp/art-bot
USER 0
RUN cp -r /tmp/art-bot/{artbotlib,art-bot.py,art_bot_dev.py} . \
&& cp /tmp/art-bot/container/doozer-settings.yaml /home/"$USERNAME"/.config/doozer/settings.yaml \
&& cp /tmp/art-bot/container/elliott-settings.yaml /home/"$USERNAME"/.config/elliott/settings.yaml \
&& rm -rf /tmp/art-bot

# Return to non-root user and final work directory
USER "$USER_UID"
WORKDIR /workspaces/art-bot
2 changes: 1 addition & 1 deletion container/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ USER "$USER_UID"

# install dependencies (allow even openshift's random user to see)
COPY requirements.txt requirements-dev.txt ./
RUN umask a+rx && pip3 install --user --upgrade rh-doozer rh-elliott -r ./requirements.txt -r ./requirements-dev.txt
RUN umask a+rx && pip3 install --user --upgrade rh-doozer rh-elliott rh-artcommon -r ./requirements.txt -r ./requirements-dev.txt

# install art-bot and default configs
COPY container/krb5-redhat.conf /etc/krb5.conf
Expand Down
17 changes: 10 additions & 7 deletions container/Dockerfile.latest
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ ARG USER_GID=$USER_UID

USER 0

# install dependencies (allow even openshift's random user to see)
WORKDIR /art-tools
RUN git pull
RUN ./install.sh

# Install dependencies from requirements.txt
COPY requirements.txt ./
RUN umask a+rx && pip3 install --upgrade \
"git+https://github.com/openshift-eng/art-tools.git#egg=rh-doozer&subdirectory=doozer" \
"git+https://github.com/openshift-eng/art-tools.git#egg=rh-elliott&subdirectory=elliott" \
-r ./requirements.txt
RUN pip3 install --upgrade -r requirements.txt

# install art-bot and default configs
# Install art-bot and default configs
COPY container/krb5-redhat.conf /etc/krb5.conf
COPY . /tmp/art-bot
USER 0
RUN cp -r /tmp/art-bot/{artbotlib,art-bot.py,art_bot_dev.py} . \
&& cp /tmp/art-bot/container/doozer-settings.yaml /home/"$USERNAME"/.config/doozer/settings.yaml \
&& cp /tmp/art-bot/container/elliott-settings.yaml /home/"$USERNAME"/.config/elliott/settings.yaml \
&& rm -rf /tmp/art-bot

# Switch back to the non-root user and final work directory
USER "$USER_UID"
WORKDIR /workspaces/art-bot

0 comments on commit 0a87b3d

Please sign in to comment.