#152 Using Podman with GitHub Actions to run Fedora Linux
Closed: scheduled a year ago by rlengland. Opened 2 years ago by fed500.

First draft

Using Podman with GitHub Actions to run Fedora Linux

Introduction

GitHub enables distributed and collaborative
code development. To ensure software works correctly, many projects
use continuous integration to build and test each new contribution
before including it. The testing also ensures that changes in
external dependencies due to updates also allow the software to
run correctly.

Background

GitHub offers testing on Ubuntu, Mac OS X and Windows operating
systems. However, there is a wide variety of other operating systems.
One way to test software on some of these other operating systems is
to use containers, in particular podman. These
will run a guest operating system ontop of another host operating
system. The article
Getting Started with Podman in Fedora
introduces how to run podman on Fedora. Here, we will run podman
on Ubuntu as the host operating system with Fedora as the guest
operating system. This will allow us to test that our projects work
successfully on Fedora even if Fedora is not available as a base
operating system.

Working Example

As an example, we add continuous integration for Fedora linux to
RedAmber,
a project enabling the use of dataframes in
Ruby. This project relies on
Apache Arrow release 10 or greater,
so we need to use Fedora Rawhide as the Fedora 37 currently has
Apache Arrow release 9.

GitHub has great documentation on using
GitHub Actions.
In summary, we need to create a yaml file in the
+.github/workflows+ directory of our project, and then enable
GitHub Actions. A sample yaml file is below

...

Name of the workflow

name: CI

When the workflow should run

on:
push:
branches:
- main
pull_request:

What the workflow should do

jobs:
test:
name: fedora
runs-on: ubuntu-latest
# Steps of the workflow
steps:
# Install Podman on latest Ubuntu LTS
# then pull fedora rawhide image
- name: Setup Podman
run: |
sudo apt update
sudo apt-get -y install podman
podman pull fedora:38
# Clone the commit associated with push/pull request
- name: Get source
uses: actions/checkout@v3
with:
path: 'red_amber'
# Build a container then use podman to run it
- name: Create container and run tests
run: |
echo 'FROM fedora:38' >> podmanfile
# set timezone so that timestamp test works
echo 'ENV TZ=Asia/Tokyo' >> podmanfile
# Update and install Fedora dependencies
echo 'RUN dnf -y update' >> podmanfile
echo 'RUN dnf -y install gcc-c++ git libarrow-devel' >> podmanfile
echo 'RUN dnf -y install libarrow-glib-devel ruby-devel' >> podmanfile
echo 'RUN dnf clean all' >> podmanfile
echo 'COPY red_amber red_amber' >> podmanfile
echo 'WORKDIR /red_amber' >> podmanfile
# Install Ruby packages
echo 'RUN bundle install' >> podmanfile
echo 'RUN bundle exec rake test' >> podmanfile
# Build the container using the directions in the podmanfile
podman build --tag fedora38test -f ./podmanfile
...

Adding the above yaml file enables testing on Fedora linux. Similar workflows
should work for other projects, thereby ensuring a wide variety of software
will run well on Fedora linux.

Acknowledgements

Benson Muite is grateful to Hirokazu SUZUKI for creating RedAmber
and improving the workflow to include Fedora linux.


Issue tagged with: article

2 years ago

Metadata Update from @rlengland:
- Issue assigned to fed500
- Issue tagged with: needs-image

2 years ago

@fed500 I've assigned this ticket to you and placed in the the "in-progress" state since you have much of the article in this ticket.

Please let us know when you have it in WordPress and ready for the editors to review.

Thanks for your contributions.

2 years ago

Metadata Update from @rlengland:
- Custom field editor adjusted to @rlengland
- Issue untagged with: needs-image

a year ago

Metadata Update from @rlengland:
- Custom field image-editor adjusted to @fed500

a year ago

Metadata Update from @rlengland:
- Custom field publish adjusted to 2022-12-28

a year ago

Suggested edits:


GitHub offers testing on Ubuntu, Mac OS X and Windows ...

s/Mac OS X/macOS/


One way to test software on some of these other operating systems is to use containers, in particular Podman.

Podman isn't itself a container. How about removing this sentence and changing the next sentence to:

Podman is a command line tool that can run a different Linux operating system in a container. This provides a convenient way to test software on other operating systems.


The article Getting Started with Podman in Fedora introduces how to run Podman on Fedora.

s/introduces/demonstrates/, s/Fedora/Fedora Linux/


Here, we will run Podman on Ubuntu as the host operating system with Fedora as the guest operating system.

The phrasing "... run Podman on Ubuntu as ..." seems confusing. You might be trying to say too much in a single sentence. How about breaking this out into several sentences so that there is only one "thought" per sentence? For example:

This article demonstrates how to run Fedora Linux in a container using Podman. The host operating system can be any distro that has Podman installed, even macOS or Windows. In the following demo, the host operating system is Ubuntu.


... we add continuous integration for Fedora linux ...

s/linux/Linux/


... so we need to use Fedora Rawhide (F38) since Fedora 37 currently has Apache Arrow release 9 within the Fedora repositories.

s/Fedora Rawhide/Fedora Linux Rawhide/, s/Fedora 37/Fedora Linux 37/, s/within/in/


Otherwise, it LGTM! 🙂

Thanks. Assume changes have been made.

I enabled public preview. The following link should allow you to view it.

https://fedoramagazine.org/?p=31552&preview=1&_ppp=aaf8abaa61

We can move it back to draft anytime before it goes live if you want to make further revisions. Just let us know. 🙂

Looks good. Thanks for the improvements. Added some alt text to the featured image so may need to regenerate the article so that it is screen reader friendly.

The Alt text shows up in the preview. No further changes needed.

Issue status updated to: Closed (was: Open)
Issue close_status updated to: scheduled

a year ago

Log in to comment on this ticket.

Metadata