Skip to content

Commit

Permalink
[CI:BUILD] Podman FCOS image from main
Browse files Browse the repository at this point in the history
Fixes: containers#19446, containers#19447, containers#19448

[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <[email protected]>
  • Loading branch information
lsm5 committed Aug 2, 2023
1 parent cd5ce63 commit 258a3e6
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/fcos-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: FCOS Build from ${{ env.COPR_OWNER }}/${{ env.COPR_PROJECT }}

on:
push:
branches:
- main

env:
COPR_OWNER: "rhcontainerbot"
COPR_PROJECT: "podman-next"

jobs:
wait-for-task:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up wait-for-copr
run: |
pip3 install git+https://github.com/packit/wait-for-copr.git@main
- name: Wait for ${{ env.COPR_OWNER }}/${{ env.COPR_PROJECT }} build
run: |
# wait-for-copr attempts 180 tries with 10s between each try by default
wait-for-copr --owner ${{ env.COPR_OWNER }} --project ${{ env.COPR_PROJECT }} podman `git rev-parse --short HEAD`
echo "COPR build ready!"
- name: Build FCOS image
run: |
git clone https://github.com/coreos/layering-examples
cd layering-examples/podman-next
podman build .
38 changes: 38 additions & 0 deletions .packit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# This script handles any custom processing of the spec file using the `fix-spec-file`
# action in .packit.yaml.

set -eox pipefail

PACKAGE=podman

# Set path to rpm spec file
SPEC_FILE=rpm/$PACKAGE.spec

# Get Version from HEAD
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2)

# RPM Version can't take "-"
RPM_VERSION=$(echo $VERSION | sed -e 's/-/~/')

# Generate source tarball from HEAD
git-archive-all -C $(git rev-parse --show-toplevel) --prefix=$PACKAGE-$VERSION/ rpm/$PACKAGE-$VERSION.tar.gz

# RPM Spec modifications

# Use the Version from HEAD in rpm spec
sed -i "s/^Version:.*/Version: $RPM_VERSION/" $SPEC_FILE

# Use Packit's supplied variable in the Release field in rpm spec.
sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" $SPEC_FILE

# Ensure last part of the release string is the git shortcommit without a
# prepended "g"
sed -i "/^Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/ s/\(.*\)g/\1/" $SPEC_FILE

# Use above generated tarball as Source in rpm spec
sed -i "s/^Source0:.*.tar.gz/Source0: $PACKAGE-$VERSION.tar.gz/" $SPEC_FILE

# Update setup macro to use the correct build dir
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
4 changes: 4 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:
project: packit-builds
enable_net: true
srpm_build_deps:
- git-archive-all
- make
actions:
fix-spec-file:
- "bash .packit.sh"

- <<: *copr
# Run on commit to main branch
Expand Down

0 comments on commit 258a3e6

Please sign in to comment.