Testing Fedora packages in Toolbox
Published: 2022-11-22 10:06:43

---
title: Testing Fedora packages in Toolbox
published: true
date: 2021-05-09 22:00:00 UTC
tags: 
canonical_url: https://alexsaezm.com/posts/testing_fedora_packages_in_toolbox/
---

> This is just the usual Fedora testing workflow but with a container in the middle, so nothing really relevant, to be honest.

I made a massive mistake in the Fedora release process a few Go minor releases ago (around 1.16.1, I think). Basically, the Go package was stuck in the previous version.

So now that I’m making another two releases (1.15.12 for Fedora 33 and 1.16.4 for Fedora 34 and Rawhide), I wondered how I can try my ready-to-be-published version in a container.

> Yes, I participate in the Fedora community but I never tested a package. Shame on me.

## The release

First of all, let’s check what is included in Go `1.15.12` by looking at the [upstream milestone](https://github.com/golang/go/milestone/209?closed=1). At some point in the release process, we’ll need to specify if we solve something with this release already tracked in the Fedora bug tracker.

_/me looks bugs and reads comments…_

Alright! It looks like we only have [issue 45711](https://github.com/golang/go/issues/45711) which seems to be [bug 1958343](https://bugzilla.redhat.com/show_bug.cgi?id=1958343).

Well, I guess we can start the release process:

```bash
# Clone the fedora repository
fedpkg clone golang && cd golang
# Switch to the target release
fedpkg switch-branch f33
# Bump up the version
rpmdev-bumpspec golang.spec
# 99.999% of the time we'll need to edit the golang.spec
vim golang.spec
# Let's download the upstream sources
spectool -g golang.spec
# Include them in the Fedora cache
fedpkg new-sources go1.15.12.src.tar.gz
# Commit the changes
git add -A && git commit -m "Update to go1.15.12"
# Perform a scratch build before submiting the code
fedpkg scratch-build --srpm
# Wait...
git push
# The real build
fedpkg build
# After a while we can do the release with the information of the bug
fedpkg update
```

A quick summary of what we have:

- [The commit](https://src.fedoraproject.org/rpms/golang/c/b2a8f76814f5c9246873fd78cd2c6c32fa110605?branch=f33)
- [The scratch build](https://koji.fedoraproject.org/koji/taskinfo?taskID=67614415)
- [The build](https://koji.fedoraproject.org/koji/taskinfo?taskID=67617917)
- [The release](https://bodhi.fedoraproject.org/updates/FEDORA-2021-a50122f73b)

## The testing

Now that our release is on testing, we can create a container, subscribe to that testing channel, and see if I screwed it again :). And this is an excellent excuse to use Toolbox.

```bash
toolbox create --release 33 
toolbox enter --container fedora-toolbox-33
```

Now we should be inside a container. A nice thing about Toolbox is that we don’t have any of the packages installed on the host, just those that came with the image. Still, we have access to all of our configurations and files. Pretty neat to test stuff, isn’t it?

We can install Go, check the version, and then, once the package we submitted reaches the testing state, update it by using the updates-testing repository:

```bash
# First we need the stable package
sudo yum install golang
# Output: go version go1.15.11 linux/amd64
go version
# The magic trick
sudo dnf upgrade --enablerepo=updates-testing golang
# Output: go version go1.15.12 linux/amd64
go version
```

> If you use VSCode, you can now jump into the container using `Attach to Running Container`.

If you are interested in helping out the Fedora community, [feel free to read the wiki](https://fedoraproject.org/wiki/QA:Updates_Testing), and if you don’t have spare machines to try new and potentially unstable stuff, you can use this container approach with a lot of different packages (forget about kernel testing for example) or swap the container for a VM.

Happy testing :)