-
Notifications
You must be signed in to change notification settings - Fork 15
141 lines (109 loc) · 5.26 KB
/
one_job.yml
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
name: Build All in one job
on:
push:
paths-ignore:
- '.github/**'
- 'docs/**'
- 'CODEOWNERS'
- 'LICENSE'
- 'PROJECT'
- 'README.md'
- 'SECURITY.md'
- 'images/jail/gpubench/**'
pull_request:
branches:
- main
permissions:
contents: read
packages: write
attestations: write
id-token: write
jobs:
pre-build:
runs-on: self-hosted
outputs:
UNSTABLE: ${{ steps.set-env.outputs.unstable }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Set environment to global output variables based on branch
id: set-env
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "unstable=false" >> $GITHUB_OUTPUT
else
echo "unstable=true" >> $GITHUB_OUTPUT
fi
- name: Print UNSTABLE from output
run: |
echo "Branch is - ${{ github.ref }}"
echo "UNSTABLE - ${{ steps.set-env.outputs.unstable }}"
one_job:
runs-on: self-hosted
needs: pre-build
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install GO
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: 'go.mod'
- name: Debug vars
run: |
echo "UNSTABLE - is ${{ needs.pre-build.outputs.unstable }}"
make get-version UNSTABLE=${{ needs.pre-build.outputs.unstable }}
- name: Check if version synced
run: make test-version-sync
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Log in to the Github Container registry
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run all
run: |
UNSTABLE=${{ needs.pre-build.outputs.unstable }}
IMAGE_VERSION=$(make get-image-version UNSTABLE=${UNSTABLE})
VERSION=$(make get-version UNSTABLE=${UNSTABLE})
OPERATOR_IMAGE_TAG=$(make get-operator-tag-version UNSTABLE=${UNSTABLE})
make sync-version UNSTABLE=${UNSTABLE}
echo "Updating CRDs & auto-generated code (included in test step) & run tests"
make test UNSTABLE="${UNSTABLE}"
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=worker_slurmd DOCKERFILE=worker/slurmd.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=worker_slurmd
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=controller_slurmctld DOCKERFILE=controller/slurmctld.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=controller_slurmctld
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=controller_slurmdbd DOCKERFILE=accounting/slurmdbd.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=controller_slurmdbd
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=login_sshd DOCKERFILE=login/sshd.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=login_sshd
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=munge DOCKERFILE=munge/munge.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=munge
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=nccl_benchmark DOCKERFILE=nccl_benchmark/nccl_benchmark.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=nccl_benchmark
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=exporter DOCKERFILE=exporter/exporter.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=exporter
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=slurmrestd DOCKERFILE=restd/slurmrestd.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=slurmrestd
echo "Common images were built"
echo "Removing previous jail rootfs tar archive"
rm -rf images/jail_rootfs.tar
echo "Building tarball for jail"
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=jail DOCKERFILE=jail/jail.dockerfile DOCKER_OUTPUT="--output type=tar,dest=jail_rootfs.tar"
echo "Built tarball jail_rootfs.tar"
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=populate_jail DOCKERFILE=populate_jail/populate_jail.dockerfile
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=populate_jail
echo "Building image of the operator"
make docker-build UNSTABLE="${UNSTABLE}" IMAGE_NAME=slurm-operator DOCKERFILE=Dockerfile IMAGE_VERSION="$OPERATOR_IMAGE_TAG"
echo "Pushing image of the operator"
make docker-push UNSTABLE="${UNSTABLE}" IMAGE_NAME=slurm-operator IMAGE_VERSION="$OPERATOR_IMAGE_TAG"
echo "Pushing Helm charts"
make release-helm UNSTABLE="${UNSTABLE}" OPERATOR_IMAGE_TAG="$OPERATOR_IMAGE_TAG"