add nightly release support
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
This commit is contained in:
139
.github/actions/generate/action.yml
vendored
Normal file
139
.github/actions/generate/action.yml
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
name: 'Generate warewulf metadata'
|
||||
description: 'Generate warewulf.spec and dist, collect commits info'
|
||||
|
||||
inputs:
|
||||
nightly:
|
||||
description: "Whether it is nightly release"
|
||||
required: true
|
||||
default: 'false'
|
||||
token:
|
||||
description: "Github token"
|
||||
required: true
|
||||
event-id:
|
||||
description: "Github event id"
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
should-continue:
|
||||
description: "Whether other jobs should continue"
|
||||
value: ${{ steps.should-continue.outputs.continue }}
|
||||
version:
|
||||
description: "Version value"
|
||||
value: ${{ steps.dist.outputs.version }}
|
||||
release-id:
|
||||
description: "First stage release id"
|
||||
value: ${{ steps.release.outputs.id }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Extract current branch tag
|
||||
run: |
|
||||
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Extract last 24 hours commits info
|
||||
id: commits
|
||||
run: |
|
||||
echo "raw=`git reflog ${{ env.TAG }} --since="24 hours ago"`" >> $GITHUB_OUTPUT
|
||||
echo "commits=`git log ${{ env.TAG }} --pretty --since="24 hours ago" | jq --raw-input . | jq --slurp . | jq -c .`" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Whether should continue
|
||||
id: should-continue
|
||||
run: |
|
||||
if [[ "${{ steps.commits.outputs.raw }}" ]]; then
|
||||
echo "continue=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "continue=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build spec and dist
|
||||
if: inputs.nightly == 'false' || inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
run: |
|
||||
make warewulf.spec dist
|
||||
shell: bash
|
||||
|
||||
- name: Set DIST
|
||||
if: inputs.nightly == 'false' || inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
id: dist
|
||||
run: |
|
||||
dist="warewulf-${{ env.TAG }}.tar.gz"
|
||||
|
||||
if [[ ! -f "$dist" ]];then
|
||||
for f in warewulf-*.tar.gz; do
|
||||
if [[ -e "$f" ]]; then
|
||||
dist="$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "DIST=$dist" >> $GITHUB_ENV
|
||||
|
||||
version=`echo $dist | sed 's/warewulf-//' | sed 's/\.tar\.gz//'`
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Upload warewulf.spec
|
||||
if: inputs.nightly == 'false' || inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: warewulf.spec
|
||||
path: warewulf.spec
|
||||
|
||||
- name: Upload DIST
|
||||
if: inputs.nightly == 'false' || inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.DIST }}
|
||||
path: ${{ env.DIST }}
|
||||
|
||||
- name: Normal dist release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
if: inputs.nightly == 'false'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
release_id: ${{ inputs.event-id }}
|
||||
file: ${{ env.DIST }}
|
||||
|
||||
- name: Write nightly release content
|
||||
if: inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
run: |
|
||||
cat << EOF >> nightly.release.note
|
||||
THIS IS A NIGHTLY RELEASE
|
||||
|
||||
This release contains latest commits, which is feature unstable version
|
||||
|
||||
${{ steps.commits.outputs.raw }}
|
||||
|
||||
${{ steps.commits.outputs.commits }}
|
||||
EOF
|
||||
shell: bash
|
||||
|
||||
- name: Nightly dist release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
if: inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
release_id: ${{ inputs.event-id }}
|
||||
file: ${{ env.DIST }}
|
||||
tag_name: "nightly"
|
||||
prerelease: true
|
||||
draft: false
|
||||
default_release_name: "warewulf nightly release"
|
||||
update_latest_release: true
|
||||
overwrite: true
|
||||
|
||||
- name: Update nightly release content
|
||||
if: inputs.nightly == 'true' && steps.should-continue.outputs.continue == 'true'
|
||||
uses: tubone24/update_release@v1.3.1
|
||||
id: release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
TAG_NAME: "nightly"
|
||||
with:
|
||||
body_path: nightly.release.note
|
||||
|
||||
1
.github/actions/prepare/action.yml
vendored
1
.github/actions/prepare/action.yml
vendored
@@ -2,6 +2,7 @@ name: 'Prepare Warewulf'
|
||||
description: 'Prepare environment and Warewulf source code for testing and building'
|
||||
inputs:
|
||||
go-version:
|
||||
description: "go version"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
|
||||
110
.github/actions/rpm/action.yml
vendored
Normal file
110
.github/actions/rpm/action.yml
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
name: 'Build RPMs'
|
||||
description: 'Build warewulf rpms'
|
||||
|
||||
inputs:
|
||||
dist:
|
||||
description: "distro dist"
|
||||
required: true
|
||||
arch:
|
||||
description: "distro arch"
|
||||
required: true
|
||||
target:
|
||||
description: "distro target"
|
||||
required: true
|
||||
token:
|
||||
description: "Github token"
|
||||
required: true
|
||||
version:
|
||||
description: "Version value"
|
||||
required: true
|
||||
event-id:
|
||||
description: "Github event id"
|
||||
required: true
|
||||
nightly:
|
||||
description: "Whether it is nightly release"
|
||||
default: 'false'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install EPEL
|
||||
run: dnf -y install epel-release
|
||||
shell: bash
|
||||
|
||||
- name: Install mock and rpm-build
|
||||
run: |
|
||||
dnf -y install mock rpm-build
|
||||
echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg
|
||||
shell: bash
|
||||
|
||||
- name: Download spec
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: warewulf.spec
|
||||
|
||||
- name: Set the expected version
|
||||
run: |
|
||||
echo "EXPECTED_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Download dist
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: warewulf-${{ env.EXPECTED_VERSION }}.tar.gz
|
||||
|
||||
- name: Set RPM and SRPM
|
||||
run: |
|
||||
VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec)
|
||||
GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1-2)
|
||||
RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.${{ inputs.arch }}.rpm
|
||||
SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.src.rpm
|
||||
echo "RPM=${RPM}" >> $GITHUB_ENV
|
||||
echo "SRPM=${SRPM}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Build RPMs and run tests
|
||||
run: |
|
||||
mock -r ${{ inputs.target }} --rebuild --spec=warewulf.spec --sources=.
|
||||
mock -r ${{ inputs.target }} --chroot -- make -C /builddir/build/BUILD/warewulf-${{ env.EXPECTED_VERSION }} test
|
||||
shell: bash
|
||||
|
||||
# we need to rename the RPMs and SRPMs to overwrite for nightly release
|
||||
- name: Rename the built RPMs for nightly build
|
||||
if: inputs.nightly == 'true'
|
||||
run: |
|
||||
VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec)
|
||||
GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1-2)
|
||||
RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.${{ inputs.arch }}.rpm
|
||||
SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.src.rpm
|
||||
|
||||
RNAME_RPM=warewulf-${VERSION}.${{ inputs.dist }}.${{ inputs.arch }}.rpm
|
||||
RNAME_SRPM=warewulf-${VERSION}.${{ inputs.dist }}.src.rpm
|
||||
|
||||
mv /var/lib/mock/${{ inputs.target }}/result/${RPM} /var/lib/mock/${{ inputs.target }}/result/${RNAME_RPM}
|
||||
mv /var/lib/mock/${{ inputs.target }}/result/${SRPM} /var/lib/mock/${{ inputs.target }}/result/${RNAME_SRPM}
|
||||
|
||||
echo "RPM=${RNAME_RPM}" >> $GITHUB_ENV
|
||||
echo "SRPM=${RNAME_SRPM}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Upload RPM
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.RPM }}
|
||||
path: /var/lib/mock/${{ inputs.target }}/result/${{ env.RPM }}
|
||||
|
||||
- name: Upload SRPM
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.SRPM }}
|
||||
path: /var/lib/mock/${{ inputs.target }}/result/${{ env.SRPM }}
|
||||
|
||||
- name: Attach RPM and SRPM to release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
release_id: ${{ inputs.event-id }}
|
||||
file: "/var/lib/mock/${{ inputs.target }}/result/${{ env.RPM }};/var/lib/mock/${{ inputs.target }}/result/${{ env.SRPM }}"
|
||||
update_latest_release: true
|
||||
overwrite: true
|
||||
68
.github/workflows/nightly.yml
vendored
Normal file
68
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
name: nightly
|
||||
|
||||
on:
|
||||
#push:
|
||||
schedule:
|
||||
- cron: '05 00 * * *'
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
name: Generate spec, dist and collect commits info
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should-continue: ${{ steps.generate.outputs.should-continue }}
|
||||
version: ${{ steps.generate.outputs.version }}
|
||||
release-id: ${{ steps.generate.outputs.release-id }}
|
||||
permissions: write-all # might not be used for realy deployment
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/generate
|
||||
name: generate warewulf spec, dist and collect commits info
|
||||
id: generate
|
||||
with:
|
||||
nightly: 'true'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
event-id: ${{ github.event.release.id }}
|
||||
|
||||
publish:
|
||||
name: Build and publish releases
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate
|
||||
if: needs.generate.outputs.should-continue == 'true'
|
||||
container:
|
||||
image: rockylinux/rockylinux:9
|
||||
options: --privileged
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: rocky+epel-8-x86_64
|
||||
arch: x86_64
|
||||
dist: el8
|
||||
- target: rocky+epel-9-x86_64
|
||||
arch: x86_64
|
||||
dist: el9
|
||||
- target: centos+epel-7-x86_64
|
||||
arch: x86_64
|
||||
dist: el7
|
||||
- target: opensuse-leap-15.5-x86_64
|
||||
arch: x86_64
|
||||
dist: suse.lp155
|
||||
permissions: write-all # might not be used for realy deployment
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/rpm
|
||||
name: build rpms
|
||||
id: rpm
|
||||
with:
|
||||
dist: ${{ matrix.dist }}
|
||||
arch: ${{ matrix.arch }}
|
||||
target: ${{ matrix.target }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: ${{ needs.generate.outputs.version }}
|
||||
event-id: ${{ needs.generate.outputs.release-id }}
|
||||
nightly: 'true'
|
||||
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Configure network device MTU in nework configuration scripts. #807
|
||||
- OpenSUSE Leap build rebased to 15.5 (15.3 is EOL)
|
||||
- New build for Rocky Linux 9
|
||||
- Add nightly release support
|
||||
|
||||
### Fixed
|
||||
- Make Variables.mk consistent with spec file w.r.t. WWPROVISIONDIR, e.g.
|
||||
|
||||
Reference in New Issue
Block a user