Skip to content

Commit

Permalink
Creating centos7 and centos8 RPMs
Browse files Browse the repository at this point in the history
  • Loading branch information
afsmaira committed Nov 13, 2021
1 parent a24c3e6 commit f9c49cc
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 91 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd $HOME/rpmbuild || exit 1
spectool -g -R SPECS/prometheus-slurm-exporter.spec
rpmbuild -ba SPECS/prometheus-slurm-exporter.spec
7 changes: 7 additions & 0 deletions .github/workflows/go_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rm -f go.mod
go get -v -u github.com/prometheus/client_golang/prometheus
go get -v -u github.com/sirupsen/logrus
go get -v -u gopkg.in/alecthomas/kingpin.v2
go get -v -u github.com/m3db/prometheus_common/log
mkdir -p ${GOPATH}/src/github.com/prometheus/common/log/
cp -r ${GOPATH}/src/github.com/m3db/prometheus_common/log/* ${GOPATH}/src/github.com/prometheus/common/log/
91 changes: 0 additions & 91 deletions .github/workflows/main.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/prep_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cp README.md ~/rpmbuild/SOURCES
cp LICENSE ~/rpmbuild/SOURCES
cp bin/prometheus-slurm-exporter ~/rpmbuild/SOURCES
cp lib/systemd/prometheus-slurm-exporter.service ~/rpmbuild/SOURCES
cp packages/rpm/*.spec ~/rpmbuild/SPECS
60 changes: 60 additions & 0 deletions .github/workflows/rpm_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Prometheus Slurm Exporter

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
centos8:
runs-on: ubuntu-latest
container:
image: centos:centos8

steps:
- uses: actions/checkout@v2
- name: Install Prerequisites
run: dnf install -y rpm-build rpmdevtools redhat-rpm-config make git go
- name: Configure Go Libraries
run: |
export GOPATH=$(pwd)
/bin/bash .github/workflows/go_config.sh
- name: Compile Exporter
run: make build
- name: Prepare RPM Environment
run: /bin/bash .github/workflows/prep_rpm.sh
- name: Build RPM
run: /bin/bash .github/workflows/build_rpm.sh
- name: Upload RPM
uses: actions/upload-artifact@v2
with:
name: prometheus-slurm-exporter-centos8-x86_64-latest
path: /github/home/rpmbuild/RPMS/x86_64/*.rpm
centos7:
runs-on: ubuntu-latest
container:
image: centos:centos7

steps:
- uses: actions/checkout@v2
- name: Install Prerequisites
run: |
yum install -y epel-release
yum update -y
yum install -y rpm-build rpmdevtools redhat-rpm-config make git golang
- name: Configure Go Libraries
run: |
export GOPATH=$(pwd)
/bin/bash .github/workflows/go_config.sh
- name: Compile Exporter
run: make build
- name: Prepare RPM Environment
run: /bin/bash .github/workflows/prep_rpm.sh
- name: Build RPM
run: /bin/bash .github/workflows/build_rpm.sh
- name: Upload RPM
uses: actions/upload-artifact@v2
with:
name: prometheus-slurm-exporter-centos7-x86_64-latest
path: /github/home/rpmbuild/RPMS/x86_64/*.rpm

0 comments on commit f9c49cc

Please sign in to comment.