Build .opm in CI/CD with opmbuild
OPM::Maker is a standalone Perl CPAN module that provides the .opm tools without requiring a full OTOBO or Znuny installation. This makes it ideal for CI/CD pipelines.
Installation
cpanm OPM::Maker
This makes the opmbuild command available.
Commands
| Command | Purpose |
|---|---|
opmbuild sopmtest MyPackage.sopm | Validate manifest XML and structure |
opmbuild filetest MyPackage.sopm | Verify file list against files on disk |
opmbuild dependencies MyPackage.sopm | List dependencies |
opmbuild build --output dist/ MyPackage.sopm | Generate .opm file |
opmbuild index repo/ | Create repository index XML for a directory containing .opm files |
GitHub Actions Example
name: Build OPM package
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
container: perl:5.40
steps:
- uses: actions/checkout@v4
- name: Install OPM::Maker
run: cpanm --notest OPM::Maker
- name: Validate manifest
run: |
opmbuild sopmtest MyPackage.sopm
opmbuild filetest MyPackage.sopm
- name: Build .opm
run: opmbuild build --output dist/ MyPackage.sopm
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opm-package
path: dist/*.opm
Without a Dedicated Pipeline: The Hub Build Service
Open ITSM Hub optionally provides a stateless service that wraps opmbuild behind an HTTP API (see backend/opmbuild-service). When enabled, the .sopm Validator and generators perform actual Perl validation on the server side—completely without a local Perl installation.
Tip: Multi-Framework Builds
Since a .sopm file can contain multiple <Framework> lines, a single build generates an .opm package that can be installed on all declared forks. Check your compatibility beforehand using the Compatibility Checker.
