Skip to content

Instantly share code, notes, and snippets.

@saschagrunert
Created May 5, 2026 12:04
Show Gist options
  • Select an option

  • Save saschagrunert/2e9e127bfba2eef084206dd9df821edf to your computer and use it in GitHub Desktop.

Select an option

Save saschagrunert/2e9e127bfba2eef084206dd9df821edf to your computer and use it in GitHub Desktop.
Fedora Vagrant setup for RPM packaging
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "fedora/42-cloud-base"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/42/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-libvirt-42-1.1.x86_64.vagrant.libvirt.box"
memory = 6144
cpus = 4
config.vm.provider :libvirt do |v|
v.memory = memory
v.cpus = cpus
end
config.vm.provision "setup", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
set -euxo pipefail
curl -o /tmp/2022-IT-Root-CA.pem https://certs.corp.redhat.com/certs/2022-IT-Root-CA.pem
cp /tmp/2022-IT-Root-CA.pem /etc/pki/ca-trust/source/anchors/
update-ca-trust
curl -L -o /etc/yum.repos.d/rcm-tools-fedora.repo http://download.devel.redhat.com/rel-eng/internal/rcm-tools-fedora.repo
dnf install -y \
chkconfig \
git \
java-headless \
krb5-workstation \
rhpkg \
rpmdevtools \
vim
cp /tmp/2022-IT-Root-CA.pem /etc/pki/brew/RH-IT-Root-CA.crt
cat > /home/vagrant/.rpmmacros <<'EOF'
%_topdir %(echo $(pwd))
%_sourcedir %{_topdir}
%_specdir %{_sourcedir}
%_rpmdir %{_topdir}/RPMS
%_srcrpmdir %{_topdir}/SRPMS
%_builddir %{_topdir}/BUILD
%_tmppath %(echo ${TMPDIR:-/var/tmp})
%_buildroot %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
EOF
chown vagrant:vagrant /home/vagrant/.rpmmacros
su vagrant -c 'git config --global user.name "Sascha Grunert"'
su vagrant -c 'git config --global user.email "sgrunert@redhat.com"'
# Based on: https://gitlab.cee.redhat.com/it-ansible/supplemental/ssh/-/blob/main/fedora-rhel-config
cat > /home/vagrant/.ssh/config <<'EOF'
StrictHostKeyChecking accept-new
Compression yes
ServerAliveInterval 30
ServerAliveCountMax 120
Host iad2
Hostname bastion-iad2.corp.redhat.com
ProxyJump none
Host *.iad2.dc.redhat.com
ProxyJump iad2
Host rdu2
Hostname bastion-rdu2.corp.redhat.com
ProxyJump none
Host *.rdu2.redhat.com *.rdu2.dc.redhat.com
ProxyJump rdu2
Host pkgs.devel.redhat.com
ProxyJump iad2
Host pkgs-stage.devel.redhat.com
ProxyJump iad2
Host *.redhat.com
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
ForwardAgent no
ForwardX11 no
ForwardX11Trusted no
HashKnownHosts no
User sgrunert
EOF
chown vagrant:vagrant /home/vagrant/.ssh/config
chmod 600 /home/vagrant/.ssh/config
echo ""
echo "=========================================="
echo " Setup complete. Next steps:"
echo "=========================================="
echo ""
echo " vagrant ssh"
echo " kinit sgrunert@IPA.REDHAT.COM"
echo ""
echo " REPO=cri-tools"
echo " BRANCH=rhaos-4.23-rhel-9"
echo " VERSION=v1.36.0"
echo ""
echo " rhpkg clone \$REPO && cd \$REPO"
echo " git checkout \$BRANCH"
echo " # Update commit0, version, release in \$REPO.spec"
echo " spectool -g \$REPO.spec"
echo " rhpkg new-sources \$REPO-*.tar.gz"
echo " rpmdev-bumpspec -c \"Bump to \$VERSION\" \$REPO.spec"
echo " git commit -asm \"Bump to \$VERSION\""
echo " git push"
echo " rhpkg build"
echo ""
echo " Scratch build for private branches:"
echo " rhpkg srpm"
echo " brew build --scratch \$BRANCH-candidate *.src.rpm"
echo ""
echo " Docs: https://docs.google.com/document/d/1eLl8jtngClPBijxlvfTSVu4afy28TRWhS8wTejtINh4/edit"
echo "=========================================="
SHELL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment