Skip to content

Building Prow

linuxonz edited this page Dec 12, 2024 · 11 revisions

Building Prow

The instructions specify the steps to build Prow on Linux on IBM Z for following distributions:

  • RHEL (8.8, 8.10, 9.2, 9.4, 9.5)
  • SLES 15 SP6
  • Ubuntu (20.04, 22.04, 24.04, 24.10)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

1. Build environment set up

Ensure that Docker-CE is installed.

Ensure the current user belongs to group docker.

Use the below command to add group docker if it does not exist:

sudo groupadd docker

Use the below command to add current user to group docker if it has not been done:

sudo usermod -aG docker $USER && newgrp docker

2. Build using script

If you want to build Prow using manual steps, go to STEP 3.

Use the following commands to build Prow using the build script. Please make sure you have wget installed.

wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Prow/build_prow.sh

# Build Prow
bash build_prow.sh   [Provide -t option for executing build with tests]

If the build and tests complete successfully, go to STEP 7. In case of error, check logs at <source_root>/logs/ for more details or go to STEP 3 to follow manual build steps.

3. Install the system dependencies

export SOURCE_ROOT=/<source_root>/
source $SOURCE_ROOT/setenv.sh    #Source environment file
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Prow/patch/"
  • RHEL (8.8, 8.10, 9.2, 9.4, 9.5)

    sudo yum install -y zip tar unzip git vim wget make curl python3-devel gcc gcc-c++ libtool autoconf curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel
  • SLES 15 SP6

    sudo zypper refresh
    sudo zypper install -y zip tar unzip git vim wget make curl python3-devel gcc gcc-c++ libtool autoconf gawk rsync
  • Ubuntu (20.04, 22.04)

    sudo apt-get update
    sudo apt-get install -y zip tar unzip git vim wget make curl python2.7-dev python3.8-dev gcc g++ python3-distutils libtool libtool-bin autoconf
  • Ubuntu (24.04, 24.10)

    sudo apt-get update
    sudo apt-get install -y zip tar unzip git vim wget make curl python3-dev gcc g++ python3-distutils-extra libtool libtool-bin autoconf

4. Install prerequisites

4.1. Install Go 1.19.5

cd $SOURCE_ROOT
export GO_VERSION="1.22.7"
wget -q https://storage.googleapis.com/golang/go"$GO_VERSION".linux-s390x.tar.gz
chmod ugo+r go"$GO_VERSION".linux-s390x.tar.gz
sudo tar -C /usr/local -xzf go"$GO_VERSION".linux-s390x.tar.gz
sudo ln -sf /usr/local/go/bin/go /usr/bin/
sudo ln -sf /usr/local/go/bin/gofmt /usr/bin/
sudo ln -sf /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc # (Only on RHEL and SLES)
go version
export GOPATH=$SOURCE_ROOT
export PATH=$GOPATH/bin:$PATH

4.2. Create 's390x-linux-gnu-gcc' if not present

sudo ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc

4.3. Build and install jq

cd $SOURCE_ROOT
git clone -b jq-1.5 https://github.com/stedolan/jq.git
cd jq/
autoreconf -fi
./configure --disable-valgrind
sudo make LDFLAGS=-all-static -j$(nproc)
sudo make install

5. Build required components and images

5.1. Build Prow from source

cd $SOURCE_ROOT
git clone https://github.com/kubernetes/test-infra.git
cd test-infra/
git checkout 89ac42333a8e7d3d88eda931740199b2a25252ea
curl -sSL $PATCH_URL/test-infra-patch.diff | git apply -
make -C prow build-images

5.2. Run Prow unit tests (Optional)

cd $SOURCE_ROOT/test-infra/
mkdir _bin/jq-1.5
cp /usr/local/bin/jq _bin/jq-1.5/jq
cp /usr/local/bin/jq _bin/jq-1.5/jq-linux64
make test

Note: If Python tests fails with error version 'GLIBC_2.XX' not found, its due to GLIBC version mismatch between the libc.so.6 library on host and libc.so.6 library present in Python container (Image: python:3.9-slim-bullseye) and can be ignored.

6. Run ProwJobs locally as pods in a Kind cluster (Optional)

Please refer to Running a prowjob locally for more information.

7. Prow Integration

Please refer to Prow Building, Testing, and Deploying for more information.

References:

Clone this wiki locally