|
| 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 | + }); |
0 commit comments