Skip to content

Commit

Permalink
Merge pull request #7561 from romayalon/romy-rpm-gaction
Browse files Browse the repository at this point in the history
NSFS | NC | github action for manual rpm build and upload it as artifact
  • Loading branch information
romayalon authored Nov 6, 2023
2 parents c60a3f2 + 2c4a235 commit 04db268
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/manual-build-rpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Manual RPM Build Dispatch
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to RPM Build From'
required: true
tag:
description: 'Additional tag for the build (such as alpha, beta, etc.) - Optional'
default: ''

jobs:
manual-rpm-build-and-upload-artifact:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}

- name: Prepare Suffix
id: suffix
if: ${{ github.event.inputs.tag != '' }}
run: echo suffix="_${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT

- name: Build RPM
id: build_rpm
run: |
echo "Starting make rpm"
make rpm
echo "Make rpm completed"
- name: Finalize RPM
id: finalize_full_rpm_path
run: |
DATE=$(date +'%Y%m%d')
VERSION=$(jq -r '.version' < ./package.json)
RPM_BASE_VERSION=noobaa-core-${VERSION}-1.el8.x86_64
RPM_FULL_PATH="${RPM_BASE_VERSION}_${{ github.event.inputs.branch }}_${DATE}${{ steps.suffix.outputs.suffix }}.rpm"
echo "RPM FULL PATH=${RPM_FULL_PATH}"
cp ./build/rpm/${RPM_BASE_VERSION}.rpm ${RPM_FULL_PATH}
echo "rpm_full_path=${RPM_FULL_PATH}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/[email protected]
with:
name: noobaa_rpm
path: ${{ steps.finalize_full_rpm_path.outputs.rpm_full_path }}
49 changes: 49 additions & 0 deletions .github/workflows/nightly-rpm-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Nightly RPM Build Dispatch
on:
schedule:
- cron: "0 23 * * *"


jobs:
nightly-rpm-build-and-upload-artifact:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master

- name: Build RPM
id: build_rpm
run: |
echo "Starting make rpm"
make rpm
echo "Make rpm completed"
- name: Finalize RPM
id: finalize_full_rpm_path
run: |
DATE=$(date +'%Y%m%d')
VERSION=$(jq -r '.version' < ./package.json)
RPM_BASE_VERSION=noobaa-core-${VERSION}-1.el8.x86_64
RPM_FULL_PATH="${RPM_BASE_VERSION}_${{ github.event.inputs.branch }}_${DATE}${{ steps.suffix.outputs.suffix }}.rpm"
echo "RPM FULL PATH=${RPM_FULL_PATH}"
cp ./build/rpm/${RPM_BASE_VERSION}.rpm ${RPM_FULL_PATH}
echo "rpm_full_path=${RPM_FULL_PATH}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/[email protected]
with:
name: noobaa_rpm
path: ${{ steps.finalize_full_rpm_path.outputs.rpm_full_path }}

- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.NEWAWSPROJKEY }}
aws-secret-access-key: ${{ secrets.NEWAWSPROJSECRET }}
aws-region: us-east-1

- name: Copy RPM to S3 bucket
run: aws s3 cp ${{ steps.finalize_full_rpm_path.outputs.rpm_full_path }} s3://noobaa-core-rpms/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ rpm: base
$(CONTAINER_ENGINE) build $(CONTAINER_PLATFORM_FLAG) $(CPUSET) -f src/deploy/RPM_build/RPM.Dockerfile $(CACHE_FLAG) -t $(NOOBAA_RPM_TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT) . $(REDIRECT_STDOUT)
echo "\033[1;32mImage \"$(NOOBAA_RPM_TAG)\" is ready.\033[0m"
echo "Generating RPM..."
$(CONTAINER_ENGINE) run --rm -v $(PWD)/build/rpm:/export:z -it $(NOOBAA_RPM_TAG)
$(CONTAINER_ENGINE) run --rm -v $(PWD)/build/rpm:/export:z -t $(NOOBAA_RPM_TAG)
echo "\033[1;32mRPM for platform \"$(NOOBAA_RPM_TAG)\" is ready in build/rpm.\033[0m";
.PHONY: rpm

Expand Down

0 comments on commit 04db268

Please sign in to comment.