Yum Repository Poller

Note: This plugin is available for Go servers running on Linux nodes having repoquery installed (part of the yum-utils package, Ubuntu, CentOS)


The Yum respository poller is a bundled package material plugin capable of polling yum repositories for rpm packages. Go server interacts with this plugin via package material plugin interfaces. The plugin makes use of a command similar to the following to poll the server. So it does not depend on the files that yum depends on e.g. files under /etc/yum.repos.d

repoquery --repofrompath=uuid,$REPO_URL --repoid=uuid -q $PACKAGE_SPEC -qf "%{LOCATION}..."

A given instance of polling is considered successful if repoquery returns a single package as output.

Repository definition

Repo URL must be a valid http, https or file URL. This plugin looks for the presence of $REPO_URL/repodata/repomd.xml to ascertain validity. Basic authentication (user:password@domain/path) is supported for http and https repositories.

Package definition

In case of this plugin, the package definition is completely determined by the package spec. The package spec may be in any of the following formats. Please refer the repoquery man page for details.


Shell glob patterns may also be used. For example, say we have a component under development getting ready for release of version 1.2.0. We cut a branch for the release and bump up the version on trunk/master to 1.3.0. Thus, a package generated by trunk/master may look like mycomp-1.3.0-b72349-noarch.rpm while that generated by branch may look like mycomp-1.2.0-b72344-noarch.rpm. Now if we have a deployment pipeline that is only interested in 1.2 series packages, the package spec needs to be mycomp-1.2.* rather than just mycomp.

Package Metadata

The following rpm metadata is accessed by the plugin

  1. BuildTime (required, automatically set by rpmbuild) - Used by the plugin to validate if the package is newer than what was last seen by Go. Go displays this field as Modified On.
  2. Packager - Go displays this field as Modified By. If not provided, it is shown as anonymous
  3. URL - Displayed as a Trackback URL by Go. Use this as a means to trace back to the job that published the package (within Go or outside) to the yum repository.
  4. BuildHost - Displayed by Go as Comment: Built on $BUILDHOST

Published Environment Variables

The following information is made available as environment variables for tasks:


Individual plugins may provide additional info via additional environment variables.

Downloading RPMs

Let's say we set up a repository named ORA pointing to http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64 and define a package gcc with a spec of gcc-4.* and set it up as material for a pipeline. To download the package locally on the agent, we could write a task like this:

[go] Start to execute task: <exec command="/bin/bash" >
<arg>curl -o /tmp/gcc.rpm $GO_PACKAGE_ORA_GCC_LOCATION</arg>

When the task executes on the agent, the environment variables get subsituted as below:

[go] Start to execute task: <exec command="/bin/bash" >
[go] setting environment variable 'GO_PACKAGE_ORA_GCC_LABEL' to value 'gcc-4.4.7-3.el6.x86_64'
[go] setting environment variable 'GO_REPO_ORA_GCC_REPO_URL' to value 'http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64'
[go] setting environment variable 'GO_PACKAGE_ORA_GCC_PACKAGE_SPEC' to value 'gcc-4.*'
[go] setting environment variable 'GO_PACKAGE_ORA_GCC_LOCATION' to value 'http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/getPackage/gcc-4.4.7-3.el6.x86_64.rpm'

Or, to simply pass it as an argument to a deploy script on a remote server

<exec command="/bin/bash">
    <arg>ssh server "cd /to/dest/dir;deploy.sh $GO_PACKAGE_ORA_GCC_LOCATION"</arg>

Installing RPMs

For self contained packages (no external dependencies other than what is already installed on the target node), it is just enough to do:

rpm -U /path/to/downloaded/pkg.rpm

On the other hand, if the package isn't self-contained, we'd run:


This would require that /etc/yum.repos.d contain the repository definitions.

Creating and Publishing RPMs

Although the support for package as material in Go isn't concerned with how the packages are created and published, here is a short set of pointers to information on the web.


  1. This plugin will detect at max one package revision per minute (the default interval at which Go materials poll). If multiple versions of a package get published to a repo in the time interval between two polls, Go will only register the latest version in that interval.
  2. This plugin makes use of buildtime in rpm metadata to determine if a poll has returned a new result. If for some reason (e.g. timezone misconfiguration), the buildtime of pkg-1.1 is less than that of pkg-1.0, then the plugin will not register pkg-1.1 as a newer package.
  3. The only way to update an rpm is to change the version or release. Republishing a different file with the same name and different buildtime won't do.
  4. Package groups are not supported.
  5. The Go command repository has a bunch of commands related to rpm packages.

results matching ""

    No results matching ""