diff --git a/jenkins_job_builder/publisher.yaml b/jenkins_job_builder/publisher.yaml new file mode 100644 index 00000000..bcbdb8a9 --- /dev/null +++ b/jenkins_job_builder/publisher.yaml @@ -0,0 +1,25 @@ +- job-template: + name: 'daily-log-publisher-{lab}' + defaults: global + builders: + - shell: | + git clone https://git.openstack.org/openstack/sahara-ci-config + ./$WORKSPACE/sahara-ci-config/slave-scripts/publish-logs.sh + triggers: + - timed: '50 5 * * *' + publishers: + - workspace-cleanup: + clean-if: + - success: true + - not-built: true + - aborted: true + node: 'lab-{lab}' + + +- project: + name: publisher + lab: + - 42 + - 43 + jobs: + - 'daily-log-publisher-{lab}' diff --git a/slave-scripts/publish-logs.sh b/slave-scripts/publish-logs.sh new file mode 100755 index 00000000..26f17e97 --- /dev/null +++ b/slave-scripts/publish-logs.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +dir_name=$(date '+%d-%b-%Y') +lab=$(echo $JOB_NAME | awk -F '-' '{ print $4 }') + +echo "Moving logs to the https://sahara-ci-reports.mirantis.com" +rsync -e "ssh -i /home/jenkins/.ssh/rsync_key" -avz /opt/stack/logs/ ubuntu@172.18.180.78:/var/www/html/devstack/$lab/$dir_name