summaryrefslogtreecommitdiffstats
path: root/jjb/doctor
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2015-07-03 17:26:52 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-07-03 17:26:52 +0000
commitd96f2a6000e39a2ab5e725bd27736b9a58ca6288 (patch)
treec9e953a04065b2b4cb483b807f7a98b9a7b74d58 /jjb/doctor
parent2abed47474ad6a0da5f8740cc1127f82eae6ba75 (diff)
parente8dd11b81e3b20f68e47fce29a86e847e1d3560b (diff)
Merge "[doctor] upload docs built in verify jobs"
Diffstat (limited to 'jjb/doctor')
-rw-r--r--jjb/doctor/doctor.yml162
-rw-r--r--jjb/doctor/docu-build.sh57
-rwxr-xr-xjjb/doctor/docu-verify.sh7
-rwxr-xr-xjjb/doctor/t.sh9
4 files changed, 70 insertions, 165 deletions
diff --git a/jjb/doctor/doctor.yml b/jjb/doctor/doctor.yml
index 39c20dc54..8a140f48c 100644
--- a/jjb/doctor/doctor.yml
+++ b/jjb/doctor/doctor.yml
@@ -1,127 +1,42 @@
- project:
name: doctor
+ project: '{name}'
jobs:
- - 'doctor-test'
- - 'doctor-daily-{stream}'
- - 'doctor-merge'
- - 'doctor-verify'
+ - '{project}-verify'
+ - '{project}-merge-{stream}'
- # stream: branch with - in place of / (eg. stable-helium)
- # branch: branch (eg. stable/helium)
+ # stream: branch with - in place of / (eg. stable-arno)
+ # branch: branch (eg. stable/arno)
stream:
- master:
branch: 'master'
- project: 'doctor'
- somevar: 'foo'
-
-- job-template:
- name: doctor-test
-
+- job_defaults: &job_defaults
+ name: job_defaults
node: master
-
project-type: freestyle
-
- logrotate:
- daysToKeep: 30
- numToKeep: 10
- artifactDaysToKeep: -1
- artifactNumToKeep: -1
-
- builders:
- - shell: |
- echo "Hello world from doctor"
-
-- job-template:
- name: 'doctor-daily-{stream}'
-
- node: master
-
- # Job template for daily builders
- #
- # Required Variables:
- # stream: branch with - in place of / (eg. stable)
- # branch: branch (eg. stable)
-
- project-type: freestyle
- varsetabove: '{somevar}'
-
logrotate:
daysToKeep: '{build-days-to-keep}'
numToKeep: '{build-num-to-keep}'
artifactDaysToKeep: '{build-artifact-days-to-keep}'
artifactNumToKeep: '{build-artifact-num-to-keep}'
-
- parameters:
- - project-parameter:
- project: '{project}'
- - string:
- name: GIT_BASE
- default: 'https://gerrit.opnfv.org/gerrit/{project}'
- description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
-
- scm:
- - git-scm:
- credentials-id: '{ssh-credentials}'
- refspec: ''
- branch: '{branch}'
-
wrappers:
- ssh-agent-credentials:
- user: '{ssh-credentials}'
-
- triggers:
- - timed: 'H H * * *'
-
- prebuilders:
- - test-macro
-
- builders:
- - shell:
- !include-raw docu-build.sh
-
- postbuilders:
- - test-macro
+ users:
+ - '{ssh-credentials}'
- job-template:
- name: 'doctor-verify'
-
- node: master
-
- project-type: freestyle
-
- logrotate:
- daysToKeep: 30
- numToKeep: 10
- artifactDaysToKeep: -1
- artifactNumToKeep: -1
-
- parameters:
- - project-parameter:
- project: '{project}'
- - gerrit-parameter:
- branch: 'master'
- - string:
- name: GIT_BASE
- default: 'https://gerrit.opnfv.org/gerrit/{project}'
- description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
+ name: '{project}-verify'
+ <<: *job_defaults
scm:
- gerrit-trigger-scm:
credentials-id: '{ssh-credentials}'
refspec: '$GERRIT_REFSPEC'
choosing-strategy: 'gerrit'
-
- wrappers:
- - ssh-agent-credentials:
- user: '{ssh-credentials}'
-
triggers:
- gerrit:
trigger-on:
- - patchset-created-event:
- exclude-drafts: 'false'
- exclude-trivial-rebase: 'false'
- exclude-no-code-change: 'false'
+ - patchset-created-event
- draft-published-event
- comment-added-contains-event:
comment-contains-value: 'recheck'
@@ -129,52 +44,22 @@
comment-contains-value: 'reverify'
projects:
- project-compare-type: 'ANT'
- project-pattern: 'doctor'
+ project-pattern: '{project}'
branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/master'
-
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**'
builders:
- shell:
- !include-raw docu-verify.sh
+ !include-raw docu-build.sh
- job-template:
- name: 'doctor-merge'
-
- node: master
-
- # builder-merge job to run JJB update
- #
- # This job's purpose is to update all the JJB
-
- project-type: freestyle
-
- logrotate:
- daysToKeep: 30
- numToKeep: 40
- artifactDaysToKeep: -1
- artifactNumToKeep: 5
-
- parameters:
- - project-parameter:
- project: '{project}'
- - gerrit-parameter:
- branch: 'master'
- - string:
- name: GIT_BASE
- default: 'https://gerrit.opnfv.org/gerrit/{project}'
- description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
-
+ name: '{project}-merge-{stream}'
+ <<: *job_defaults
scm:
- gerrit-trigger-scm:
credentials-id: '{ssh-credentials}'
refspec: ''
choosing-strategy: 'default'
-
- wrappers:
- - ssh-agent-credentials:
- user: '{ssh-credentials}'
-
triggers:
- gerrit:
trigger-on:
@@ -183,17 +68,10 @@
comment-contains-value: 'remerge'
projects:
- project-compare-type: 'ANT'
- project-pattern: 'doctor'
+ project-pattern: '{project}'
branches:
- branch-compare-type: 'ANT'
- branch-pattern: '**/master'
-
+ branch-pattern: '**/{branch}'
builders:
- shell:
!include-raw docu-build.sh
-
-
-
-
-
-
diff --git a/jjb/doctor/docu-build.sh b/jjb/doctor/docu-build.sh
index 39ecf3bb0..fde367b4c 100644
--- a/jjb/doctor/docu-build.sh
+++ b/jjb/doctor/docu-build.sh
@@ -2,23 +2,48 @@
set -e
set -o pipefail
-build_dir="build"
-project="$(git remote -v | head -n1 | awk '{{print $2}}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')"
export PATH=$PATH:/usr/local/bin/
+echo
+echo "Build"
+echo "-----"
+echo
+
make
-# upload all built files
-files=(
- design_docs
- requirements/html
- requirements/latex/*.pdf
-)
-
-for file in "${{files[@]}}"; do
- gsutil cp -r -L gsoutput.txt $build_dir/$file gs://artifacts.opnfv.org/$project/
- #gsutil setmeta -h "Cache-Control:private, max-age=0, no-transform" \
- #-R gs://artifacts.opnfv.org/$project/$file
- cat gsoutput.txt
- rm -f gsoutput.txt
-done
+echo
+echo "Upload"
+echo "------"
+echo
+
+# NOTE: make sure source parameters for GS paths are not empty.
+[[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
+[[ $GERRIT_PROJECT =~ .+ ]]
+[[ $GERRIT_BRANCH =~ .+ ]]
+
+gs_path_review="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
+if [[ $GERRIT_BRANCH = "master" ]] ; then
+ gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT"
+else
+ gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT/${{GERRIT_BRANCH##*/}}"
+fi
+
+if [[ $JOB_NAME =~ "verify" ]] ; then
+ gsutil cp -r build/* "gs://$gs_path_review/"
+ echo
+ echo "Document is available at http://$gs_path_review"
+else
+ gsutil cp -r build/design_docs "gs://$gs_path_branch/"
+ gsutil cp -r build/html "gs://$gs_path_branch/"
+ gsutil cp -r build/latex/*.pdf "gs://$gs_path_branch/"
+ echo
+ echo "Document is available at http://$gs_path_branch"
+fi
+
+if [[ $GERRIT_EVENT_TYPE = "change-merged" ]] ; then
+ echo
+ echo "Clean Out-of-dated Documents"
+ echo "----------------------------"
+ echo
+ gsutil rm -r "gs://$gs_path_review" || true
+fi
diff --git a/jjb/doctor/docu-verify.sh b/jjb/doctor/docu-verify.sh
deleted file mode 100755
index 72d02cfe2..000000000
--- a/jjb/doctor/docu-verify.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-set -e
-set -o pipefail
-
-export PATH=$PATH:/usr/local/bin/
-
-make
diff --git a/jjb/doctor/t.sh b/jjb/doctor/t.sh
new file mode 100755
index 000000000..3005c6d15
--- /dev/null
+++ b/jjb/doctor/t.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+set -o pipefail
+
+
+[[ $GERRIT_CHANGE_NUMBER =~ .* ]]
+
+
+echo "done"