Skip to content

Commit 25f17b3

Browse files
NirWolferAlexanderGrissik
authored andcommitted
issue: 4007026 - [CI] Release pipeline
Unti now, release process is done manually by the dev team. This process involves creating a tag on a commit that needs to be released, building that tag and copying the files to NFS location The idea is to create a jenkins pipeline that will do the entire process with given inputs, This commit will commence phase 1 - doing the build and copying of packages created to NFS. THE CREATION OF A RELEASE TAG ON A COMMIT IS NOT PART OF THIS PR Add release_jjb and the corosponding matrix file for a new pipeline definition, the release is run on rhel8.6 Add do_release.sh script to run the build and NFS copy to release the package Add Dockerfile for release container with all dependencies installed Issue: HPCINFRA-1889 Signed-off-by: NirWolfer <nwolfer@nvidia.com>
1 parent 8d670d2 commit 25f17b3

File tree

4 files changed

+232
-0
lines changed

4 files changed

+232
-0
lines changed

.ci/do_release.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash -Exel
2+
3+
echo "**********************************"
4+
echo "Starting do_release.sh script..."
5+
echo "**********************************"
6+
7+
set -o pipefail
8+
9+
print_help() {
10+
set +xv
11+
echo -e "\n\n"
12+
echo "--------------------------------------------------"
13+
echo "Usage: release_folder=<release folder> release_tag=<release tag> [revision=<revision>] [do_release=<true|false>] $0"
14+
echo " Where release folder is a path to NFS folder to copy the package into"
15+
echo " Where release tag is a git tag to release (must be already tagged in the git repo)"
16+
echo " Where revision is a number postfix to add the to package indicating which version of the tag it is - OPTIONAL, default value 1"
17+
echo " Where do_release is a boolean value indicating if the script will copy the created package into the release folder location - OPTIONAL, default value false"
18+
exit 1
19+
}
20+
21+
if [ -z "${release_folder}" ]; then
22+
echo "ERROR: 'release_folder' was not set."
23+
print_help
24+
fi
25+
26+
if [ ! -e "${release_folder}" ] || [ ! -d "${release_folder}" ]; then
27+
echo "ERROR: [${release_folder}] directory doesn't exist."
28+
print_help
29+
fi
30+
31+
if [ -z "${release_tag}" ]; then
32+
echo "ERROR: 'release_tag' was not set."
33+
print_help
34+
fi
35+
36+
if [ -z "${revision}" ]; then
37+
echo "WARN: 'revision' was not set, defaulting to 1"
38+
revision=1
39+
fi
40+
41+
if [ -z "${do_release}" ]; then
42+
echo "WARN: 'do_release' was not set, defaulting to false (package will not be release)"
43+
do_release=false
44+
fi
45+
46+
env PRJ_RELEASE="${revision}" contrib/build_pkg.sh -s
47+
48+
MAJOR_VERSION=$(grep -e "define(\[prj_ver_major\]" configure.ac | awk '{ printf $2 };' | sed 's/)//g')
49+
MINOR_VERSION=$(grep -e "define(\[prj_ver_minor\]" configure.ac | awk '{ printf $2 };' | sed 's/)//g')
50+
REVISION_VERSION=$(grep -e "define(\[prj_ver_revision\]" configure.ac | awk '{ printf $2 };' | sed 's/)//g')
51+
configure_ac_version="${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
52+
echo "FULL_VERSION from configure.ac: [${configure_ac_version}]"
53+
54+
if [[ "${release_tag}" != "${configure_ac_version}" ]]; then
55+
echo "ERROR: FULL_VERSION: ${configure_ac_version} from configure.ac doesn't match tag: ${release_tag} provided! Exit"
56+
exit 1
57+
fi
58+
59+
if [ "${do_release}" = true ] ; then
60+
echo "do_release is set to true, will release package into ${release_folder}/libvma_v_${release_tag}-0/src"
61+
62+
cd pkg/packages || { echo "pkg folder is missing, exiting..."; exit 1; }
63+
pkg_name=$(ls -1 libvma-"${release_tag}"-"${revision}".src.rpm)
64+
DST_DIR=${release_folder}/libvma_v_${release_tag}-0/src
65+
66+
if [[ -e "${DST_DIR}/${pkg_name}" ]]; then
67+
echo "ERROR: [${DST_DIR}/${pkg_name}] file already exist. Exit"
68+
exit 1
69+
fi
70+
71+
sudo -E -u swx-jenkins mkdir -p "$DST_DIR"
72+
sudo -E -u swx-jenkins cp -v "${pkg_name}" "$DST_DIR"
73+
74+
cd "${release_folder}"
75+
sudo -E -u swx-jenkins ln -s "$DST_DIR/${pkg_name}" latest_release
76+
77+
echo "Release found at $DST_DIR"
78+
79+
else
80+
echo "do_release is set to false, skipping package release."
81+
fi
82+
83+
set +x
84+
echo "**********************************"
85+
echo "Finished do_release.sh script..."
86+
echo "**********************************"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG HARBOR_URL=harbor.mellanox.com
2+
FROM $HARBOR_URL/hpcx/x86_64/rhel8.6/core:latest
3+
ARG _UID=6213
4+
ARG _GID=101
5+
ARG _LOGIN=swx-jenkins
6+
ARG _HOME=/var/home/$_LOGIN
7+
8+
RUN sed -i 's/mirrorlist/#mirrorlist/;s!#baseurl=http://mirror.centos.org!baseurl=http://vault.centos.org!' /etc/yum.repos.d/* && \
9+
echo "[mlnx-opt]" > /etc/yum.repos.d/mlnx-opt.repo && \
10+
echo "name=RHEL 8.6 mirror" >> /etc/yum.repos.d/mlnx-opt.repo && \
11+
echo "baseurl=http://webrepo.mtr.labs.mlnx/RH/optional/8.6/x86_64/" >> /etc/yum.repos.d/mlnx-opt.repo && \
12+
echo "enabled=1" >> /etc/yum.repos.d/mlnx-opt.repo && \
13+
echo "gpgcheck=0" >> /etc/yum.repos.d/mlnx-opt.repo && \
14+
yum makecache
15+
16+
RUN echo "${_LOGIN} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
17+
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
18+
mkdir -p ${_HOME} && \
19+
groupadd -f -g "$_GID" "$_LOGIN" && \
20+
useradd -u "$_UID" -g "$_GID" -s /bin/bash -m -d ${_HOME} "${_LOGIN}" && \
21+
chown -R ${_LOGIN} ${_HOME}
22+
23+
RUN yum install --allowerasing -y \
24+
git autoconf automake libtool gcc \
25+
sudo gcc-c++ libibverbs-devel rdma-core \
26+
librdmacm unzip patch wget make \
27+
libnl3-devel rpm-build

.ci/pipeline/release_jjb.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
- job-template:
2+
name: "{jjb_proj}"
3+
project-type: pipeline
4+
folder: libvma
5+
properties:
6+
- github:
7+
url: "https://github.com/Mellanox/libvma"
8+
- build-discarder:
9+
days-to-keep: 50
10+
num-to-keep: 20
11+
- inject:
12+
keep-system-variables: true
13+
properties-content: |
14+
jjb_proj={jjb_proj}
15+
description: Do NOT edit this job through the Web GUI !
16+
concurrent: false
17+
parameters:
18+
- string:
19+
name: "release_tag"
20+
default: ""
21+
description: "Tag to release"
22+
- string:
23+
name: sha1
24+
default: 'tags/$release_tag'
25+
description: 'commit to use, defaults to the commit tag provided under release_tag'
26+
- string:
27+
name: "revision"
28+
default: "1"
29+
description: "Release revision"
30+
- string:
31+
name: "release_folder"
32+
default: "/auto/mswg/release/vma"
33+
description: "Folder to release packages into"
34+
- bool:
35+
name: "do_release"
36+
default: true
37+
description: "Release build packges into the release folder, set to false for debugging"
38+
- string:
39+
name: "notification_email"
40+
default: "55ae26f6.NVIDIA.onmicrosoft.com@amer.teams.ms"
41+
description: "Email to send report to upon success/failure"
42+
- string:
43+
name: "conf_file"
44+
default: ".ci/pipeline/release_matrix_job.yaml"
45+
description: "job config file. Do not change it"
46+
pipeline-scm:
47+
scm:
48+
- git:
49+
url: "{jjb_git}"
50+
credentials-id: 'b7d08ca7-378c-45d6-ac4b-3f30bdf49168'
51+
branches: ['$sha1']
52+
shallow-clone: true
53+
depth: 2
54+
refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
55+
browser: githubweb
56+
browser-url: "{jjb_git}"
57+
script-path: ".ci/Jenkinsfile"
58+
- project:
59+
name: libvma
60+
jjb_email: 'nwolfer@nvidia.com'
61+
jjb_proj: 'LibVMA-release'
62+
jjb_git: 'git@github.com:Mellanox/libvma.git'
63+
jjb_owner: 'Nir Wolfer'
64+
jobs:
65+
- "{jjb_proj}"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
job: LibVMA-release
3+
registry_host: harbor.mellanox.com
4+
registry_auth: 1daaea28-800e-425f-a91f-3bd3e9136eea
5+
registry_path: /swx-infra/media/libvma
6+
7+
kubernetes:
8+
privileged: true
9+
cloud: il-ipp-blossom-prod
10+
nodeSelector: 'beta.kubernetes.io/os=linux'
11+
namespace: swx-media
12+
limits: '{memory: 8Gi, cpu: 7000m}'
13+
requests: '{memory: 8Gi, cpu: 7000m}'
14+
15+
env:
16+
MAIL_FROM: jenkins@nvidia.com
17+
18+
volumes:
19+
# Default release location
20+
- {mountPath: /auto/mswg/release/vma, hostPath: /auto/mswg/release/vma}
21+
# User profile for release
22+
- {mountPath: /var/home/swx-jenkins, hostPath: /labhome/swx-jenkins}
23+
24+
runs_on_dockers:
25+
- {file: '.ci/dockerfiles/Dockerfile.rhel8.6.release', name: 'rhel8.6', uri: '$arch/$name/release', build_args: '--no-cache', arch: 'x86_64', tag: '20240718'}
26+
27+
steps:
28+
- name: Release
29+
parallel: false
30+
run: |
31+
.ci/do_release.sh
32+
archiveArtifacts: pkg/build_pkg.log,pkg/packages/*.rpm
33+
34+
pipeline_start:
35+
shell: action
36+
module: groovy
37+
run: |
38+
echo "Starting release process for LibVMA-${release_tag}"
39+
currentBuild.displayName += "-${release_tag}"
40+
41+
pipeline_stop:
42+
shell: action
43+
module: groovy
44+
run: |
45+
if (!params.notification_email.isEmpty()) {
46+
mail from: "${MAIL_FROM}",
47+
mimeType: 'text/html',
48+
to: "${notification_email}",
49+
subject: "Release build ended for LibVMA - ${release_tag}",
50+
body: """
51+
<p><b>Tag:</b> ${release_tag}</p>
52+
<p><b>Build url:</b> <a href=${currentBuild.absoluteUrl}>link</a></p>
53+
<p><b>Status:</b> ${currentBuild.currentResult}</p>"""
54+
}

0 commit comments

Comments
 (0)