From e18a1b966ece95fbc0ac9d641d02a224601148ea Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 14 2018 14:55:35 +0000 Subject: [PATCH 1/7] Adjust the cico.pipeline file to work as desired Signed-off-by: Pierre-Yves Chibon --- diff --git a/.cico.pipeline b/.cico.pipeline index 366146f..5031f27 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -25,7 +25,7 @@ node('pagure') { try { stage('Pre Setup Node'){ // Install EPEL - onmyduffynode 'yum -y install epel-release' + onmyduffynode 'yum -y install epel-release git' } stage('Clone Test Suite') { @@ -33,7 +33,7 @@ node('pagure') { } stage('Run Test Suite') { - timeout(6, 'HOURS') { + timeout(time: 6, unit: 'HOURS') { onmyduffynode 'cd pagure && sh ./run_ci_tests.sh' } } From 8f9296d1783f86dd37af37cc9d3507782f3aee70 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 14 2018 14:55:35 +0000 Subject: [PATCH 2/7] Adjust the run_ci_tests shell script to properly run in ci.centos.org Signed-off-by: Pierre-Yves Chibon --- diff --git a/run_ci_tests.sh b/run_ci_tests.sh index c2ff8d6..06e02e3 100755 --- a/run_ci_tests.sh +++ b/run_ci_tests.sh @@ -1,3 +1,10 @@ +yum install -y python-virtualenv \ + gcc python-cryptography \ + libgit2 python-pygit2 \ + redis swig openssl-devel m2crypto + +sysctl -w fs.file-max=2048 + set -e if [ -n "$REPO" -a -n "$BRANCH" ]; then @@ -16,30 +23,21 @@ git log -2 fi -DATE=`date +%Y%m%d` -HASH=`sha1sum requirements.txt | awk '{print $1}'` - -if [ ! -d pagureenv-$DATE-$HASH ]; -then - rm -rf pagureenv*; - virtualenv pagureenv-$DATE-$HASH --system-site-packages - source pagureenv-$DATE-$HASH/bin/activate - - pip install pip --upgrade - # Needed within the venv - pip install nose --upgrade - pip install --upgrade --force-reinstall python-fedora 'setuptools>=17.1' pygments - pip install -r tests_requirements.txt - pip install -r requirements-ev.txt # We have one test on the SSE server - sed -i -e 's|pygit2 >= 0.20.1||' requirements.txt - pip install -r requirements.txt - pip install psycopg2 - pip install python-openid python-openid-teams python-openid-cla - - pip uninstall cffi -y -else - source pagureenv-$DATE-$HASH/bin/activate -fi +virtualenv pagureenv --system-site-packages +source pagureenv/bin/activate + +pip install pip --upgrade +# Needed within the venv +pip install nose --upgrade +pip install --upgrade --force-reinstall python-fedora 'setuptools>=17.1' pygments +pip install -r tests_requirements.txt +pip install -r requirements-ev.txt # We have one test on the SSE server +sed -i -e 's|pygit2 >= 0.20.1||' requirements.txt +pip install -r requirements.txt +pip install psycopg2 +pip install python-openid python-openid-teams python-openid-cla + +# pip uninstall cffi -y trap deactivate SIGINT SIGTERM EXIT From 0befefa3b123c178ef0e7678be10ae2fb161f31c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 14 2018 14:55:35 +0000 Subject: [PATCH 3/7] Add missing dependency Signed-off-by: Pierre-Yves Chibon --- diff --git a/requirements.txt b/requirements.txt index b2a8708..7ab025b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ # Use this file by running "$ pip install -r requirements.txt" alembic arrow +bcrypt binaryornot bleach blinker From f850c456dad74161f81904087c3a4e3fdf93f8f7 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Mar 14 2018 14:55:35 +0000 Subject: [PATCH 4/7] pass the REPO and BRANCH parameters to the duffy node --- diff --git a/.cico.pipeline b/.cico.pipeline index 5031f27..5c35bd9 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -1,7 +1,7 @@ def onmyduffynode(script){ ansiColor('xterm'){ timestamps{ - sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t "' + script + '"' + sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t REPO=${REPO} BRANCH=${BRANCH} "' + script + '"' } } } @@ -12,6 +12,13 @@ def syncfromduffynode(rsyncpath){ node('pagure') { + properties([ + parameters([ + string(defaultValue: "", description: "", name: "REPO"), + string(defaultValue: "", description: "", name: "BRANCH"), + ]) + ]) + stage('Allocate Node'){ env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim() duffy_rtn=sh( From faedb1d6dcee5fd4e2456ef6faacaabeca20cc86 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 14 2018 14:57:26 +0000 Subject: [PATCH 5/7] Flake8 fix Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/api/project.py b/pagure/api/project.py index 6a48491..5e4e9c6 100644 --- a/pagure/api/project.py +++ b/pagure/api/project.py @@ -1307,6 +1307,7 @@ def api_new_branch(repo, username=None, namespace=None): jsonout = flask.jsonify(output) return jsonout + @API.route('//c//flag') @API.route('///c//flag') @API.route('/fork///c//flag') From d17173dd9999d35723c34afcc2491e9f6757598f Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Mar 14 2018 14:57:28 +0000 Subject: [PATCH 6/7] fix envvar in the clone step but PR don't have a BRANCH_NAME so user master Merges https://pagure.io/pagure/pull-request/3066 --- diff --git a/.cico.pipeline b/.cico.pipeline index 5c35bd9..ae00242 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -36,7 +36,11 @@ node('pagure') { } stage('Clone Test Suite') { - onmyduffynode "git clone -b \"${env.BRANCH_NAME}\" --single-branch --depth 1 https://pagure.io/pagure.git" + if (env.BRANCH_NAME){ + onmyduffynode "git clone -b \"${env.BRANCH_NAME}\" --single-branch --depth 1 https://pagure.io/pagure.git" + } else { + onmyduffynode "git clone --single-branch --depth 1 https://pagure.io/pagure.git" + } } stage('Run Test Suite') { From 62de457b90967c5735e46d37118241ebbea45584 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Mar 14 2018 14:57:28 +0000 Subject: [PATCH 7/7] sync the out files back into the jenkins workspace and archive them Merges https://pagure.io/pagure/pull-request/3065 --- diff --git a/.cico.pipeline b/.cico.pipeline index ae00242..1fdbfb7 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -53,8 +53,16 @@ node('pagure') { currentBuild.result = "FAILED" throw e } finally { + stage('Sync Artifacts'){ + syncfromduffynode('pagure/*.out') + } + stage('Deallocate Node'){ sh 'cico node done ${SSID}' } + + stage('Archive Artifacts'){ + archiveArtifacts artifacts: '*.out' + } } }