copr-be: copr-ping
This commit is contained in:
parent
33df23d457
commit
44c172c56e
5 changed files with 119 additions and 0 deletions
52
roles/copr/backend/files/copr-custom-script
Normal file
52
roles/copr/backend/files/copr-custom-script
Normal file
|
@ -0,0 +1,52 @@
|
|||
#! /bin/sh
|
||||
|
||||
cat <<EOF >copr-ping.spec
|
||||
%global _source_filedigest_algorithm md5
|
||||
|
||||
Name: copr-ping
|
||||
Version: $(date +"%Y%m%d_%H%M%S")
|
||||
Release: 1%{?dist}
|
||||
Summary: A dummy package
|
||||
|
||||
Group: NONE
|
||||
License: GPLv3+
|
||||
URL: http://example.com/
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} <= 5
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
%endif
|
||||
Source0: https://raw.githubusercontent.com/praiskup/quick-package/master/README.xz
|
||||
|
||||
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||
|
||||
%description
|
||||
Description for the %name package that is used for various testing tasks.
|
||||
|
||||
|
||||
%prep
|
||||
|
||||
|
||||
%build
|
||||
|
||||
|
||||
%install
|
||||
rm -rf \$RPM_BUILD_ROOT
|
||||
mkdir -p \$RPM_BUILD_ROOT/%{_pkgdocdir}
|
||||
xz -d %{SOURCE0} --stdout > \$RPM_BUILD_ROOT/%{_pkgdocdir}/README
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf \$RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%files
|
||||
%dir %{_pkgdocdir}
|
||||
%doc %{_pkgdocdir}/README
|
||||
|
||||
%changelog
|
||||
* Thu Jun 05 2014 Pavel Raiskup <praiskup@redhat.com> - 0-1
|
||||
- does nothing!
|
||||
EOF
|
||||
|
||||
echo "DOES NOTHING" > README
|
||||
xz README
|
20
roles/copr/backend/files/setup-copr-project.sh
Executable file
20
roles/copr/backend/files/setup-copr-project.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Execute this (on your box) to setup the package on the Copr side
|
||||
|
||||
script=$(readlink -f "$(dirname "$0")")/copr-custom-script
|
||||
|
||||
project=@copr/copr-ping
|
||||
pkgname=copr-ping
|
||||
|
||||
build_deps=()
|
||||
copr_cmd=(
|
||||
copr edit-package-custom "$project" \
|
||||
--webhook-rebuild on \
|
||||
--script "$script" \
|
||||
--script-chroot "fedora-latest-x86_64" \
|
||||
--script-builddeps "${build_deps[*]}"
|
||||
--max-builds 10
|
||||
)
|
||||
|
||||
"${copr_cmd[@]}" --name "$pkgname"
|
37
roles/copr/backend/tasks/copr-ping.yml
Normal file
37
roles/copr/backend/tasks/copr-ping.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- set_fact:
|
||||
ping_user: copr-ping
|
||||
ping_script: /home/copr-ping/ping-copr.sh
|
||||
tags: copr_ping
|
||||
|
||||
- name: create the user ping user
|
||||
user: name={{ ping_user }}
|
||||
tags: copr_ping
|
||||
|
||||
- stat: "{{ ping_script }}"
|
||||
register: script_stat
|
||||
tags: copr_ping
|
||||
|
||||
- name: install a stub script
|
||||
copy:
|
||||
dest: "{{ ping_script }}"
|
||||
content: |
|
||||
\#! /bin/bash
|
||||
\# Rebuild the testing package to check that Copr stack is up&running
|
||||
curl -X POST https://copr.fedorainfracloud.org/webhooks/custom/47259/<secret>/copr-ping/
|
||||
\# you also need to configure ~/.config/copr file for 'bot-copr-ping' user
|
||||
\# for the {{ env }} environment!
|
||||
owner: "{{ ping_user }}"
|
||||
group: "{{ ping_user }}"
|
||||
mode: 0700
|
||||
tags: copr_ping
|
||||
when: not script_stat.exists
|
||||
|
||||
- name: rebuild the copr-ping package periodically
|
||||
ansible.builtin.cron:
|
||||
name: build the ping package
|
||||
minute: "0,30"
|
||||
hour: "*"
|
||||
user: copr-ping
|
||||
job: "{{ ping_script }}"
|
||||
tags: copr_ping
|
|
@ -353,3 +353,7 @@
|
|||
tags:
|
||||
- config
|
||||
- aws_config
|
||||
|
||||
- name: copr-ping-account
|
||||
import_tasks: copr-ping.yml
|
||||
tags: copr_ping
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
define service {
|
||||
hostgroup_name copr_back_aws, copr_back_dev_aws
|
||||
service_description Copr ping package builds (that chould always succeed)
|
||||
check_command check_by_nrpe!check_disk_/var/lib/copr/public_html
|
||||
use disktemplate
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue