@@ -71,6 +71,9 @@ owner_config_file="${configs_dir}/owner.yaml"
7171owner_reuse_creds=" false"
7272owner_to0_insecure_tls=" false"
7373
74+ go_fdo_server_rpms=" go-fdo-server go-fdo-server-manufacturer go-fdo-server-owner go-fdo-server-rendezvous"
75+ go_fdo_client_rpms=" go-fdo-client"
76+
7477# systemd drop-in file configuration
7578#
7679systemd_drop_in_base_dir=" /run/systemd/system"
@@ -209,50 +212,103 @@ install_from_copr() {
209212 # https://docs.testing-farm.io/Testing%20Farm/0.1/test-environment.html#disabling-tag-repository
210213 sudo dnf install --disablerepo=* --enablerepo=copr:copr.fedorainfracloud.org:group_fedora-iot:fedora-iot -y " $@ "
211214 sudo dnf copr disable -y @fedora-iot/fedora-iot
215+ sudo dnf copr remove -y @fedora-iot/fedora-iot
216+ }
217+
218+ install_from_compose (){
219+ source /etc/os-release
220+ case " ${ID} -${VERSION_ID} " in
221+ fedora-rawhide)
222+ compose_host=" http://kojipkgs.fedoraproject.org"
223+ compose_id=" latest-Fedora-${VERSION_ID^} "
224+ compose_streams=" Everything"
225+ compose_base_url=" ${COMPOSE_BASE_URL:- ${compose_host} / compose/ ${VERSION_ID} / ${compose_id} / compose} "
226+ ;;
227+ fedora-* )
228+ compose_host=" http://kojipkgs.fedoraproject.org"
229+ compose_streams=" Everything"
230+ compose_base_url=" ${COMPOSE_BASE_URL:- ${compose_host} / compose/ updates/ f${VERSION_ID} -updates/ compose} "
231+ ;;
232+ centos-* )
233+ compose_host=" https://composes.stream.centos.org"
234+ compose_id=" latest-CentOS-Stream"
235+ compose_streams=" BaseOS AppStream"
236+ compose_base_url=" ${COMPOSE_BASE_URL:- ${compose_host} / stream-${VERSION_ID} / production/ ${compose_id} / compose} "
237+ ;;
238+ rhel-* )
239+ compose_base_url=" ${COMPOSE_BASE_URL:- } "
240+ [ -n " ${compose_base_url} " ] || log_error " Compose base URL must be set for RHEL (eg='http://download.host/.../latest-RHEL-Compose/compose/')"
241+ compose_streams=" ${COMPOSE_STREAMS:- BaseOS AppStream} "
242+ [ -n " ${compose_streams} " ] || log_error " Streams must be set for RHEL (default='BaseOS AppStream')"
243+ ;;
244+ * )
245+ log_error " OS not supported"
246+ ;;
247+ esac
248+ for stream in ${compose_streams} ; do
249+ repo_name=" compose-${ID} -${VERSION_ID} -${stream} "
250+ sudo tee " /etc/yum.repos.d/compose-${repo_name} .repo" << EOF
251+ [${repo_name} ]
252+ name=${repo_name}
253+ baseurl=${compose_base_url} /${stream} /$( uname -m) /os/
254+ enabled=1
255+ gpgcheck=0
256+ EOF
257+ done
258+ sudo dnf install --disablerepo=* --enablerepo=compose* -y " $@ "
259+ sudo rm -f /etc/yum.repos.d/compose-*
212260}
213261
214262install_client () {
215263 # If PACKIT_COPR_RPMS is not defined it means we are running the test
216- # locally so we will install the client from the copr repo
217- [ -v " PACKIT_COPR_RPMS" ] || rpm -q go-fdo-client & > /dev/null || install_from_copr go-fdo-client
264+ # locally so we will install the client from the copr repo or from a compose
265+ if [ ! -v " PACKIT_COPR_RPMS" ]; then
266+ if [ " ${USE_COMPOSE:- false} " == " true" ] ; then
267+ install_from_compose ${go_fdo_client_rpms}
268+ else
269+ install_from_copr ${go_fdo_client_rpms}
270+ fi
271+ fi
218272 log_info " Installed Client RPM:"
219- echo " ⚙ $( rpm -q go-fdo-client ) "
273+ echo " ⚙ $( rpm -q ${go_fdo_client_rpms} ) "
220274}
221275
222276uninstall_client () {
223- # When running a test locally we remove the client package
224- # after a successful execution.
225- [ -v " PACKIT_COPR_RPMS" ] || {
226- sudo dnf remove -y go-fdo-client
227- sudo dnf copr remove -y @fedora-iot/fedora-iot
228- }
277+ [ -v " PACKIT_COPR_RPMS" ] || sudo dnf remove -y ${go_fdo_client_rpms}
229278}
230279
231280install_server () {
232- # If PACKIT_COPR_RPMS is not defined it means we are running the test
233- # locally so we will build and install the RPMs from the *committed* code
234- if [ ! -v " PACKIT_COPR_RPMS" ]; then
235- commit=" $( git rev-parse --short HEAD) "
236- rpm -q go-fdo-server | grep -q " go-fdo-server.*git${commit} .*" || {
237- make rpm
238- sudo dnf install -y rpmbuild/rpms/{noarch," $( uname -m) " }/* git" ${commit} " * .rpm
239- }
240- else
241- log_info " Expected Server RPMs:"
281+ # If PACKIT_COPR_RPMS is defined it means that all the rpms were built and installed already by packit
282+ if [ -v " PACKIT_COPR_RPMS" ]; then
283+ log_info " Expected RPMs:"
242284 for i in ${PACKIT_COPR_RPMS} ; do
243285 echo " ⚙ $i "
244286 done | sort
287+ else
288+ # If PACKIT_COPR_RPMS is not defined it means we are running the test
289+ # locally so we will build and install the RPMs from the *committed* code
290+ # or from a compose if USE_COMPOSE environment variable is "true"
291+ if [ " ${USE_COMPOSE:- false} " == " true" ] ; then
292+ install_from_compose ${go_fdo_server_rpms}
293+ else
294+ commit=" $( git rev-parse --short HEAD) "
295+ rpm -q go-fdo-server | grep -q " go-fdo-server.*git${commit} .*" || {
296+ make rpm
297+ sudo dnf install -y rpmbuild/rpms/{noarch," $( uname -m) " }/* git" ${commit} " * .rpm
298+ }
299+ fi
245300 fi
246301 # Make sure the RPMS are installed
247- installed_rpms=$( rpm -q --qf " %{nvr}.%{arch} " go-fdo-server{,-{manufacturer,owner,rendezvous} })
302+ installed_rpms=$( rpm -q --qf " %{nvr}.%{arch} " ${go_fdo_server_rpms })
248303 log_info " Installed Server RPMs:"
249304 for i in ${installed_rpms} ; do
250305 echo " ⚙ $i "
251306 done | sort
307+ sudo chmod o+rX /etc/pki/go-fdo-server/
252308}
253309
254310uninstall_server () {
255- [ -v " PACKIT_COPR_RPMS" ] || sudo dnf remove -y go-fdo-server{,-manufacturer,-owner,-rendezvous }
311+ [ -v " PACKIT_COPR_RPMS" ] || sudo dnf remove -y ${go_fdo_server_rpms }
256312}
257313
258314start_service_manufacturer () {
0 commit comments