Skip to content

jose-d is attempting to build pmix and slurm 🚀 #175

jose-d is attempting to build pmix and slurm 🚀

jose-d is attempting to build pmix and slurm 🚀 #175

Workflow file for this run

---
name: Build Slurm
run-name: ${{ github.actor }} is attempting to build pmix and slurm 🚀
on: workflow_dispatch
permissions: write-all
env:
# github image repository url - used to cache docker images
IMG_REPO_URL: ghcr.io/jose-d/build-slurm-rocky8
# version of openpmix and slurm to download and build together
PMIX_VERSION: 5.0.3
SLURM_VERSION: 24.05.1
# version of CUDA to take NVML library from:
NVML_VERSION: 12-5
# files used as cache for variables sharing
GLOBAL_VARS_FILE: global_vars.txt
jobs:
prolog:
name: Create global release tag, and related job-specific naming constants and save it into GLOBAL_VARS_FILE
runs-on: ubuntu-latest
steps:
- name: Create vars, save them into GLOBAL_VARS_FILE and GITHUB_STEP_SUMMARY
shell: bash
run: |
# this is the date-based identifier for this release:
RELTAG="$(date +%Y%m%d%H%M%S)"
BASEIMAGE_RELTAG="baseimg_${RELTAG}"
BASEIMAGE_URL="${IMG_REPO_URL}:${BASEIMAGE_RELTAG}"
SLURMIMAGE_RELTAG="slurmimg_${RELTAG}"
SLURMIMAGE_URL="${IMG_REPO_URL}:${SLURMIMAGE_RELTAG}"
PMIXIMAGE_RELTAG="pmiximg_${RELTAG}"
PMIXIMAGE_URL="${IMG_REPO_URL}:${PMIXIMAGE_RELTAG}"
touch $GLOBAL_VARS_FILE
echo "RELTAG=${RELTAG}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "BASEIMAGE_RELTAG=${BASEIMAGE_RELTAG}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "BASEIMAGE_URL=${BASEIMAGE_URL}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "PMIXIMAGE_RELTAG=${PMIXIMAGE_RELTAG}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "PMIXIMAGE_URL=${PMIXIMAGE_URL}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "SLURMIMAGE_RELTAG=${SLURMIMAGE_RELTAG}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
echo "SLURMIMAGE_URL=${SLURMIMAGE_URL}" | tee --append $GLOBAL_VARS_FILE $GITHUB_STEP_SUMMARY
- name: Upload GLOBAL_VARS_FILE to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
path: ${{ env.GLOBAL_VARS_FILE }}
build_base_build-image:
name: Build base docker image
runs-on: ubuntu-latest
needs:
- prolog
steps:
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: Import required vars from GLOBAL_VARS_FILE into local env
shell: bash
run: |
source ${GLOBAL_VARS_FILE}
echo "BASEIMAGE_URL=${BASEIMAGE_URL}" | tee --append ${GITHUB_ENV}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5.1.0
with:
context: "{{defaultContext}}:.github/dockerfiles/base"
push: true
tags: ${{ env.BASEIMAGE_URL }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
build_slurm_build_image:
name: Build slurm build docker image
runs-on: ubuntu-latest
needs: build_base_build-image
steps:
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: Import required vars from GLOBAL_VARS_FILE into local env
shell: bash
run: |
source ${GLOBAL_VARS_FILE}
echo "BASEIMAGE_URL=${BASEIMAGE_URL}" | tee --append ${GITHUB_ENV}
echo "SLURMIMAGE_URL=${SLURMIMAGE_URL}" | tee --append ${GITHUB_ENV}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5.1.0
with:
build-args: |
NVML_VERSION=${{ env.NVML_VERSION }}
BASE_IMAGE=${{ env.BASEIMAGE_URL }}
context: "{{defaultContext}}:.github/dockerfiles/slurm"
push: true
tags: ${{ env.SLURMIMAGE_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
build_pmix_build_image:
name: Build pmix build docker image
runs-on: ubuntu-latest
needs: build_base_build-image
steps:
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: Import required vars from GLOBAL_VARS_FILE into local env
shell: bash
run: |
source ${GLOBAL_VARS_FILE}
echo "BASEIMAGE_URL=${BASEIMAGE_URL}" | tee --append ${GITHUB_ENV}
echo "PMIXIMAGE_URL=${PMIXIMAGE_URL}" | tee --append ${GITHUB_ENV}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5.1.0
with:
build-args: |
BASE_IMAGE=${{ env.BASEIMAGE_URL }}
context: "{{defaultContext}}:.github/dockerfiles/pmix"
push: true
tags: ${{ env.PMIXIMAGE_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
build_pmix:
name: Build pmix
runs-on: ubuntu-latest
needs: build_pmix_build_image
env:
GHCR_U: ${{ github.actor }}
GHCR_S: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: checkout pmix build script
uses: actions/checkout@v4
with:
sparse-checkout: .github/scripts/build_pmix.sh
sparse-checkout-cone-mode: false
path: scripts
- name: Download pmix tarball, unpack, patch spec file
shell: bash
run: |
source $GLOBAL_VARS_FILE
wget "https://github.com/openpmix/openpmix/releases/download/v${PMIX_VERSION}/pmix-${PMIX_VERSION}.tar.bz2"
tar -xf ./pmix*
sed -i "s/^Release.*$/Release: ${RELTAG}%{?dist}/g" pmix-*/contrib/pmix.spec
- name: Login to ghcr registry with docker and do build
run: |
source ${GLOBAL_VARS_FILE}
echo $GHCR_S | docker login ghcr.io -u ${GHCR_U} --password-stdin
docker run --cidfile /tmp/docker_test.cid \
--env-file $GLOBAL_VARS_FILE \
--env GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \
--env PMIX_VERSION=${PMIX_VERSION} \
-v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} \
-v ${HOME}:${HOME} \
-w ${GITHUB_WORKSPACE} ${PMIXIMAGE_URL} /bin/bash scripts/.github/scripts/build_pmix.sh
- name: Upload build log as artifact
uses: actions/upload-artifact@v4
with:
name: pmix_build.log
if-no-files-found: error
path: ${{ github.workspace }}/pmix_build.log
- name: Upload image_pmix_rpms.txt as artifact
uses: actions/upload-artifact@v4
with:
name: image_pmix_rpms.txt
if-no-files-found: error
path: ${{ github.workspace }}/image_pmix_rpms.txt
- name: Upload pmix rpms as artifacts
uses: actions/upload-artifact@v4
with:
name: pmix_rpms
if-no-files-found: error
path: ${{ github.workspace }}/rpms/*.rpm
build_slurm:
name: Build slurm
runs-on: ubuntu-latest
needs:
- build_pmix
- build_slurm_build_image
env:
GHCR_U: ${{ github.actor }}
GHCR_S: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: Download pmix rpms
uses: actions/download-artifact@v4
with:
name: pmix_rpms
path: pmix_rpms
- name: Checkout slurm build script
uses: actions/checkout@v4
with:
sparse-checkout: .github/scripts/build_slurm.sh
sparse-checkout-cone-mode: false
path: scripts
- name: Download slurm tarball, unpack, patch spec file
shell: bash
run: |
source $GLOBAL_VARS_FILE
wget --quiet https://download.schedmd.com/slurm/slurm-${SLURM_VERSION}.tar.bz2
tar -xf ./slurm*
sed -i "s/^%define rel.*$/%define rel ${RELTAG}/g" slurm*/slurm.spec
sed -i "s/^%global slurm_source_dir.*$/%global slurm_source_dir %{name}-%{version}/g" ./slurm*/slurm.spec
- name: Login to ghcr registry with docker and do build
shell: bash
run: |
set -x
source $GLOBAL_VARS_FILE
echo $GHCR_S | docker login ghcr.io -u ${GHCR_U} --password-stdin
docker run --cidfile /tmp/docker_test.cid \
--env-file $GLOBAL_VARS_FILE \
--env GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \
-v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} \
-v ${HOME}:${HOME} \
-w ${GITHUB_WORKSPACE} ${SLURMIMAGE_URL} /bin/bash scripts/.github/scripts/build_slurm.sh
- name: Upload build log as artifact
uses: actions/upload-artifact@v4
with:
name: slurm_build.log
if-no-files-found: error
path: ${{ github.workspace }}/slurm_build.log
- name: Upload image_slurm_rpms.txt as artifact
uses: actions/upload-artifact@v4
with:
name: image_slurm_rpms.txt
if-no-files-found: error
path: ${{ github.workspace }}/image_slurm_rpms.txt
- name: Upload slurm rpms as artifacts
uses: actions/upload-artifact@v4
with:
name: slurm_rpms
if-no-files-found: error
path: ${{ github.workspace }}/rpms/*.rpm
publish_files:
name: Publish built files in release
runs-on: ubuntu-latest
needs:
- build_slurm
- build_pmix
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download GLOBAL_VARS_FILE
uses: actions/download-artifact@v4
with:
name: ${{ env.GLOBAL_VARS_FILE }}
- name: Download pmix rpms
uses: actions/download-artifact@v4
with:
name: pmix_rpms
path: rpms
- name: Download pmix rpms
uses: actions/download-artifact@v4
with:
name: slurm_rpms
path: rpms
- name: Download pmix_build.log
uses: actions/download-artifact@v4
with:
name: pmix_build.log
- name: Download slurm_build.log
uses: actions/download-artifact@v4
with:
name: slurm_build.log
- name: Download slurm_build.log
uses: actions/download-artifact@v4
with:
name: image_pmix_rpms.txt
- name: Download slurm_build.log
uses: actions/download-artifact@v4
with:
name: image_slurm_rpms.txt
- name: Read persistent data and add them into env, create tarball from all rpms
shell: bash
run: |
source ${GLOBAL_VARS_FILE}
echo "RELTAG=${RELTAG}" | tee --append $GITHUB_ENV
sudo apt -y install zstd
tar -cf rpm_tarball_${RELTAG}.tar.gz rpms/
- name: Create tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release and add assets
id: create_release
uses: softprops/action-gh-release@v1
with:
body: |
RPMs containing build of
* [Slurm ${{ env.SLURM_VERSION }}](https://slurm.schedmd.com/) built with NVML/Cuda ${{ env.NVML_VERSION }}
* [PMIx ${{ env.PMIX_VERSION }}](https://github.com/openpmix/openpmix)
tag_name: ${{ steps.tag_version.outputs.new_tag }}
name: "slurm-${{ env.SLURM_VERSION }} + pmix-${{ env.PMIX_VERSION }}, (${{ env.RELTAG }})"
fail_on_unmatched_files: true
files: |
rpms/*.rpm
slurm_build.log
pmix_build.log
rpm_tarball_*.tar.gz
image_*_rpms.txt