| title | Examples |
|---|---|
| date | 2022-09-22 |
| sidebar_position | 4 |
You can find detailed documentation for actions here.
Getting version from specfile
get-current-version:
- grep -oP '^Version:\s+\K\S+' my-package.specor with a command from rpm-build package that will honor the macros:
get-current-version:
- rpmspec -q --queryformat "%{VERSION}\n" --srpm *specGetting version for Python packages with setup.py
get-current-version:
- python3 setup.py --versionGetting version for Ruby packages from the gemspec
get-current-version:
- ruby -rrubygems -e 'puts Gem::Specification::load(Dir.glob("*.gemspec").first).version'Downloading specfile from the dist-git repo
post-upstream-clone:
- "wget https://src.fedoraproject.org/rpms/my-package/raw/main/f/my-package.spec -O my-package.spec"Setting the Sources correctly in case of multiple Sources
fix-spec-file:
# define one of the Source variables correctly
- sed -i my_specfile_path -e "s/https.*only-vendor.tar.xz/my_correct_tarball_path/"
# fill in %release as if packit would have done it
- bash -c "sed -i my_specfile_path -r \"s/Release:(\s*)\S+/Release:\1${PACKIT_RPMSPEC_RELEASE}%{?dist}/\""Creating archive with custom make target
create-archive:
- make release
- bash -c "ls -1t ./my-package-*.tar.gz | head -n 1"Creating archive for Python packages with setup.py
create-archive:
- python3 setup.py sdist --dist-dir .
- bash -c "ls -1t ./my-package-*.tar.gz | head -n 1"Creating archive with git submodules
create-archive:
- git submodule update --init
# Create an archive file with the ‹pkg› directory prefix
- bash -c 'git ls-files --recurse-submodules | tar --transform "s|^|pkg/|" -caf .packit/pkg.tar.gz -T-'
- echo '.packit/pkg.tar.gz'If you need to generate local archive(s) during release syncing, you can utilise e.g. pre-sync action
to place the commands necessary for the creation. You also have to include the archive(s) in the list of files to
be moved to the dist-git repo so that it is then handled by Packit from there. Note: Beware of how Packit uploads
files to lookaside cache or adds them to dist-git (see this note for more details).
Creating an archive using tito and syncing it to dist-git repo
actions:
pre-sync:
- tito build -o . --tgz
files_to_sync:
- src:
- "<my-package>-*.tar.gz"
dest: .Using file content as a changelog entry
changelog-entry:
- cat .changelog_entryUsing `git log` output as a changelog entry
changelog-entry:
- bash -c 'git log --no-merges --pretty="format:- %s (%an)" $(git describe --tags --abbrev=0 ${PACKIT_PROJECT_UPSTREAM_TAG}^)..${PACKIT_PROJECT_UPSTREAM_TAG} --'You can find detailed documentation for jobs here.
Running builds in Copr for all pull requests
- job: copr_build
trigger: pull_request
targets:
- fedora-allRunning builds in Copr for pull requests with 'main' target branch
- job: copr_build
trigger: pull_request
branch: main
targets:
- fedora-allRunning builds in custom Copr project for pushes to 'main'
Configuring building in Copr project @oamg/convert2rhel:
- job: copr_build
trigger: commit
branch: main
owner: "@oamg"
project: convert2rhel
targets:
- epel-6-x86_64
- epel-7-x86_64
- epel-8-x86_64Running more types of builds in Copr
jobs:
- job: copr_build
trigger: pull_request
identifier: fedora
targets:
- fedora-all
- job: copr_build
trigger: pull_request
specfile_path: epel8/python-specfile.spec
identifier: epel8
actions:
create-archive:
- python3 setup.py sdist --dist-dir ./epel8/
- bash -c "ls -1t ./epel8/*.tar.gz | head -n 1"
targets:
- epel-8Running builds in Koji for all pull requests
- job: upstream_koji_build
trigger: pull_request
targets:
- fedora-allRunning builds in Koji for pull requests with 'main' target branch
- job: upstream_koji_build
trigger: pull_request
branch: main
targets:
- fedora-allUtilising custom failure message
- job: copr_build
trigger: pull_request
targets:
- fedora-all
notifications:
failure_comment:
message: >
Some builds failed for commit {commit_sha}.
@admin, please check."Running tests in Testing Farm for all pull requests
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
targets:
- fedora-allRunning tests in Testing Farm for pull requests with 'main' target branch
- job: copr_build
trigger: pull_request
branch: main
targets:
- fedora-all
- job: tests
trigger: pull_request
branch: main
targets:
- fedora-allRunning tests in internal Testing Farm instance
Please, let us know if you want to use the internal Testing Farm; we have to enable it for you.
- job: copr_build
trigger: pull_request
targets:
- epel-8-x86_64
- job: tests
trigger: pull_request
targets:
epel-8-x86_64:
distros: [RHEL-8.8.0-Nightly]
use_internal_tf: TrueRunning only tests (without builds)
- job: tests
trigger: pull_request
targets:
- fedora-all
skip_build: TrueDefining mapping between build and test targets
- job: copr_build
trigger: pull_request
targets:
- epel-7-x86_64
- epel-8-x86_64
- job: tests
trigger: pull_request
targets:
epel-7-x86_64:
distros: [centos-7, oraclelinux-7]
epel-8-x86_64:
distros: [centos-8, oraclelinux-8]Specifying where the FMF metadata are placed in the current repository
- job: tests
trigger: pull_request
targets:
- fedora-all
fmf_path: .distro/tmtSpecifying where the FMF metadata are placed outside the current repository
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
targets:
- fedora-all
fmf_url: "https://gitlab.cee.redhat.com/baseos-qe/tmt.git"
fmf_ref: mainRunning more types of tests with different settings
jobs:
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
identifier: "postgres-12-pgoutput"
targets:
- fedora-all
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 12
DECODER_PLUGIN: pgoutput
- job: tests
trigger: pull_request
identifier: "postgres-15-decoderbufs"
targets:
- fedora-all
tf_extra_params:
test:
tmt:
name: postgres
environments:
- variables:
POSTGRESQL_VERSION: 15
DECODER_PLUGIN: decoderbufs
Extending timeout of a test pipeline for 24 hours (default is 12 hours)
- job: tests
trigger: pull_request
identifier: "performance"
targets:
- centos-stream-9-x86_64
skip_build: true
manual_trigger: true
labels:
- performance
tf_extra_params:
settings:
pipeline:
timeout: 1440
test:
tmt:
name: performanceProviding custom tmt context
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
targets:
- fedora-all
tf_extra_params:
environments:
- tmt:
context:
how: "full"Tag cloud resources in Testing Farm
Tag cloud resources in Testing Farm to a specific Red Hat team or a project. If you are not a Red Hat employee, this section is not relevant for you.
Make sure to update sst_change_me to your RHEL SST name or name
of the project. If not set, cloud costs are reported against
Packit Service. The BusinessUnit key name is required, please
do not change it.
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
targets:
- fedora-all
# Tag cloud resources for tmt
tf_extra_params:
environments:
- settings:
provisioning:
tags:
BusinessUnit: sst_change_meProviding additional Testing Farm artifacts
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
trigger: pull_request
targets:
- fedora-all
tf_extra_params:
environments:
- artifacts:
- type: repository
id: https://my.repo/repositoryUtilising custom failure message
- job: copr_build
trigger: pull_request
targets:
- fedora-all
- job: tests
identifier: revdeps
trigger: pull_request
targets:
- fedora-all
notifications:
failure_comment:
message: >
Reverse dep tests failed for commit {commit_sha}.
@admin, please check."
Skipping artifacts installation
Done via tmt setup, see here.
Creating dist-git pull requests on upstream releases
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-allCreating dist-git pull requests on upstream releases defined in the dist-git repository
upstream_project_url: https://github.com/packit/packit
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-allCreating dist-git pull requests on upstream releases matching specified tag pattern defined in the dist-git repository
upstream_project_url: https://github.com/packit/packit
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-all
upstream_tag_include: "^2\\..+"
upstream_tag_exclude: "^.+\\.1\\..+"Creating dist-git pull requests on upstream releases with different configs for branches defined in the dist-git repository
upstream_project_url: https://github.com/packit/packit
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-38
upstream_tag_include: "^2\\..+"
upstream_tag_exclude: "^.+\\.1\\..+"
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-rawhideCreating dist-git pull requests on upstream releases with custom spec file manipulation (e.g. rust2rpm)
actions:
prepare-files:
# override Packit default spec file manipulation and update the spec file with rust2rpm
- bash -c 'cd $PACKIT_DOWNSTREAM_REPO && rust2rpm --no-existence-check --store-crate @$PACKIT_PROJECT_VERSION'
jobs:
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-rawhideRunning Koji builds when the Packit pull requests in dist-git are merged
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-allRunning Koji builds as a reaction to merging PRs or committing in dist-git by specified users
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
allowed_pr_authors:
- packit
- the-fas-username-to-allow
allowed_committers:
- packit
- another-fas-username-to-allowCreating Bodhi updates automatically for successful Koji builds
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched # rawhide updates are created automaticallyCustomizing Bodhi update parameters (e.g., requiring reboot, setting karma thresholds)
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched
bodhi_extra_params:
suggest: reboot
stable_karma: 5
unstable_karma: -3
stable_days: 7You can also look directly into configuration files of some other projects using Packit: