From a3cf18320e2881b1172fb88d2ff8f0e018a74ad6 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Thu, 28 Jul 2022 12:05:52 -0700 Subject: [PATCH] koji_build: add new template file Signed-off-by: Kevin Fenzi --- .../templates/osbuildapi-update.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/koji_builder/templates/osbuildapi-update.sh diff --git a/roles/koji_builder/templates/osbuildapi-update.sh b/roles/koji_builder/templates/osbuildapi-update.sh new file mode 100644 index 0000000000..2190029e00 --- /dev/null +++ b/roles/koji_builder/templates/osbuildapi-update.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +/usr/sbin/ipset create osbuildapi hash:ip >& /dev/null + +{% if env == 'staging' %} +RESOLVEQUERY=`resolvectl --cache=no --legend=no query api.stage.openshift.com 2> /dev/null` +{% else %} +RESOLVEQUERY=`resolvectl --cache=no --legend=no query api.openshift.com 2> /dev/null` +{% endif %} +test $? -eq 0 || exit $? + +NEWIPS=`echo $RESOLVEQUERY | grep link | awk '{print $2 " " $6}' | sort -n` + +/usr/sbin/ipset flush osbuildapi +for j in $NEWIPS +do + /usr/sbin/ipset add osbuildapi $j +done