From b8b00c0fadb0602ed8094d86de16cdf647243221 Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Mon, 8 Jun 2015 11:18:39 -0400 Subject: jenkins job builder yaml fix for dist-5E-eso, don't need variant. include eso-rhel-7-candidate.json ignore config.ini --- .gitignore | 1 + restraint/config/dist-5E-eso.json | 1 - restraint/config/eso-rhel-7-candidate.json | 24 ++ restraint/config/kgtt-restraint.yaml | 357 +++++++++++++++++++++++++++++ 4 files changed, 382 insertions(+), 1 deletion(-) create mode 100644 restraint/config/eso-rhel-7-candidate.json create mode 100644 restraint/config/kgtt-restraint.yaml diff --git a/.gitignore b/.gitignore index 36527e4..eb73e14 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ taskrepo.db +config.ini diff --git a/restraint/config/dist-5E-eso.json b/restraint/config/dist-5E-eso.json index dc6e20c..64fece7 100644 --- a/restraint/config/dist-5E-eso.json +++ b/restraint/config/dist-5E-eso.json @@ -10,7 +10,6 @@ "family": "RedHatEnterpriseLinuxServer5", "tag": ["RELEASED"], "arch": "X86_64", - "variant": "Server", "hostrequire": [], "bkr_data": { "role": "Standalone", diff --git a/restraint/config/eso-rhel-7-candidate.json b/restraint/config/eso-rhel-7-candidate.json new file mode 100644 index 0000000..66182bd --- /dev/null +++ b/restraint/config/eso-rhel-7-candidate.json @@ -0,0 +1,24 @@ +{ + "resources": [ + { + "metadata": { + "username": "someuser", + "key": "somekey.pem" + }, + "recipesets": [ + { + "family": "RedHatEnterpriseLinux7", + "tag": ["RELEASED"], + "arch": "X86_64", + "variant": "Server", + "hostrequire": [], + "bkr_data": { + "role": "Standalone", + "name": "AppServer" + } + } + ], + "job_group": "ci-ops-central" + } + ] +} diff --git a/restraint/config/kgtt-restraint.yaml b/restraint/config/kgtt-restraint.yaml new file mode 100644 index 0000000..8e82211 --- /dev/null +++ b/restraint/config/kgtt-restraint.yaml @@ -0,0 +1,357 @@ +- defaults: + name: platform-ci-workflow-provision-teardown + description: | + Managed by Jenkins Job Builder. Do not edit via web. + + concurrent: true + scm: + - git: + url: 'https://code.engineering.redhat.com/gerrit/ci-ops-central' + branches: + - origin/master + basedir: ci-ops-central + - git: + url: 'https://code.engineering.redhat.com/gerrit/ci-ops-projex' + branches: + - origin/master + basedir: ci-ops-projex + - git: + url: 'https://code.engineering.redhat.com/gerrit/job-runner' + branches: + - origin/master + basedir: job-runner + - git: + url: 'http://git.engineering.redhat.com/git/users/bpeck/tests.git' + branches: + - origin/master + basedir: tests + wrappers: + - default-platform-ci-workflow-wrappers + +- defaults: + name: platform-ci-workflow-runtest + description: | + Managed by Jenkins Job Builder. Do not edit via web. + concurrent: true + scm: + - git: + url: 'https://code.engineering.redhat.com/gerrit/ci-ops-central' + branches: + - origin/master + basedir: ci-ops-central + - git: + url: 'http://git.app.eng.bos.redhat.com/git/ci-ops-projex.git' + branches: + - origin/master + basedir: ci-ops-projex + - git: + url: 'http://git.engineering.redhat.com/git/users/bpeck/tests.git' + branches: + - origin/master + basedir: tests + wrappers: + - default-platform-ci-workflow-wrappers + - default-platform-ci-workflow-build-timeout-wrapper + +- wrapper: + name: default-platform-ci-workflow-wrappers + wrappers: + - ansicolor + - workspace-cleanup + - timestamps + +- wrapper: + name: default-platform-ci-workflow-build-timeout-wrapper + wrappers: + - timeout: + timeout-var: 'BUILD_TIMEOUT' + fail: true + elastic-percentage: 150 + elastic-default-timeout: 90 + type: elastic + +- publisher: + name: default-platform-ci-workflow-publishers + publishers: + - email-ext: + recipients: $DEFAULT_RECIPIENTS + reply-to: $DEFAULT_REPLYTO + content-type: default + subject: $DEFAULT_SUBJECT + body: $DEFAULT_CONTENT + attach-build-log: false + always: true + unstable: true + first-failure: true + not-built: true + aborted: true + regression: true + failure: true + improvement: true + still-failing: true + success: true + fixed: true + still-unstable: true + pre-build: true + matrix-trigger: only-configurations + send-to: + - requester + - recipients + +- publisher: + name: default-platform-ci-workflow-runtest-publishers + publishers: + - xunit: + thresholdmode: 'number' + thresholds: + - failed: + unstable: 0 + unstablenew: 0 + failure: 0 + failurenew: 0 + - skipped: + unstable: 0 + unstablenew: 0 + failure: 0 + failurenew: 0 + types: + - junit: + pattern: '*.xml' + deleteoutput: false + +- job-template: + name: '{project}-1-brew-msg-trigger' + defaults: platform-ci-workflow-provision-teardown + node: master + triggers: + - ci-trigger: + jms-selector: 'CI_TYPE = ''brew-taskstatechange'' AND method = ''build'' AND package = ''restraint''' + builders: + - shell: | + #!/bin/bash + + # Set $KEYTAB and $PRINCIPAL up as global vars in Jenkins + kinit -k -t $KEYTAB $PRINCIPAL + + abcli repo --brew-taskid=$id | tail -1 | sed 's/\(.*\)$/AUTOBKR_REPO=\1/' >> $WORKSPACE/CI_MESSAGE_ENV.txt + + - inject: + properties-file: $WORKSPACE/CI_MESSAGE_ENV.txt + + + publishers: + - archive: + artifacts: '*.txt, *.json' + allow-empty: 'true' + - trigger-parameterized-builds: + - project: '{project}-2-provision' + current-parameters: true + condition: 'SUCCESS' + +- job-template: + name: '{project}-2-provision' + defaults: platform-ci-workflow-provision-teardown + node: master + retry-count: 3 + parameters: + - choice: + name: SITE + choices: + - qeos + - os1 + description: | + Site where to provision resources + builders: + - shell: | + #!/bin/bash + + export JSLAVENAME={jslavename} + # Provision Jenkins Slave + if [ "$JSLAVENAME" != "master" ] + then + $WORKSPACE/ci-ops-central/bootstrap/provision_jslave.sh --site=$SITE --project_defaults={project_defaults} \ + --topology=ci-ops-central/project/config/aio_jslave --ssh_keyfile={ssh_keyfile} \ + --jslavename={jslavename} --jslaveflavor={jslaveflavor} --jslaveimage={jslaveimage} \ + --jslave_execs={jslave_execs} --jslavecreate --resources_file={jslavename}.json + + TR_STATUS=$? + if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Provisioning\nSTATUS: $TR_STATUS"; exit 1; fi + fi + + # Provision Test Resources + $WORKSPACE/ci-ops-central/bootstrap/provision_resources.sh --site=$SITE --project_defaults={project_defaults} \ + --topology={topology_path}/${{target}} --ssh_keyfile={ssh_keyfile} --name={project} + + TR_STATUS=$? + + files=$(ls $WORKSPACE/*.slave 2>/dev/null) + if [ -e "$files" ] + then + cat $WORKSPACE/*.slave >> $WORKSPACE/RESOURCES.txt + fi + + if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Provisioning\nSTATUS: $TR_STATUS"; exit 1; fi + + - inject: + properties-file: $WORKSPACE/RESOURCES.txt + + publishers: + - archive: + artifacts: '*.txt, *.json' + allow-empty: 'true' + - trigger-parameterized-builds: + - project: '{project}-3-runtest' + current-parameters: true + condition: 'SUCCESS' + property-file: $WORKSPACE/RESOURCES.txt + fail-on-missing: true + - project: '{project}-4-teardown' + current-parameters: true + condition: 'UNSTABLE_OR_WORSE' + property-file: $WORKSPACE/RESOURCES.txt + fail-on-missing: true + +- job-template: + name: '{project}-3-runtest' + defaults: platform-ci-workflow-runtest + node: '{jslavename}' + parameters: + - string: + name: JOBXMLTEMP + default: '{project}-sanity.xml' + description: | + Beaker job xml name + builders: + - copyartifact: + project: '{project}-2-provision' + filter: '*.txt, *.json' + target: $WORKSPACE + + - shell: | + #!/bin/bash + + export DEBUGLEVEL=DEBUG + echo "DEBUG: $DEBUGLEVEL" + + env + + export BKRID=$(echo ${{BKR_JOBID}} | awk -F: '{{print $2}}') + if ! [ -z ${{BKRID}} ] + then + echo "BKRID: ${{BKRID}}" + export UUID=${{BKRID}} + else + export UUID=$(uuidgen) + fi + + if [ -f $WORKSPACE/tests/restraint/config/${{JOBXMLTEMP}} ] ; then + cp $WORKSPACE/tests/restraint/config/${{JOBXMLTEMP}} $WORKSPACE/${{UUID}}_${{JOBXMLTEMP}} + export JOBXML=$WORKSPACE/${{UUID}}_${{JOBXMLTEMP}} + echo "JOBXML: ${{JOBXML}}" + sed -i "s/##PKGNAME##/${{name}}/g" ${{JOBXML}} + sed -i "s|##BASEURL##|${{AUTOBKR_REPO}}|g" ${{JOBXML}} + else + echo "Missing job xml" + exit 1 + fi + + #set PATH and PYTHONPATH + export PATH=$PATH:$PWD/qe-pit/pit/pitlib/scripts/ + env | grep PATH + export PYTHONPATH=$PWD/qe-pit/ + env | grep PYTHONPATH + + #run task runner to execute restraint + taskrunner -f $WORKSPACE/ci-ops-central/targets/restraint.py restraint_pipeline + rc=$? + if [ $rc -eq 0 ];then + echo "Platform Test Successful : " $rc + else + echo "Platform Test Failed : " $rc + exit $rc + fi + + echo "=====================================================" + echo + echo + + # Generate xUnit Results + for d in $(find . -type d -iname "${{UUID}}_*") ; do + echo "Processing results in $d" + xsltproc /usr/share/restraint/client/job2html.xml $d/job.xml > $d/index.html + xsltproc /usr/share/restraint/client/job2junit.xml $d/job.xml > $d/xUnit.xml + done + + publishers: + - archive: + artifacts: '**/**' + allow-empty: 'true' + - default-platform-ci-workflow-runtest-publishers + - trigger-parameterized-builds: + - project: '{project}-4-teardown' + current-parameters: true + +- job-template: + name: '{project}-4-teardown' + defaults: platform-ci-workflow-provision-teardown + node: master + builders: + - shell: | + #!/bin/bash + + export JSLAVETEARDOWN={jslaveteardown} + # Teardown Jenkins Slave + $WORKSPACE/ci-ops-central/bootstrap/teardown_resources.sh --site=$SITE --project_defaults={project_defaults} \ + --topology={topology_path}/${{target}} --name=$LABEL + + TR_STATUS=$? + if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Teardown\nSTATUS: $TR_STATUS"; exit 1; fi + + if [ "$JSLAVETEARDOWN" == "True" ] + then + $WORKSPACE/ci-ops-central/bootstrap/teardown_jslave.sh --site=$SITE --project_defaults={project_defaults} \ + --topology=ci-ops-central/project/config/aio_jslave --jslavename=$JSLAVENAME \ + --jslaveusername={jslaveusername} --jslavepassword={jslavepassword} --jslaveip=$JSLAVEIP --jslaveteardown + + TR_STATUS=$? + if [ "$TR_STATUS" != 0 ]; then echo "ERROR: Teardown\nSTATUS: $TR_STATUS"; exit 1; fi + fi + +- job-group: + name: platform-trigger-provision-runtest-teardown + jobs: + - '{project}-1-brew-msg-trigger' + - '{project}-2-provision' + - '{project}-3-runtest' + - '{project}-4-teardown' + +- project: + name: platform-jobs + project: + - restraint + project_defaults: + - ci-ops-projex/config/project_defaults + topology_path: + - tests/restraint/config + topology: + - bkr + ssh_keyfile: + - ci-ops-projex/config/keys/ci-ops-central + jobs: + - platform-trigger-provision-runtest-teardown + jslavename: + - ci-ops-{project} + jslave_execs: + - 10 + jslave_topology: + - restraint + jslaveimage: + - pit-slave-rhel-6.5-x86-64_rev3 + jslaveflavor: + - m1.large + jslaveusername: + - root + jslavepassword: + - redhat + jslaveteardown: + - False -- cgit