Skip to content

Commit

Permalink
Merge pull request containers#18203 from lsm5/v4.5-packit-backport
Browse files Browse the repository at this point in the history
[v4.5 backport] [CI:BUILD] Packit: Initial Enablement
  • Loading branch information
openshift-merge-robot authored Apr 15, 2023
2 parents e6055de + 4d2cf29 commit ab25e76
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .packit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# This script handles any custom processing of the spec file generated using the `post-upstream-clone`
# action and gets used by the fix-spec-file action in .packit.yaml.

set -eo pipefail

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

# Generate source tarball from HEAD
git archive --prefix=podman-$VERSION/ -o podman-$VERSION.tar.gz HEAD

# RPM Spec modifications

# Use the Version from version/version.go in rpm spec
sed -i "s/^Version:.*/Version: $VERSION/" podman.spec

# Use Packit's supplied variable in the Release field in rpm spec.
# podman.spec is generated using `rpkg spec --outdir ./` as mentioned in the
# `post-upstream-clone` action in .packit.yaml.
sed -i "s/^Release:.*/Release: $PACKIT_RPMSPEC_RELEASE%{?dist}/" podman.spec

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

# Use the right build dir for autosetup stage in rpm spec
sed -i "s/^%setup.*/%autosetup -Sgit -n %{name}-$VERSION/" podman.spec
32 changes: 32 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# See the documentation for more information:
# https://packit.dev/docs/configuration/

# Build targets can be found at:
# https://copr.fedorainfracloud.org/coprs/rhcontainerbot/packit-builds/

specfile_path: podman.spec

jobs:
- &copr
job: copr_build
trigger: pull_request
owner: rhcontainerbot
project: packit-builds
enable_net: true
srpm_build_deps:
- make
- rpkg
actions:
post-upstream-clone:
- "rpkg spec --outdir ./"
fix-spec-file:
- "bash .packit.sh"

- <<: *copr
# Run on commit to v4.5 branch
# The `rhcontainerbot/qm` copr needs podman v4.5 for testing on
# centos stream 9
trigger: commit
branch: v4.5
project: qm

0 comments on commit ab25e76

Please sign in to comment.