Skip to content

Commit

Permalink
NC | RPM build and install github action
Browse files Browse the repository at this point in the history
Signed-off-by: Romy <[email protected]>
  • Loading branch information
romayalon committed Jan 20, 2025
1 parent e31e047 commit 3eca5c4
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/manual-rpm-build-and-install-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Manual RPM Build and Install Test Dispatch
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to RPM Build and Install From'
required: true
centos_ver:
type: choice
description: 'Centos Base image (options: 8/9) - Optional, default is 9'
default: '9'
options:
- '8'
- '9'

# Currently the only supported arch is linux/amd64 (x86_64)
jobs:
manual-build-rpm-and-install:
uses: ./.github/workflows/rpm-build-and-install-test-base.yaml
with:
branch: ${{ github.event.inputs.branch }}
centos_ver: ${{ github.event.inputs.centos_ver }}
20 changes: 20 additions & 0 deletions .github/workflows/nightly-rpm-build-and-install-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Nightly RPM Build and Install Test
on:
schedule:
- cron: '0 0 * * *'

# Currently the only supported arch is linux/amd64 (x86_64)
jobs:
call-master-rpm-build-and-install-test-centos9:
uses: ./.github/workflows/rpm-build-and-install-test-base.yaml
secrets: inherit
with:
branch: 'master'
centos_ver: '9'

# call-master-rpm-build-and-install-test-centos8:
# uses: ./.github/workflows/rpm-build-and-install-test-base.yaml
# secrets: inherit
# with:
# branch: 'master'
# centos_ver: '8'
27 changes: 27 additions & 0 deletions .github/workflows/rpm-build-and-install-test-base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: RPM Build and Install Test Workflow
on:
workflow_call:
inputs:
branch:
type: string
description: 'Branch to Build RPM From'
required: true
centos_ver:
type: string
description: 'Centos Base image (options: 8/9) - Optional, default is 9'
default: '9'

jobs:
rpm-build-and-and-install-test-base:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Run Non Containerized RPM Build And Install Test
run: |
make rpm-build-and-install-test BUILD_S3SELECT=0 CENTOS_VER=${{ inputs.centos_ver }} CONTAINER_PLATFORM=linux/amd64
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ endif
BUILD_S3SELECT?=1
BUILD_S3SELECT_PARQUET?=0

## RPM VARIABLES
DATE := $(shell date +'%Y%m%d')
NOOBAA_PKG_VERSION := $(shell jq -r '.version' < ./package.json)
RPM_BASE_VERSION := noobaa-core-$(NOOBAA_PKG_VERSION)-${DATE}
ifeq ($(CONTAINER_PLATFORM), linux/amd64)
ARCH_SUFFIX := x86_64
else ifeq ($(CONTAINER_PLATFORM), linux/ppc64le)
ARCH_SUFFIX := ppc64le
endif
RPM_FULL_PATH := $(RPM_BASE_VERSION).el${CENTOS_VER}.$(ARCH_SUFFIX).rpm
install_rpm_and_deps_command := dnf install -y make && rpm -i $(RPM_FULL_PATH) && systemctl enable noobaa --now && systemctl status noobaa && systemctl stop noobaa

###############
# BUILD LOCAL #
###############
Expand Down Expand Up @@ -178,6 +190,22 @@ rpm: builder
echo "\033[1;32mRPM for platform \"$(NOOBAA_RPM_TAG)\" is ready in build/rpm.\033[0m";
.PHONY: rpm

assert-rpm-build-and-install-test-platform:
@ if [ "${CONTAINER_PLATFORM}" != "linux/amd64" ]; then \
echo "\n Error: Running rpm-build-and-install-test linux/amd64 is currently the only supported container platform\n"; \
exit 1; \
fi
.PHONY: assert-rpm-build-and-install-test-platform

rpm-build-and-install-test: assert-rpm-build-and-install-test-platform rpm
@echo "Running RHEL linux/amd64 (currently only supported) container..."
$(CONTAINER_ENGINE) run --name noobaa-rpm-build-and-install-test --privileged --user root -dit --platform=linux/amd64 redhat/ubi$(CENTOS_VER)-init
@echo "Copying rpm_full_path=$(RPM_FULL_PATH) to the container..."
$(CONTAINER_ENGINE) cp ./build/rpm/$(RPM_FULL_PATH) noobaa-rpm-build-and-install-test:$(RPM_FULL_PATH)
@echo "Installing RPM and dependencies in the container... $(install_rpm_and_deps_command)"
$(CONTAINER_ENGINE) exec noobaa-rpm-build-and-install-test bash -c "$(install_rpm_and_deps_command)"
.PHONY: rpm-build-and-install-test

###############
# TEST IMAGES #
###############
Expand Down

0 comments on commit 3eca5c4

Please sign in to comment.