Skip to content

Commit 6b78691

Browse files
EX-13772: RPM for prometheus2
1 parent 59caff0 commit 6b78691

3 files changed

Lines changed: 105 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build Prometheus2 EL10 RPM
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
workflow_dispatch:
8+
inputs:
9+
release_name:
10+
description: 'Release name (e.g. v0.4.10)'
11+
required: true
12+
default: ''
13+
draft:
14+
description: 'Create as draft release'
15+
type: boolean
16+
default: true
17+
18+
jobs:
19+
build-rpm:
20+
name: Build RPM for EL10
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout source
24+
uses: actions/checkout@v4
25+
26+
- name: Install Deps
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y make
30+
31+
- name: Build Rocky10 Docker Image
32+
run: make build-rocky10-image
33+
34+
- name: Build Prometheus2 RPM
35+
run: make build10-prometheus2
36+
37+
- name: Upload Binary RPM
38+
uses: actions/upload-artifact@v4
39+
with:
40+
path: _dist10_RPM/*.rpm
41+
if-no-files-found: error
42+
43+
- name: Upload Source RPM
44+
uses: actions/upload-artifact@v4
45+
with:
46+
path: _dist10_SRPM/*.rpm
47+
if-no-files-found: error
48+
49+
- name: Create GitHub Release
50+
if: github.event_name == 'workflow_dispatch' && inputs.release_name != ''
51+
uses: softprops/action-gh-release@v2
52+
with:
53+
tag_name: ${{ inputs.release_name }}
54+
name: ${{ inputs.release_name }}
55+
draft: ${{ inputs.draft }}
56+
files: _dist10_RPM/*.rpm
57+

Dockerfile.rocky10

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM rockylinux/rockylinux:10
2+
3+
RUN dnf update -y \
4+
&& dnf groupinstall -y "Development Tools" \
5+
&& dnf install -y rsync createrepo \
6+
&& dnf install -y 'dnf-command(config-manager)'
7+
8+
RUN dnf config-manager --set-enabled crb -y \
9+
&& dnf install -y \
10+
rpm-build \
11+
rpmdevtools \
12+
systemd-rpm-macros \
13+
&& dnf clean all
14+
15+
# Create build-spec script
16+
RUN echo '#!/bin/bash' > /usr/local/bin/build-spec && \
17+
echo 'set -e' >> /usr/local/bin/build-spec && \
18+
echo 'SPEC_FILE="$1"' >> /usr/local/bin/build-spec && \
19+
echo 'cd /rpmbuild' >> /usr/local/bin/build-spec && \
20+
echo 'spectool -g -C /rpmbuild/SOURCES "$SPEC_FILE"' >> /usr/local/bin/build-spec && \
21+
echo 'rpmbuild --define "_topdir /rpmbuild" -ba "$SPEC_FILE"' >> /usr/local/bin/build-spec && \
22+
chmod +x /usr/local/bin/build-spec
23+
24+
WORKDIR /rpmbuild
25+
26+
ENV RPM_BUILD_ROOT=/rpmbuild
27+

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,30 @@ all: auto manual
7272
manual: $(MANUAL)
7373
auto: $(AUTO_GENERATED)
7474

75+
manual10: $(addprefix build10-,$(MANUAL))
7576
manual9: $(addprefix build9-,$(MANUAL))
7677
manual8: $(addprefix build8-,$(MANUAL))
7778
manual7: $(addprefix build7-,$(MANUAL))
7879

80+
# Build the Rocky Linux 10 builder image from Dockerfile
81+
.PHONY: build-rocky10-image
82+
build-rocky10-image:
83+
docker build -f Dockerfile.rocky10 -t rocky10-rpm-builder:latest .
84+
85+
$(addprefix build10-,$(MANUAL)): build-rocky10-image
86+
$(eval PACKAGE=$(subst build10-,,$@))
87+
[ -d ${PWD}/_dist10_RPM ] || mkdir ${PWD}/_dist10_RPM
88+
[ -d ${PWD}/_dist10_SRPM ] || mkdir ${PWD}/_dist10_SRPM
89+
[ -d ${PWD}/_cache_dnf ] || mkdir ${PWD}/_cache_dnf
90+
docker run ${DOCKER_FLAGS} \
91+
-v ${PWD}/${PACKAGE}:/rpmbuild/SOURCES \
92+
-v ${PWD}/_dist10_RPM:/rpmbuild/RPMS/x86_64 \
93+
-v ${PWD}/_dist10_RPM:/rpmbuild/RPMS/noarch \
94+
-v ${PWD}/_dist10_SRPM:/rpmbuild/SRPMS/ \
95+
-v ${PWD}/_cache_dnf:/var/cache/dnf \
96+
rocky10-rpm-builder:latest \
97+
build-spec SOURCES/${PACKAGE}.spec
98+
7999
$(addprefix build9-,$(MANUAL)):
80100
$(eval PACKAGE=$(subst build9-,,$@))
81101
[ -d ${PWD}/_dist9 ] || mkdir ${PWD}/_dist9
@@ -240,6 +260,7 @@ sign7:
240260
$(foreach \
241261
PACKAGE,$(MANUAL),$(eval \
242262
${PACKAGE}: \
263+
$(addprefix build10-,${PACKAGE}) \
243264
$(addprefix build9-,${PACKAGE}) \
244265
$(addprefix build8-,${PACKAGE}) \
245266
$(addprefix build7-,${PACKAGE}) \

0 commit comments

Comments
 (0)