-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create automated debian and RPM packaging (#1549)
* Adding RPM packaging functionality for minimega. * Testing a variable version number * Adding a github action to test the RPM building * Version upgrades * Adding more necessary packages * Clearer path for updating rpm spec * Update rpm.yml artifact path * Adding a script for the debian packaging * Update deb.yml * Update build.bash * Update build.bash * Update control to use debhelp as the build dependency * Addressing ntfs-3g which resides in the epel repository * Adding a warning message about ntfs-3g * Automatically fail if ntfs-3g is not found * Fixing packaging with libpcap and updating environment variables to be similar to those in the dockerized version. (#2) * Addressing review comments by addressing inefficencies and inconsistencies * Minor pipeline bug fixes * Cleaning up after the build script * Copy the x86_64 RPM to the root directory to keep consistency with debian files. * Updating debhelper to ensure that the systemd service does not automatically start.
- Loading branch information
Showing
21 changed files
with
450 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: DEB Build | ||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential debhelper dnsmasq iproute2 isc-dhcp-client libpcap-dev ntfs-3g openssh-client openvswitch-switch qemu-kvm qemu-utils | ||
- name: Build Deb package | ||
id: deb | ||
run: | | ||
chmod +x ./packaging/debian/build.bash | ||
./packaging/debian/build.bash | ||
- name: Upload artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: minimega-deb | ||
path: ./*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: RPM Build | ||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y rpm dnsmasq iproute2 isc-dhcp-client libpcap-dev ntfs-3g openssh-client openvswitch-switch qemu-kvm qemu-utils | ||
- name: Build RPM package | ||
id: rpm | ||
run: | | ||
chmod +x ./packaging/rpm/build.bash | ||
./packaging/rpm/build.bash | ||
- name: Upload artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: minimega-rpm | ||
path: ./packaging/rpm/rpmbuild/RPMS/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ Miles Crabill <[email protected]> | |
Jonathan Crussell <[email protected]> | ||
Jerry Cruz <[email protected]> | ||
Jacob Davis <[email protected]> | ||
Steven Elliott <[email protected]> | ||
Jeremy Erickson <[email protected]> | ||
John Floren <[email protected]> | ||
David Fritz <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,59 @@ | ||
# minimega source/build directory | ||
MINIMEGA_DIR="/opt/minimega/" | ||
# Runtime directory for minimega to use | ||
|
||
# Runtime directory for minimega to use also known as the BASE directory | ||
# "MM_RUN_PATH" is deprecated and will be removed in a future release | ||
# Please use "MM_BASE" instead. | ||
MM_RUN_PATH="/tmp/minimega" | ||
MM_BASE="/tmp/minimega" | ||
|
||
# Directory to serve files from | ||
MM_FILEPATH="/tmp/minimega/files" | ||
|
||
# Number of meshage peers to find | ||
# "MM_MESH_DEGREE" is deprecated and will be removed in a future release | ||
# Please use "MM_DEGREE" instead. | ||
MM_MESH_DEGREE=0 | ||
MM_DEGREE=0 | ||
|
||
# meshage MSA timeout | ||
MM_MSA=10 | ||
|
||
# Context for finding meshage peers (must be set the same among peers) | ||
MM_CONTEXT="minimega" | ||
|
||
# Port to listen on for meshage connections and to look for peers on (must be set the same among peers) | ||
MM_PORT=9000 | ||
# Run as a daemonized process (should be true when started via /etc/init.d) | ||
|
||
# Run as a daemonized process (should be true when started via /etc/init.d or systemd) | ||
MM_DAEMON=true | ||
|
||
# Logging level - options are "debug","info","warn","error","fatal" | ||
# "MM_LOG_LEVEL" is deprecated and will be removed in a future release | ||
# Please use "MM_LOGLEVEL" instead. | ||
MM_LOG_LEVEL="error" | ||
MM_LOGLEVEL="error" | ||
|
||
# Location for log file | ||
# "MM_LOG_FILE" is deprecated and will be removed in a future release | ||
# Please use "MM_LOGFILE" instead. | ||
MM_LOG_FILE="/tmp/minimega.log" | ||
MM_LOGFILE="/var/log/minimega.log" | ||
|
||
# Panic on quit, producing stack traces for debugging | ||
MM_PANIC=false | ||
|
||
# The meshage broadcast address to use (default "255.255.255.255") | ||
MM_BROADCAST="255.255.255.255" | ||
|
||
# The VLAN range for namespaces (default "101-4096") | ||
MM_VLANRANGE="101-4096" | ||
|
||
# Force minimega to run even if it appears to already be running | ||
MM_FORCE=true | ||
|
||
# Attempt to recover from a previously running instance (only if MM_FORCE is false) | ||
MM_RECOVER=false | ||
|
||
# Path to control group (cgroup) mount location | ||
MM_CGROUP="/sys/fs/cgroup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[Unit] | ||
Description="minimega Emulytics Daemon" | ||
Documentation=https://www.sandia.gov/minimega | ||
Wants=openvswitch-switch.service | ||
|
||
[Install] | ||
WantedBy=default.target | ||
|
||
[Service] | ||
Type=simple | ||
# Kill mode settings | ||
KillMode=control-group | ||
TimeoutStopSec=5 | ||
Restart=on-success | ||
# Setting ulimit and environment variables | ||
LimitNOFILE=1024000 | ||
LimitNPROC=4096000 | ||
EnvironmentFile=/etc/minimega/minimega.conf | ||
# Pre Start script | ||
ExecStartPre=/bin/mkdir -p /etc/minimega/saved_vms/ | ||
ExecStartPre=/bin/mkdir -p ${MM_RUN_PATH} | ||
# Starting minimega | ||
ExecStart=/usr/bin/minimega -nostdin=${MM_DAEMON} -force=${MM_FORCE} -recover=${MM_RECOVER} -base=${MM_BASE} -filepath=${MM_FILEPATH} -broadcast=${MM_BROADCAST} -vlanrange=${MM_VLANRANGE} -port=${MM_PORT} -degree=${MM_DEGREE} -context=${MM_CONTEXT} -level=${MM_LOGLEVEL} -logfile=${MM_LOGFILE} -cgroup=${MM_CGROUP} -panic=${MM_PANIC} -msa=${MM_MSA} | ||
# After start options | ||
ExecStartPost=/bin/sleep 1 | ||
ExecStartPost=/bin/chgrp -R minimega ${MM_RUN_PATH} | ||
ExecStartPost=/bin/chmod -R g=u ${MM_RUN_PATH} | ||
ExecStartPost=/bin/chmod g+s ${MM_RUN_PATH} ${MM_RUN_PATH}/minimega | ||
# Post stop instructions | ||
ExecStopPost=/bin/rm -f ${MM_RUN_PATH}/minimega |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Building minimega | ||
|
||
To create a ``.deb`` you will need the following additional dependencies: | ||
|
||
```bash | ||
sudo apt install debhelper | ||
``` | ||
|
||
Once that is installed, run ``build.bash`` to create a new package. | ||
It, along with other build files will be placed in minimega's top level directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
minimega (${version}) stable; urgency=low | ||
|
||
* Release minimega version ${version}. | ||
|
||
-- Minimega-Dev <[email protected]> ${date} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
19 changes: 15 additions & 4 deletions
19
...aging/debian/minimega/DEBIAN/control.base → packaging/debian/control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
Package: minimega | ||
Version: ${version} | ||
Source: minimega | ||
Section: utils | ||
Priority: extra | ||
Architecture: amd64 | ||
Depends: qemu-kvm, qemu-utils, openvswitch-switch, dnsmasq, dosfstools, ntfs-3g, libpcap-dev | ||
Maintainer: Arthur Hernandez <[email protected]>, Jacob Davis <[email protected]> | ||
Build-Depends: debhelper | ||
Vcs-Browser: https://github.com/sandia-minimega/minimega/ | ||
Vcs-Git: https://github.com/sandia-minimega/minimega.git | ||
|
||
Package: minimega | ||
Architecture: amd64 | ||
Homepage: https://www.sandia.gov/minimega | ||
Depends: qemu-kvm, | ||
qemu-utils, | ||
openvswitch-switch, | ||
dnsmasq, | ||
dosfstools, | ||
ntfs-3g, | ||
libpcap-dev | ||
Description: a distributed VM management tool. | ||
minimega is a tool for launching and managing virtual machines. It can run on | ||
your laptop or distributed across a cluster. minimega is fast, easy to deploy, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
../../../bin /opt/minimega/ | ||
../../../doc /opt/minimega/ | ||
../../../lib /opt/minimega/ | ||
../../../misc/daemon /opt/minimega/misc/ | ||
../../../misc/vmbetter_configs /opt/minimega/misc/ | ||
../../../web /opt/minimega/ | ||
../../../LICENSE /usr/share/doc/minimega/ | ||
../../../LICENSES /usr/share/doc/minimega/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
opt/minimega/bin/minimega usr/bin/minimega | ||
opt/minimega/bin/miniweb usr/bin/miniweb | ||
opt/minimega/bin/protonuke usr/bin/protonuke | ||
opt/minimega/misc/daemon/minimega.conf /etc/minimega/minimega.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/make -f | ||
#export DH_VERBOSE=1 | ||
|
||
MM=".." | ||
DST="debian/tmp/opt/minimega" | ||
DOCS="debian/tmp/usr/share/doc/minimega" | ||
|
||
%: | ||
dh $@ --with systemd --no-start --parallel | ||
|
||
override_dh_prep: | ||
dh_prep | ||
mkdir -p $(DST) | ||
cp -r $(MM)/bin $(DST)/ | ||
cp -r $(MM)/doc $(DST)/ | ||
cp -r $(MM)/lib $(DST)/ | ||
mkdir -p $(DST)/misc | ||
cp -r $(MM)/misc/daemon $(DST)/misc/ | ||
cp -r $(MM)/misc/vmbetter_configs $(DST)/misc/ | ||
mkdir -p $(DST)/web | ||
cp -r $(MM)/web $(DST)/web/ | ||
mkdir -p $(DOCS) | ||
cp $(MM)/LICENSE $(DOCS)/ | ||
cp -r $(MM)/LICENSES $(DOCS)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rpmbuild/BUILDROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Building minimega | ||
|
||
To create a ``.rpm`` you will need the following additional dependencies: | ||
|
||
```bash | ||
sudo apt install rpm | ||
``` | ||
|
||
Once that is installed, run ``build.bash`` to create a new package. | ||
The package will be placed in minimega's top level directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
MM=$SCRIPT_DIR/../.. | ||
FILES=$SCRIPT_DIR/minmega | ||
|
||
# substitute version for control file | ||
source $MM/VERSION | ||
sed -e 's/${version}/'"$VERSION"'/g' $SCRIPT_DIR/rpmbuild/SPECS/minimega.spec.base > $SCRIPT_DIR/rpmbuild/SPECS/minimega.spec | ||
|
||
echo "PREPARING FOR BUILDING RPM..." | ||
mkdir -p rpmbuild/BUILD | ||
mkdir -p rpmbuild/RPMS | ||
mkdir -p rpmbuild/SOURCES | ||
mkdir -p rpmbuild/SPECS | ||
mkdir -p rpmbuild/SRPMS | ||
|
||
echo "BUILDING PACKAGE..." | ||
(cd $SCRIPT_DIR && rpmbuild --define "_topdir $SCRIPT_DIR/rpmbuild" -bb rpmbuild/SPECS/minimega.spec) | ||
cp $SCRIPT_DIR/rpmbuild/RPMS/x86_64/*.rpm $SCRIPT_DIR/../../ | ||
rm -rf $SCRIPT_DIR/rpmbuild/SPECS/minimega.spec | ||
echo "DONE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
rm -rf rpmbuild/BUILD | ||
rm -rf rpmbuild/BUILDROOT | ||
rm -rf rpmbuild/RPMS | ||
rm -rf rpmbuild/SOURCES | ||
rm -rf rpmbuild/SRPMS |
Oops, something went wrong.