-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-commit-slurm-debs.yml
More file actions
209 lines (177 loc) · 8.74 KB
/
Copy pathbuild-and-commit-slurm-debs.yml
File metadata and controls
209 lines (177 loc) · 8.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Build and Commit Slurm DEB Packages
on:
workflow_dispatch:
inputs:
SLURM_VERSION_OVERRIDE:
description: 'Optional: Specific Slurm version to build (e.g., 24-11-5-1). Leave empty to use latest.'
required: false
default: ''
jobs:
build-and-commit-debs:
runs-on: ubuntu-22.04 # Host runner (required by GitHub Actions)
container:
image: debian:bullseye-slim
options: --user root # Run as root for build process
steps:
- name: 🐛 Debug Information
run: |
echo "Event name: ${{ github.event_name }}"
echo "Event type: ${{ github.event.type }}"
echo "Actor: ${{ github.actor }}"
echo "Repository: ${{ github.repository }}"
echo "Ref: ${{ github.ref }}"
echo "SHA: ${{ github.sha }}"
echo "Workflow: ${{ github.workflow }}"
echo "Job: ${{ github.job }}"
echo "Run ID: ${{ github.run_id }}"
echo "Run number: ${{ github.run_number }}"
echo "Current time: $(date)"
echo "UTC time: $(date -u)"
echo "User: $(whoami)"
echo "UID: $(id -u)"
- name: 🎯 Determine Target Slurm Version
id: vars
run: |
set -e # Exit on error
apt-get update
apt-get install jq curl git -y
# Check if this is a manual dispatch with version override
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.SLURM_VERSION_OVERRIDE }}" ]; then
echo "✅ Using manual dispatch version override: ${{ github.event.inputs.SLURM_VERSION_OVERRIDE }}"
VERSION="${{ github.event.inputs.SLURM_VERSION_OVERRIDE }}"
else
echo "🔍 No version override set. Detecting latest stable version..."
# Fetch all tags from the SchedMD/slurm repo
TAGS=$(curl -s https://api.github.com/repos/SchedMD/slurm/tags | jq -r '.[].name')
# Filter for stable release tags (e.g., slurm-23-11-7-1) and get the latest
LATEST_TAG=$(echo "$TAGS" \
| grep -E '^slurm-[0-9]+-[0-9]+-[0-9]+-[0-9]+$' \
| sort -V \
| tail -n1)
if [ -z "$LATEST_TAG" ]; then
echo "❌ Could not determine the latest Slurm tag."
exit 1
fi
VERSION="${LATEST_TAG#slurm-}"
echo "🔬 Detected latest version: $VERSION"
fi
# Construct the tag name and download URL
TAG_NAME="slurm-${VERSION}"
TARBALL_URL="https://codeload.github.com/SchedMD/slurm/tar.gz/refs/tags/${TAG_NAME}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tarball_url=${TARBALL_URL}" >> $GITHUB_OUTPUT
- name: 🛑 Check if DEBs for this version already exist
id: version-check
run: |
version="${{ steps.vars.outputs.version }}"
debver="$(echo "$version" | sed 's/^\([0-9]*\)-\([0-9]*\)-\([0-9]*\)-\([0-9]*\)$/\1.\2.\3-\4/')"
echo "🔍 Inputs:"
echo " Raw version = $version"
echo " Debian version = $debver"
echo " Search pattern = *_${debver}_*.deb"
# Clone the repo to check for existing DEBs
git clone https://github.com/${{ github.repository }}.git /tmp/repo
cd /tmp/repo
if [ -d "slurm-debs" ]; then
count=$(find "slurm-debs" -type f -name "*_${debver}_*.deb" | wc -l || true)
if [ "$count" -gt 0 ]; then
echo "✅ DEBs for Slurm $version already exist. Skipping build."
echo "skip_build=true" >> $GITHUB_OUTPUT
else
echo "🚧 No existing DEBs for Slurm $version. Proceeding with build."
echo "skip_build=false" >> $GITHUB_OUTPUT
fi
else
echo "🚧 No slurm-debs directory found. Proceeding with build."
echo "skip_build=false" >> $GITHUB_OUTPUT
fi
- name: 🛠 Install Build Dependencies
if: steps.version-check.outputs.skip_build == 'false'
run: |
apt-get update
echo "🔍 Checking available packages in Debian Bullseye..."
apt-cache policy devscripts equivs build-essential fakeroot debhelper curl jq git libpmix-dev libpmix2 libopenmpi-dev libopenmpi3 openmpi-bin libpam0g-dev
echo "📦 Installing build dependencies..."
apt-get install -y \
devscripts equivs build-essential fakeroot debhelper curl jq git \
libpmix-dev libpmix2 libopenmpi-dev libopenmpi3 openmpi-bin \
libpam0g-dev
- name: 📥 Download and Extract Slurm Source
if: steps.version-check.outputs.skip_build == 'false'
run: |
set -e
mkdir -p /tmp/slurm && cd /tmp/slurm
echo "Downloading from ${{ steps.vars.outputs.tarball_url }}"
curl -L "${{ steps.vars.outputs.tarball_url }}" -o slurm.tar.gz
tar -xzf slurm.tar.gz
src_dir=$(find . -maxdepth 1 -type d -name "slurm-*")
mv "$src_dir" slurm-src
- name: 🔧 Fix PAM Configuration in debian/rules
if: steps.version-check.outputs.skip_build == 'false'
run: |
set -e
cd /tmp/slurm/slurm-src
# Why PAM might have stopped working:
# - Newer Slurm versions (e.g., 25.11) added stricter validation for PAM directory paths
# - The debian/rules file may now use /usr/lib/x86_64-linux-gnu/security which doesn't exist
# - Configure script now validates the path exists before accepting it
if [ -f debian/rules ]; then
echo "🔧 Analyzing PAM configuration in debian/rules..."
echo "📋 Current PAM-related configuration:"
grep -n "pam\|PAM\|with-pam_dir\|enable-pam" debian/rules || echo "No PAM references found"
# Fix the PAM directory path - ensure it exists so configure accepts it
# The debian packaging expects /usr/lib/x86_64-linux-gnu/security, so we keep that path
# but create the directory so configure doesn't reject it
if grep -q "with-pam_dir" debian/rules; then
echo "🔧 Ensuring PAM directory exists for configure..."
# Create the directory that configure will check (and where debian expects files)
mkdir -p /usr/lib/x86_64-linux-gnu/security || true
echo "✅ PAM directory /usr/lib/x86_64-linux-gnu/security created"
echo "✅ PAM will be enabled and built with correct directory"
fi
echo "📋 Final PAM-related configuration:"
grep -n "pam\|PAM\|with-pam_dir\|enable-pam" debian/rules || echo "✅ No PAM references remaining"
else
echo "⚠️ debian/rules not found, skipping patch"
fi
- name: 📦 Build Slurm DEBs
if: steps.version-check.outputs.skip_build == 'false'
run: |
set -e
cd /tmp/slurm/slurm-src
# Use mk-build-deps to install dependencies from debian/control
mk-build-deps -ir --tool='apt-get -qq -y ' debian/control
# Build binary packages only, without signing
debuild -b -uc -us
- name: 📁 Rename and Move DEBs to Repo
if: steps.version-check.outputs.skip_build == 'false'
run: |
set -e
DEST_DIR="/tmp/repo/slurm-debs"
mkdir -p "$DEST_DIR"
# Move all .deb files from the parent directory without renaming
# The packages already have proper names from debuild (including architecture)
for deb in /tmp/slurm/*.deb; do
if [ -f "$deb" ]; then
mv "$deb" "$DEST_DIR/"
fi
done
echo "Moved DEBs to $DEST_DIR"
ls -l "$DEST_DIR"
- name: 📤 Commit and Push DEBs
if: steps.version-check.outputs.skip_build == 'false'
run: |
set -e
cd /tmp/repo
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Configure git to use the token for authentication
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git add slurm-debs/
# Check if there are staged changes before committing
if git diff --staged --quiet; then
echo "No changes to commit."
else
git commit -m "Add Slurm DEBs (v${{ steps.vars.outputs.version }}) for Debian"
git push origin HEAD:${{ github.ref_name }}
fi