Skip to content

Commit bc42efc

Browse files
committed
feat: add s2n TLS support and GitHub Actions workflow
- Patch debian/control to add libs2n-dev to Build-Depends - Patch debian/rules to add --with-s2n to configure options - Update docker-bake.hcl to use ghcr.io/vantagecompute registry - Add GitHub Actions workflow for building and pushing images - Workflow builds slurmctld, slurmdbd, slurmrestd, slurmd, sackd, login This enables the tls_s2n.so plugin for encrypted SLURM communications.
1 parent 1b7fcb0 commit bc42efc

File tree

3 files changed

+166
-2
lines changed

3 files changed

+166
-2
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# SPDX-FileCopyrightText: Copyright (C) Vantage Compute, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Build SLURM Images with s2n TLS
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- 'feat/**'
11+
tags:
12+
- 'v*'
13+
pull_request:
14+
branches:
15+
- main
16+
workflow_dispatch:
17+
inputs:
18+
slurm_version:
19+
description: 'SLURM version (e.g., 25.11.0, 25.11-latest)'
20+
required: false
21+
default: '25.11-latest'
22+
push_images:
23+
description: 'Push images to registry'
24+
required: false
25+
default: 'false'
26+
type: boolean
27+
28+
env:
29+
REGISTRY: ghcr.io/vantagecompute
30+
# Default to 25.11 for ubuntu24.04
31+
SLURM_VERSION: ${{ github.event.inputs.slurm_version || '25.11-latest' }}
32+
33+
jobs:
34+
build-ubuntu2404:
35+
name: Build Ubuntu 24.04 Images
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: read
39+
packages: write
40+
41+
strategy:
42+
matrix:
43+
target:
44+
- slurmctld
45+
- slurmdbd
46+
- slurmrestd
47+
- slurmd
48+
- sackd
49+
- login
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v3
57+
58+
- name: Log in to GitHub Container Registry
59+
if: github.event_name != 'pull_request'
60+
uses: docker/login-action@v3
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.actor }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Extract version info
67+
id: version
68+
run: |
69+
# Extract version from tag or use default
70+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
71+
VERSION="${{ github.ref_name }}"
72+
VERSION="${VERSION#v}" # Remove 'v' prefix
73+
else
74+
VERSION="${{ env.SLURM_VERSION }}"
75+
fi
76+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
77+
78+
# Generate image tags
79+
TAGS="${{ env.REGISTRY }}/${{ matrix.target }}:${VERSION}-ubuntu24.04"
80+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
81+
TAGS="${TAGS},${{ env.REGISTRY }}/${{ matrix.target }}:latest-ubuntu24.04"
82+
fi
83+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
84+
85+
- name: Build and push ${{ matrix.target }}
86+
uses: docker/build-push-action@v6
87+
with:
88+
context: schedmd/slurm/25.11/ubuntu24.04
89+
file: schedmd/slurm/25.11/ubuntu24.04/Dockerfile
90+
target: ${{ matrix.target }}
91+
push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event.inputs.push_images == 'true') }}
92+
tags: ${{ steps.version.outputs.tags }}
93+
build-args: |
94+
SLURM_VERSION=${{ steps.version.outputs.version }}
95+
cache-from: type=gha
96+
cache-to: type=gha,mode=max
97+
labels: |
98+
org.opencontainers.image.title=Vantage SLURM ${{ matrix.target }}
99+
org.opencontainers.image.description=SLURM ${{ matrix.target }} with s2n TLS support
100+
org.opencontainers.image.version=${{ steps.version.outputs.version }}
101+
org.opencontainers.image.source=https://github.com/vantagecompute/slurm-containers
102+
org.opencontainers.image.vendor=Vantage Compute, Inc.
103+
104+
# Check for new upstream releases (runs weekly)
105+
check-upstream:
106+
name: Check Upstream Releases
107+
runs-on: ubuntu-latest
108+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
109+
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@v4
113+
114+
- name: Check for new SLURM releases
115+
id: check
116+
run: |
117+
# Get latest release from SchedMD/slurm
118+
LATEST=$(curl -s https://api.github.com/repos/SchedMD/slurm/releases/latest | jq -r .tag_name)
119+
echo "Latest upstream SLURM release: ${LATEST}"
120+
echo "latest=${LATEST}" >> $GITHUB_OUTPUT
121+
122+
# Check if we have this version tagged
123+
if git tag -l | grep -q "^v${LATEST#slurm-}$"; then
124+
echo "Already have this version"
125+
echo "new_release=false" >> $GITHUB_OUTPUT
126+
else
127+
echo "New release available!"
128+
echo "new_release=true" >> $GITHUB_OUTPUT
129+
fi
130+
131+
- name: Create issue for new release
132+
if: steps.check.outputs.new_release == 'true'
133+
uses: actions/github-script@v7
134+
with:
135+
script: |
136+
const latest = '${{ steps.check.outputs.latest }}';
137+
await github.rest.issues.create({
138+
owner: context.repo.owner,
139+
repo: context.repo.repo,
140+
title: `New SLURM release available: ${latest}`,
141+
body: `A new SLURM release is available upstream: ${latest}\n\nPlease update the Dockerfiles and create a new release.`,
142+
labels: ['upstream-update']
143+
});

schedmd/slurm/25.11/ubuntu24.04/Dockerfile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,31 @@ EOR
5454

5555
COPY --from=slurm-src /workspace/${SLURM_DIR} ${SLURM_DIR}
5656

57+
# Install libs2n-dev for TLS support (s2n plugin)
58+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
59+
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOR
60+
# Install s2n library for TLS plugin
61+
set -xeuo pipefail
62+
apt-get -qq update
63+
apt-get -qq -y install --no-install-recommends libs2n-dev
64+
EOR
65+
66+
# Patch debian/control to add libs2n-dev to Build-Depends for s2n TLS support
67+
RUN <<EOR
68+
set -xeuo pipefail
69+
sed -i 's/^\(Build-Depends:.*\)$/\1, libs2n-dev/' ${SLURM_DIR}/debian/control
70+
EOR
71+
72+
# Patch debian/rules to add --with-s2n to dh_auto_configure options
73+
RUN <<EOR
74+
set -xeuo pipefail
75+
sed -i 's/\(dh_auto_configure --\)/\1 --with-s2n/' ${SLURM_DIR}/debian/rules
76+
EOR
77+
5778
# Ref: https://slurm.schedmd.com/quickstart_admin.html#debuild
5879
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5980
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOR
60-
# Build Slurm
81+
# Build Slurm with s2n TLS support
6182
set -xeuo pipefail
6283
mk-build-deps -ir --tool='apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' ${SLURM_DIR}/debian/control >/dev/null
6384
( cd ${SLURM_DIR} && debuild -b -uc -us >/dev/null )

schedmd/slurm/docker-bake.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
################################################################################
55

66
variable "REGISTRY" {
7-
default = "ghcr.io/slinkyproject"
7+
default = "ghcr.io/vantagecompute"
88
}
99

1010
variable "SUFFIX" {}

0 commit comments

Comments
 (0)