Skip to content

Commit

Permalink
Shift a couple of stages from Jenkinsfile into Dockerfile
Browse files Browse the repository at this point in the history
The Jenkins job on our new deployment is running Docker containers with
the option `-u 1000:1000` instead of `-u 0:0` which results in
permissions issues when doing administrative things such as using
`apt-get` to install stuff.

So this commit moves the install stages of the test run into a
Dockerfile, so that the image which is all nicely configured can then be
used to run the tests.

Relates to NGC-1447.
  • Loading branch information
james-smith-za committed Dec 2, 2024
1 parent 1d88c3f commit 0736d98
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
37 changes: 37 additions & 0 deletions Dockerfile.CI
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# syntax = docker/dockerfile:1

################################################################################
# Copyright (c) 2024, National Research Foundation (SARAO)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

FROM ubuntu:24.04

COPY . .

# Install dependencies
# jq and iproute2 are used to find the interface IPv4 address
RUN apt-get update && apt-get -y --no-install-recommends install libpython3-dev python3-venv jq iproute2
RUN python3 -m venv /venv
RUN .ci/install-sys-pkgs.sh
RUN PATH="/venv/bin:$PATH" .ci/py-requirements.sh

# Install Python package
RUN PATH="/venv/bin:$PATH" pip install -v \
--config-settings=setup-args=--native-file=ci.ini \
--config-settings=setup-args=-Dibv=enabled \
--config-settings=setup-args=-Dibv_hw_rate_limit=enabled \
--config-settings=setup-args=-Dmlx5dv=enabled \
.

24 changes: 2 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

pipeline {
agent {
docker {
dockerfile {
label 'spead2'
filename 'Dockerfile.CI'
registryCredentialsId 'dockerhub' // Supply credentials to avoid rate limit
image 'ubuntu:24.04'
// These arguments allow direct access to the NVIDIA NIC with ibverbs
args '--network=host --ulimit=memlock=-1 -e NVIDIA_MOFED=enabled -e NVIDIA_VISIBLE_DEVICES=all --runtime=nvidia'
}
Expand All @@ -42,26 +42,6 @@ pipeline {
}

stages {
stage('Install dependencies') {
steps {
// jq and iproute2 are used to find the interface IPv4 address
sh 'apt-get update && apt-get -y --no-install-recommends install libpython3-dev python3-venv jq iproute2'
sh 'python3 -m venv /venv'
sh '.ci/install-sys-pkgs.sh'
sh 'PATH="/venv/bin:$PATH" .ci/py-requirements.sh'
}
}

stage('Install Python package') {
steps {
sh '''PATH="/venv/bin:$PATH" pip install -v \
--config-settings=setup-args=--native-file=ci.ini \
--config-settings=setup-args=-Dibv=enabled \
--config-settings=setup-args=-Dibv_hw_rate_limit=enabled \
--config-settings=setup-args=-Dmlx5dv=enabled \
.'''
}
}

stage('Run tests') {
steps {
Expand Down

0 comments on commit 0736d98

Please sign in to comment.