Skip to content

Commit

Permalink
rpm: use containerized rpm build (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
rootfs authored Mar 14, 2023
1 parent d8f3ebd commit 3296034
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ jobs:
_VERSION_ : ${{ github.event.inputs.rpm_version }}
_RELEASE_: ${{ github.event.inputs.rpm_release }}
_COMMITTER_: ${{ github.event.inputs.committer }}
_TIMESTAMP_: ${{ steps.date.outputs.date }}
_CHANGELOG_: ${{ github.event.inputs.changelog }}
_ARCH_: ${{ github.event.inputs.arch }}
run: make build_rpm
run: |
make build_rpm
- if: startsWith(github.event.ref, 'refs/tags/')
name: Release
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ container_build: tidy-vendor format
build_rpm:
rpmbuild packaging/rpm/kepler.spec --build-in-place -bb

containerized_build_rpm:
@mkdir -p "/root/rpmbuild"
$(CTR_CMD) run --rm \
-v $(base_dir):/kepler:Z -w /kepler -v /root/rpmbuild:/root/rpmbuild \
-e _VERSION_=${_VERSION_} -e _RELEASE_=${_RELEASE_} -e _ARCH_=${_ARCH_} \
-e _TIMESTAMP_="$(shell date)" -e _COMMITTER_=${_COMMITTER_} -e _CHANGELOG_=${_CHANGELOG_} \
-e GOROOT=/usr/local/go -e PATH=$(PATH):/usr/local/go/bin \
$(BUILDER_IMAGE) \
make build_rpm

clean_build_local:
rm -rf $(CROSS_BUILD_BINDIR)

Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM quay.io/sustainable_computing_io/kepler_base:ubi-8.6-bcc-0.24 as builder

LABEL name=kepler-builder

RUN yum install -y kernel-devel make git gcc && \
RUN yum install -y kernel-devel make git gcc rpm-build systemd && \
yum clean all -y

RUN curl -LO https://go.dev/dl/go1.18.1.linux-amd64.tar.gz; mkdir -p /usr/local; tar -C /usr/local -xvzf go1.18.1.linux-amd64.tar.gz; rm -f go1.18.1.linux-amd64.tar.gz
2 changes: 1 addition & 1 deletion packaging/rpm/kepler.spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CROSS_BUILD_BINDIR=_output/bin
GOARCH=amd64
%endif

make container_build GOOS=${GOOS} GOARCH=${GOARCH}
make _build_local GOOS=${GOOS} GOARCH=${GOARCH}

cp ./${CROSS_BUILD_BINDIR}/${GOOS}_${GOARCH}/kepler ./_output/kepler

Expand Down

0 comments on commit 3296034

Please sign in to comment.