diff --git a/.github/workflows/changelog-enforcer.yml b/.github/workflows/changelog-enforcer.yml index 679349ba..800433ff 100644 --- a/.github/workflows/changelog-enforcer.yml +++ b/.github/workflows/changelog-enforcer.yml @@ -1,4 +1,4 @@ -name: "Chagelog Enforcer" +name: "Changelog Enforcer" on: pull_request: # The specific activity types are listed here to include "labeled" and "unlabeled" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e66f8814 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,125 @@ +--- +name: release + +on: + release: + types: + - published + +jobs: + dist: + name: Checkout code and build warewulf.spec and dist + runs-on: ubuntu-latest + + steps: + - name: Set DIST + run: | + echo "DIST=warewulf-${GITHUB_REF#refs/tags/v}.tar.gz" >> $GITHUB_ENV + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Build spec and dist + run: | + make warewulf.spec dist + + - name: Upload warewulf.spec + uses: actions/upload-artifact@v3 + with: + name: warewulf.spec + path: warewulf.spec + + - name: Upload DIST + uses: actions/upload-artifact@v3 + with: + name: ${{ env.DIST }} + path: ${{ env.DIST }} + + - name: Attach DIST to release + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ github.event.release.id }} + file: ${{ env.DIST }} + + rpm: + name: Build RPMs + needs: dist + runs-on: ubuntu-latest + 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 + + steps: + - name: Install EPEL + run: dnf -y install epel-release + + - 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 + + - name: Download spec + uses: actions/download-artifact@v3 + with: + name: warewulf.spec + + - name: Set the expected version + run: | + echo "EXPECTED_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - 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}.${{ matrix.dist }}.${{ matrix.arch }}.rpm + SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ matrix.dist }}.src.rpm + echo "RPM=${RPM}" >> $GITHUB_ENV + echo "SRPM=${SRPM}" >> $GITHUB_ENV + + - name: Build RPMs and run tests + run: | + mock -r ${{ matrix.target }} --rebuild --spec=warewulf.spec --sources=. + mock -r ${{ matrix.target }} --chroot -- make -C /builddir/build/BUILD/warewulf-${{ env.EXPECTED_VERSION }} test + + - name: Upload RPM + uses: actions/upload-artifact@v3 + with: + name: ${{ env.RPM }} + path: /var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }} + + - name: Upload SRPM + uses: actions/upload-artifact@v3 + with: + name: ${{ env.SRPM }} + path: /var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }} + + - name: Attach RPM and SRPM to release + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ github.event.release.id }} + file: "/var/lib/mock/${{ matrix.target }}/result/${{ env.RPM }};/var/lib/mock/${{ matrix.target }}/result/${{ env.SRPM }}" diff --git a/.github/workflows/releasebuild.yml b/.github/workflows/releasebuild.yml deleted file mode 100644 index c0841b9b..00000000 --- a/.github/workflows/releasebuild.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- -name: releasebuild - -on: - release: - types: - - published - -jobs: - distbuild: - name: Checkout code and build tar.gz - runs-on: ubuntu-latest - steps: - - name: Set the version - id: version_number - run: | - echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - - name: Set the git source location - id: source_loc - run: | - echo "SRC=${GITHUB_REF}" >> $GITHUB_ENV - - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: '1.16' - cache: true - - - name: Build tar.gz - run: make dist - - - name: Upload mock script - uses: actions/upload-artifact@v3 - with: - name: mockbuild.sh - path: ci/mockbuild.sh - - - name: Upload tar.gz - uses: actions/upload-artifact@v3 - with: - name: warewulf-${{ env.VERSION }}.tar.gz - path: warewulf-${{ env.VERSION }}.tar.gz - - rpmbuild: - name: Build using Rocky Linux - needs: distbuild - runs-on: ubuntu-latest - container: - image: rockylinux/rockylinux - options: --privileged - steps: - - name: Set the version - id: version_number - run: | - echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - - name: Download mock build script - uses: actions/download-artifact@v3 - with: - name: mockbuild.sh - - - name: Download tar.gz - uses: actions/download-artifact@v3 - with: - name: warewulf-${{ env.VERSION }}.tar.gz - - - name: Set execute bit - run: chmod +x mockbuild.sh - - - name: Run rpm build script - run: ./mockbuild.sh ${{ env.VERSION }} - - - name: Upload EL8 RPMs - uses: actions/upload-artifact@v3 - with: - name: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.el8 - path: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.el8.*.rpm - - - name: Upload EL7 RPMs - uses: actions/upload-artifact@v3 - with: - name: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.el7 - path: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.el7.*.rpm - - - name: Upload openSUSE Leap 15.3 RPMs - uses: actions/upload-artifact@v3 - with: - name: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.suse.lp153 - path: warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.suse.lp153.*.rpm - - - name: Upload Assets To Release - if: "!github.event.release.prerelease" - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file: 'warewulf-${{ env.VERSION }}.tar.gz;warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.*.rpm' - draft: false - update_latest_release: true - tags: true - - - name: Upload Assets To Pre-Release - if: "github.event.release.prerelease" - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file: 'warewulf-${{ env.VERSION }}.tar.gz;warewulf-${{ env.VERSION }}-${{ env.RELEASE }}.*.rpm' - draft: false - update_latest_release: false - prerelease: true - tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 696a4965..1d9da817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ability to duplicate an image with `wwctl container copy` or the API - New documentation for container duplication procedure - 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 ### Fixed - Fix hard CPU architecture on proto's installation in the Makefile diff --git a/Makefile b/Makefile index ea71f48e..5a22fe4f 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,13 @@ build: wwctl wwclient wwapid wwapic wwapird etc/defaults.conf etc/bash_completio .PHONY: docs docs: man_pages reference -.PHONY: vendor vendor: - go mod tidy -v go mod vendor +.PHONY: tidy +tidy: + go mod tidy + config = etc/wwapic.conf \ etc/wwapid.conf \ etc/wwapird.conf \ @@ -27,20 +29,6 @@ config: $(config) %: %.in sed -ne "$(foreach V,$(VARLIST),s,@$V@,$(strip $($V)),g;)p" $@.in >$@ -ifndef OFFLINE_BUILD -wwctl: vendor -wwclient: vendor -update_configuration: vendor -wwapid: vendor -wwapic: vendor -wwapird: vendor -dist: vendor - -lint: $(GOLANGCI_LINT) - -$(protofiles): $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) -endif - wwctl: $(config) $(call godeps,cmd/wwctl/main.go) GOOS=linux go build -mod vendor -tags "$(WW_GO_BUILD_TAGS)" -o wwctl cmd/wwctl/main.go @@ -65,7 +53,7 @@ man_pages: wwctl $(wildcard docs/man/man5/*.5) mkdir -p docs/man/man1 ./wwctl --emptyconf genconfig man docs/man/man1 gzip --force docs/man/man1/*.1 - gzip --force --keep docs/man/man5/*.5 + for manpage in docs/man/man5/*.5; do gzip <$${manpage} >$${manpage}.gz; done etc/defaults.conf: wwctl ./wwctl --emptyconf genconfig defaults >etc/defaults.conf @@ -168,7 +156,6 @@ protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \ internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \ internal/pkg/api/routes/wwapiv1/routes_grpc.pb.go .PHONY: proto - proto: $(protofiles) routes_proto = internal/pkg/api/routes/v1/routes.proto @@ -220,9 +207,23 @@ cleandocs: .PHONY: cleanvendor cleanvendor: -ifndef OFFLINE_BUILD rm -rf vendor -endif .PHONY: clean -clean: cleanconfig cleantest cleandist cleantools cleanmake cleanbin cleandocs cleanvendor +clean: cleanconfig cleantest cleandist cleantools cleanmake cleanbin cleandocs + +ifndef OFFLINE_BUILD +wwctl: vendor +wwclient: vendor +update_configuration: vendor +wwapid: vendor +wwapic: vendor +wwapird: vendor +dist: vendor + +lint: $(GOLANGCI_LINT) + +$(protofiles): $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) + +clean: cleanvendor +endif diff --git a/Variables.mk b/Variables.mk index 504f62e0..8ff5426a 100644 --- a/Variables.mk +++ b/Variables.mk @@ -81,7 +81,7 @@ WWCLIENTDIR ?= /warewulf CONFIG := $(shell pwd) # helper functions -godeps=$(shell go list -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g") +godeps=$(shell go list -mod vendor -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g") # use GOPROXY for older git clients and speed up downloads GOPROXY ?= https://proxy.golang.org diff --git a/ci/mockbuild.sh b/ci/mockbuild.sh deleted file mode 100644 index c068d71d..00000000 --- a/ci/mockbuild.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/bash - -VERSION=$1 - -dnf install -y epel-release -dnf install -y mock - -tar -xf warewulf-${VERSION}.tar.gz warewulf-${VERSION}/warewulf.spec - -RELEASE=$(grep 'Release: ' warewulf-${VERSION}/warewulf.spec | cut -d ':' -f2 | awk -F'%' '{print $1}' | tr -d ' ') -echo RELEASE=${RELEASE} >> $GITHUB_ENV - -mock -r rocky+epel-8-x86_64 --rebuild --spec=warewulf-${VERSION}/warewulf.spec --sources=. -mv /var/lib/mock/rocky+epel-8-x86_64/result/warewulf-${VERSION}-${RELEASE}.el8.x86_64.rpm . -mv /var/lib/mock/rocky+epel-8-x86_64/result/warewulf-${VERSION}-${RELEASE}.el8.src.rpm . - -mock -r centos+epel-7-x86_64 --rebuild --spec=warewulf-${VERSION}/warewulf.spec --sources=. -mv /var/lib/mock/centos+epel-7-x86_64/result/warewulf-${VERSION}-${RELEASE}.el7.x86_64.rpm . -mv /var/lib/mock/centos+epel-7-x86_64/result/warewulf-${VERSION}-${RELEASE}.el7.src.rpm . - -mock -r opensuse-leap-15.3-x86_64 --rebuild --spec=warewulf-${VERSION}/warewulf.spec --sources=. -mv /var/lib/mock/opensuse-leap-15.3-x86_64/result/warewulf-${VERSION}-${RELEASE}.suse.lp153.x86_64.rpm . -mv /var/lib/mock/opensuse-leap-15.3-x86_64/result/warewulf-${VERSION}-${RELEASE}.suse.lp153.src.rpm . diff --git a/warewulf.spec.in b/warewulf.spec.in index eb9b3231..ca163e34 100644 --- a/warewulf.spec.in +++ b/warewulf.spec.in @@ -17,7 +17,6 @@ Release: @RELEASE@%{?dist} License: BSD-3-Clause URL: https://github.com/hpcng/warewulf Source: https://github.com/hpcng/warewulf/releases/download/v%{version}/warewulf-%{version}.tar.gz -%{?with_offline:Source2: vendor.tgz} ExclusiveOS: linux @@ -69,8 +68,7 @@ system for large clusters of bare metal and/or virtual systems. %build -%{?with_offline:OFFLINE_BUILD=1} -# Install to sharedstatedir by redirecting LOCALSTATEDIR +export OFFLINE_BUILD=1 make defaults \ PREFIX=%{_prefix} \ BINDIR=%{_bindir} \ @@ -91,6 +89,7 @@ make %install +export OFFLINE_BUILD=1 export NO_BRP_STALE_LINK_ERROR=yes make install \ DESTDIR=%{buildroot}