You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2022/02/23 21:39:42 UTC

[allura] 05/07: python3.7 - update jenkins script to use docker-compose

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit b372805d742fa326861ebed73b6e229ec054e25b
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Thu Feb 17 11:34:33 2022 -0500

    python3.7 - update jenkins script to use docker-compose
---
 scripts/jenkins-python3.7.sh | 124 ++++++++++++++++++++++++++-----------------
 1 file changed, 75 insertions(+), 49 deletions(-)

diff --git a/scripts/jenkins-python3.7.sh b/scripts/jenkins-python3.7.sh
old mode 100644
new mode 100755
index e2243d4..1cf4217
--- a/scripts/jenkins-python3.7.sh
+++ b/scripts/jenkins-python3.7.sh
@@ -1,72 +1,98 @@
 #!/bin/bash
 # need to specify the shell, else Jenkins will quit after the first non-zero exit
 
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+IMAGE_TAG=allura
+
+echo
+echo "============================================================================="
+echo "Jenkins Host Info:"
+echo "============================================================================="
 echo -n 'cpu count: '; grep -c processor /proc/cpuinfo 
-echo python path: `which python; python -V`
-echo python3 path: `which python3; python3 -V`
-echo python3.7 path: `which python3.7;`
+echo hostname: `hostname --short`
+echo NODE_NAME: $NODE_NAME
 echo path: $PATH
 echo workspace: $WORKSPACE
 echo jenkins_home: $JENKINS_HOME
 echo home: $HOME
 echo pwd: `pwd`
-echo REBUILD_VENV: $REBUILD_VENV
-echo LANG: $LANG
 env
-git --version
-svn --version
-echo pip: `pip3 --version`
-echo npm: `npm --version`
-
-rm -rf ".allura-venv"
-
-# ubuntu "python3-venv" isn't installed, so can't do the simple approach, instead use full "virtualenv" package
-#  python3 -m venv .allura-venv || exit
-pip3 install --user virtualenv || exit  # TODO: upgrade it?  seeing 15.x and 20.x
-echo virtualenv 3: `python3 -m virtualenv --version`
-# `python3 -m virtualenv` can sometimes default to using the py2 binary (weird!) so be explicit:
-python3 -m virtualenv --python `which python3` .allura-venv || exit
-
-. .allura-venv/bin/activate || exit
 
+echo
+echo "============================================================================="
+echo "Run: cleanup previous runs"
+echo "============================================================================="
+rm -rf ./allura-data
 git clean -f -x  # remove test.log, nosetest.xml etc (don't use -d since it'd remove our venv dir)
 
-echo venv-pip: `pip --version`
-pip --version | grep 'python 3' || exit  # ensure on py3
-
-# retry a few times
-# MAIN_PIP="pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed"
-MAIN_PIP="pip install -r requirements.txt --upgrade --upgrade-strategy=only-if-needed"
-$MAIN_PIP || (echo "retrying pip install after short sleep"; sleep 2; $MAIN_PIP) || exit
-
-pip install pycodestyle pyflakes coverage nose nose-xunitmp --no-deps --upgrade --upgrade-strategy=only-if-needed || exit
-
-# handy script to download, compile, and install pysvn
-curl https://raw.githubusercontent.com/reviewboard/pysvn-installer/master/install.py | python
+echo
+echo "============================================================================="
+echo "Run: build docker image"
+echo "============================================================================="
+docker-compose build
+
+echo
+echo "============================================================================="
+echo "Docker Container Info:"
+echo "============================================================================="
+docker-compose run web bash -c '
+echo python path: `which python; python -V`;
+echo python3.7 path: `which python3.7; python3.7 -V`;
+git --version;
+svn --version;
+echo pip: `pip3 --version`;
+echo npm: `npm --version`;'
+
+echo
+echo "============================================================================="
+echo "Setup: venv, pip, pysvn, ./rebuild-all.sh, npm, etc."
+echo "============================================================================="
+docker-compose run web scripts/init-docker-dev.sh
+
+echo
+echo "============================================================================="
+echo "Setup: tests"
+echo "============================================================================="
+# set up test dependencies
+docker-compose run web pip install -r requirements-dev.txt
+
+echo
+echo "============================================================================="
+echo "Run: tests"
+echo "============================================================================="
 
 # use "Allura* Forge* scripts" instead of "." so that .allura-venv doesn't get checked too (and '.' gives './' prefixed results which don't work out)
-pyflakes Allura* Forge* scripts | awk -F\: '{printf "%s:%s: [E]%s\n", $1, $2, $3}' > pyflakes.txt
-pycodestyle Allura* Forge* scripts > pep8.txt
-
-./rebuild-all.bash
-
-# fresh start with npm
-#rm -rf node_modules
-npm install || (echo "retrying npm install"; sleep 5; npm install) || (echo "retrying npm install"; sleep 5; npm install) || (echo "retrying npm install"; sleep 5; npm install) || (echo "retrying npm install"; sleep 5; npm install) || (echo "retrying npm install"; sleep 5; npm install) 
+docker-compose run web pyflakes Allura* Forge* scripts | awk -F\: '{printf "%s:%s: [E]%s\n", $1, $2, $3}' > pyflakes.txt
+docker-compose run web pycodestyle Allura* Forge* scripts > pep8.txt
 
 # TODO: ALLURA_VALIDATION=all
-LANG=en_US.UTF-8 ./run_tests --with-xunitmp # --with-coverage --cover-erase
+docker-compose run -e LANG=en_US.UTF-8 web ./run_tests --with-xunitmp # --with-coverage --cover-erase
 retcode=$?
 
 #find . -name .coverage -maxdepth 2 | while read coveragefile; do pushd `dirname $coveragefile`; coverage xml --include='forge*,allura*'; popd; done;
 
-rm -f call_count.csv
-./scripts/perf/call_count.py --data-file call_count.csv
-
-
-# debugging
-echo npm: `npm --version`
-echo hostname: `hostname --short`
-echo NODE_NAME: $NODE_NAME
+echo
+echo "============================================================================="
+echo "Shutdown"
+echo "============================================================================="
+docker-compose down
+docker container prune -f
+docker volume prune -f
 
 exit $retcode
\ No newline at end of file