mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-23 01:57:29 +01:00
sme version of tag2distrepo
This commit is contained in:
parent
921c7f84af
commit
554d021527
52
koji-setup/koji-deploy-pungi-builder.sh
Normal file
52
koji-setup/koji-deploy-pungi-builder.sh
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (C) 2024 Koozali Organisation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DEBUG=
|
||||||
|
SILENT="-s"
|
||||||
|
QUIET="-q"
|
||||||
|
for param in $1 $2 ; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
debug )
|
||||||
|
DEBUG="debug" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
set -xe
|
||||||
|
SILENT=
|
||||||
|
QUIET="-v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load required parameters
|
||||||
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||||
|
if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
||||||
|
echo "$SCRIPT_DIR/koji-parameters.sh NOT found - aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||||
|
KOJI_BUILD_FQDN="$(hostname -f)"
|
||||||
|
|
||||||
|
# Install the koji builder components from epel
|
||||||
|
if [[ -z $(dnf list installed | grep koji-builder-plugins) ]] ; then
|
||||||
|
dnf install -y koji-builder-plugins $QUIET
|
||||||
|
fi
|
||||||
|
|
||||||
|
# deploy the central koji components
|
||||||
|
$SCRIPT_DIR/koji-deploy-pungi-hub.sh $DEBUG
|
||||||
|
|
||||||
|
# deploy runroot to the builders
|
||||||
|
if [ -z $KOJI_BUILD_FQDNS ] ; then
|
||||||
|
# use hub if no builders entered
|
||||||
|
$SCRIPT_DIR/koji-deply-pungi-builder.sh $KOJI_HUB_FQDN $DEBUG
|
||||||
|
else
|
||||||
|
# use builders from api call
|
||||||
|
for FQDN in ${KOJI_BUILD_FQDNS} ; do
|
||||||
|
$SCRIPT_DIR/koij-deploy-pungi-builder.sh $FQDN $DEBUG
|
||||||
|
done
|
||||||
|
fi
|
64
koji-setup/koji-deploy-pungi.sh
Normal file
64
koji-setup/koji-deploy-pungi.sh
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (C) 2024 Koozali Organisation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DEBUG=
|
||||||
|
SILENT="-s"
|
||||||
|
QUIET="-q"
|
||||||
|
for param in $1 $2 ; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
debug )
|
||||||
|
DEBUG="debug" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
set -xe
|
||||||
|
SILENT=
|
||||||
|
QUIET="-v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load required parameters
|
||||||
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||||
|
if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
||||||
|
echo "$SCRIPT_DIR/koji-parameters.sh NOT found - aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||||
|
KOJI_BUILD_FQDN="$(hostname -f)"
|
||||||
|
|
||||||
|
# create the compose directory and change ownership
|
||||||
|
mkdir /mnt/koji/compose
|
||||||
|
chown kojiadmin:kojiadmin /mnt/koji/compose
|
||||||
|
|
||||||
|
# setup runroot on the hub
|
||||||
|
# Install the koji builder components from epel
|
||||||
|
if [[ -z $(dnf list installed | grep koji-hub-plugins) ]] ; then
|
||||||
|
dnf install -y koji-hub-plugins $QUIET
|
||||||
|
fi
|
||||||
|
|
||||||
|
# configure runroot to run on the hub
|
||||||
|
# add Plugins = runroot_hub to /etc/koji-hub/hub.conf
|
||||||
|
|
||||||
|
# deploy runroot to the builders
|
||||||
|
# use builders from api call
|
||||||
|
|
||||||
|
|
||||||
|
## On the builders
|
||||||
|
for FQDN in ${KOJI_BUILD_FQDNS} ; do
|
||||||
|
# copy across the global koji parameters
|
||||||
|
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir -p $SCRIPT_DIR
|
||||||
|
scp $QUIET $SCRIPT_DIR/koji-parameters.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/koji-parameters.sh
|
||||||
|
# pull down the required scripts
|
||||||
|
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/koji-deploy-pungi-builder.sh > $SCRIPT_DIR/koji-deploy-pungi-builder.sh"
|
||||||
|
# make them executeable
|
||||||
|
ssh $QUIET root@$KOJI_BUILD_FQDN "chmod o+x $SCRIPT_DIR/*"
|
||||||
|
|
||||||
|
# setup runroot on the koji builder
|
||||||
|
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/koji-deploy-pungi-builder.sh $DEBUG
|
||||||
|
done
|
@ -1,22 +1,23 @@
|
|||||||
# tag2distrepo
|
# tag2distrepo_sme
|
||||||
|
|
||||||
Koji plugin to automatically regenerate distrepos on tag operations
|
Koji plugin to automatically regenerate distrepos on tag operations
|
||||||
|
Koozali version which allows additional dist-repo settings
|
||||||
|
|
||||||
It uses the following options on a tag to control behaviour:
|
It uses the following options on a tag to control behaviour:
|
||||||
|
|
||||||
- `tag2distrepo.enabled`: set to "true" to enable automatic distrepos
|
- `tag2distrepo_sme.enabled`: set to "true" to enable automatic distrepos
|
||||||
- `tag2distrepo.keys`: set to a space-separated list of keys to use for distrepos
|
- `tag2distrepo_sme.keys`: set to a space-separated list of keys to use for distrepos
|
||||||
|
|
||||||
The tag must have at least one arch configured on it.
|
The tag must have at least one arch configured on it.
|
||||||
|
|
||||||
# Installing plugin on Koji Hub
|
# Installing plugin on Koji Hub
|
||||||
|
|
||||||
1. Copy `tag2distrepo.py` to `/usr/lib/koji-hub-plugins`
|
1. Copy `tag2distrepo_sme.py` to `/usr/lib/koji-hub-plugins`
|
||||||
|
|
||||||
2. Edit the following settings in `/etc/koji-hub/hub.conf` to enable the plugin:
|
2. Edit the following settings in `/etc/koji-hub/hub.conf` to enable the plugin:
|
||||||
|
|
||||||
PluginPath = /usr/lib/koji-hub-plugins
|
PluginPath = /usr/lib/koji-hub-plugins
|
||||||
Plugins = tag2distrepo
|
Plugins = tag2distrepo_sme
|
||||||
|
|
||||||
3. Reload Apache
|
3. Reload Apache
|
||||||
|
|
||||||
@ -26,22 +27,22 @@ The tag must have at least one arch configured on it.
|
|||||||
|
|
||||||
Here is an example of enabling the plugin on an "f33-infra" tag. Create the tag and ensure it has at least one arch and a package list (direct or inherited) so we can tag packages into it.
|
Here is an example of enabling the plugin on an "f33-infra" tag. Create the tag and ensure it has at least one arch and a package list (direct or inherited) so we can tag packages into it.
|
||||||
|
|
||||||
koji add-tag f33-infra --arches=x86_64
|
koji add-tag smeserver11 --arches=x86_64
|
||||||
koji add-pkg --owner kdreyer f33-infra bash
|
koji add-pkg --owner kojiadmin smeserver11 bash
|
||||||
|
|
||||||
Set the extra options on the tag so the plugin will generate the repository:
|
Set the extra options on the tag so the plugin will generate the repository:
|
||||||
|
|
||||||
koji edit-tag -x tag2distrepo.enabled=True -x tag2distrepo.keys=47dd8ef9 f33-infra
|
koji edit-tag -x tag2distrepo_sme.enabled=True -x tag2distrepo_sme.keys=44922a28 -x tag2distrepo_sme=skip_missing_signatures=True smeserver11
|
||||||
|
|
||||||
Tag a new build to trigger the plugin:
|
Tag a new build to trigger the plugin:
|
||||||
|
|
||||||
koji tag f33-infra bash-5.0.17-2.fc33
|
koji tag smeserver11 bash-5.0.17-2.el8.sme
|
||||||
|
|
||||||
The hub will immediately queue a new distRepo task, using the tagBuild task host as the distRepo task owner. When the distRepo task completes, you can find the new repository under the ``topurl`` for your Koji instance.
|
The hub will immediately queue a new distRepo task, using the tagBuild task host as the distRepo task owner. When the distRepo task completes, you can find the new repository under the ``topurl`` for your Koji instance.
|
||||||
|
|
||||||
To confirm that the tag has the correct options set, use the `koji taginfo` command:
|
To confirm that the tag has the correct options set, use the `koji taginfo` command:
|
||||||
|
|
||||||
koji taginfo f33-infra
|
koji taginfo smeserver11
|
||||||
Tag: f33-infra [18680]
|
Tag: f33-infra [18680]
|
||||||
Arches: x86_64
|
Arches: x86_64
|
||||||
Tag options:
|
Tag options:
|
||||||
@ -50,7 +51,7 @@ To confirm that the tag has the correct options set, use the `koji taginfo` comm
|
|||||||
|
|
||||||
To disable the plugin for the same tag:
|
To disable the plugin for the same tag:
|
||||||
|
|
||||||
koji edit-tag -r tag2distrepo.enabled -r tag2distrepo.keys f33-infra
|
koji edit-tag -r tag2distrepo_sme.enabled smeserver11
|
||||||
|
|
||||||
# Using Multiple Keys
|
# Using Multiple Keys
|
||||||
|
|
||||||
@ -58,6 +59,6 @@ If you want to create a repository that contains builds signed by more than one
|
|||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
koji edit-tag coreos-pool -x tag2distrepo.keys="45719a39 9867c58f 38ab71f4 5323552a"
|
koji edit-tag smecontribs11 -x tag2distrepo_sme.keys="44922a28 9867c58f 38ab71f4 5323552a"
|
||||||
|
|
||||||
For each RPM in the tag, Koji will use the first signed copy that it finds. In other words, Koji will try the first key (`45719a39`), and if Koji does not have the first key's signature for that RPM, then it will try the second key (`9867c58f`), third key (`38ab71f4`), and so on.
|
For each RPM in the tag, Koji will use the first signed copy that it finds. In other words, Koji will try the first key (`44922a28`), and if Koji does not have the first key's signature for that RPM, then it will try the second key (`9867c58f`), third key (`38ab71f4`), and so on.
|
||||||
|
@ -12,20 +12,20 @@ import logging
|
|||||||
|
|
||||||
@callback('postTag')
|
@callback('postTag')
|
||||||
def tag2distrepo(cbtype, tag, build, user, force=False):
|
def tag2distrepo(cbtype, tag, build, user, force=False):
|
||||||
logger = logging.getLogger('koji.plugin.tag2distrepo')
|
logger = logging.getLogger('koji.plugin.tag2distrepo_sme')
|
||||||
|
|
||||||
if not tag['extra'].get("tag2distrepo.enabled"):
|
if not tag['extra'].get("tag2distrepo.enabled"):
|
||||||
logger.debug("No tag2distrepo enabled for tag %s" % tag['name'])
|
logger.debug("No tag2distrepo_sme enabled for tag %s" % tag['name'])
|
||||||
return
|
return
|
||||||
if not tag['arches']:
|
if not tag['arches']:
|
||||||
raise ValueError("Tag %s has no arches configured but tag2distrepo is enabled" % tag['name'])
|
raise ValueError("Tag %s has no arches configured but tag2distrepo_sme is enabled" % tag['name'])
|
||||||
|
|
||||||
keys = tag['extra'].get("tag2distrepo.keys", '').split()
|
keys = tag['extra'].get("tag2distrepo_sme.keys", '').split()
|
||||||
compfile = tag['extra'].get("tag2distrepo.comp", 'none')
|
compfile = tag['extra'].get("tag2distrepo_sme.comp", 'none')
|
||||||
inherit = tag['extra'].get("tag2distrepo.inherit", False)
|
inherit = tag['extra'].get("tag2distrepo_sme.inherit", False)
|
||||||
latest = tag['extra'].get("tag2distrepo.latest", False)
|
latest = tag['extra'].get("tag2distrepo_sme.latest", False)
|
||||||
split_debuginfo = tag['extra'].get("tag2distrepo.split_debuginfo", False)
|
split_debuginfo = tag['extra'].get("tag2distrepo_sme.split_debuginfo", False)
|
||||||
skip_missing = tag['extra'].get("tag2distrepo.skip_missing_signatures", False)
|
skip_missing = tag['extra'].get("tag2distrepo_sme.skip_missing_signatures", False)
|
||||||
|
|
||||||
if keys:
|
if keys:
|
||||||
logger.debug("Ensuring signed RPMs are written out")
|
logger.debug("Ensuring signed RPMs are written out")
|
||||||
@ -35,7 +35,7 @@ def tag2distrepo(cbtype, tag, build, user, force=False):
|
|||||||
if rpm['sigkey'] == key:
|
if rpm['sigkey'] == key:
|
||||||
write_signed_rpm(rpm['id'], key, False)
|
write_signed_rpm(rpm['id'], key, False)
|
||||||
|
|
||||||
if tag['extra'].get("tag2distrepo.allow_missing_signatures"):
|
if tag['extra'].get("tag2distrepo_sme.allow_missing_signatures"):
|
||||||
task_opts = {
|
task_opts = {
|
||||||
'arch': tag['arches'].split(),
|
'arch': tag['arches'].split(),
|
||||||
'comp': compfile,
|
'comp': compfile,
|
Loading…
Reference in New Issue
Block a user