system-config/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml

541 lines
14 KiB
YAML

- builder:
name: gerrit-git-prep
builders:
- shell: "/usr/local/jenkins/slave_scripts/gerrit-git-prep.sh https://review.openstack.org git://git.openstack.org"
- builder:
name: branch-git-prep
builders:
- shell: |
#!/bin/bash
export BRANCH={branch}
/usr/local/jenkins/slave_scripts/gerrit-git-prep.sh https://review.openstack.org git://git.openstack.org
- builder:
name: revoke-sudo
builders:
- shell: |
#!/bin/bash
if [ -f /etc/sudoers.d/jenkins-sudo ] ; then
sudo rm /etc/sudoers.d/jenkins-sudo
fi
- builder:
name: coverage
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-cover.sh"
- builder:
name: docs
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-docs.sh"
- builder:
name: maven-test
builders:
- shell: "mvn test -B"
- builder:
name: maven-package
builders:
- shell: "mvn package -B"
- builder:
name: gerrit-package
builders:
- shell: "/usr/local/jenkins/slave_scripts/package-gerrit.sh"
- builder:
name: gerrit-preclean
builders:
- shell: |
#!/bin/bash -xe
rm -fr ~/.m2
rm -fr ~/.java
./tools/version.sh --release
- builder:
name: gerrit-postrun
builders:
- shell: "./tools/version.sh --reset"
- builder:
name: bashate
builders:
- tox:
envlist: bashate
- builder:
name: pep8
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-pep8.sh"
- builder:
name: pylint
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-pylint.sh"
- builder:
name: npm-install
builders:
- shell: "sudo apt-get install -y nodejs npm"
- shell: "sudo ln /usr/bin/nodejs /usr/local/bin/node"
- builder:
name: uninstall-puppet
builders:
- shell: "sudo apt-get remove -y --purge puppet puppet-common"
- builder:
name: puppet-lint
builders:
- shell: |
if [ -f Modulefile ]; then
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
if [ -z "$MODULE" ]; then
echo "Module name not defined in Modulefile"
else
mkdir -p "$MODULE"
rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
cd "$MODULE"
fi
fi
if [ -f Gemfile ]; then
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
bundle install
bundle exec rake lint 2>&1
else
rake lint 2>&1
fi
- builder:
name: puppet-syntax
builders:
- shell: |
find . -iname *.pp | xargs puppet parser validate --modulepath=`pwd`/modules
for f in `find . -iname *.erb` ; do
erb -x -T '-' $f | ruby -c
done
- builder:
name: puppet-apply
builders:
- shell: "./test.sh"
- builder:
name: ruby-191-prep
builders:
- shell: |
#!/bin/bash -x
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 20
sudo update-alternatives --set ruby /usr/bin/ruby1.9.1
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.1 10
sudo update-alternatives --set gem /usr/bin/gem1.9.1
sudo gem update --no-rdoc --no-ri
- builder:
name: chef-bundler-prep
builders:
- shell: |
#!/bin/bash -x
mkdir -p .bundle
grep -E .*berkshelf.*3\.\d*\.\d*.* Gemfile
if [ $? -eq 0 ]; then
# For Berkshelf 3.x use the system gecode 3.x libraries
sudo apt-get install -y libgecode-dev
USE_SYSTEM_GECODE=1 bundle install --path=.bundle --jobs 1 --retry 3 --verbose
else
bundle install --path=.bundle --jobs 1 --retry 3 --verbose
fi
- builder:
name: chef-berkshelf-prep
builders:
- shell: |
#!/bin/bash -x
grep -E .*berkshelf.*3\.\d*\.\d*.* Gemfile
if [ $? -eq 0 ]; then
bundle exec berks vendor .cookbooks
else
mkdir -p .cookbooks
bundle exec berks install --path=.cookbooks
fi
COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\')
if [ -z $COOKBOOK ]; then
echo "Cookbook name not defined in metadata.rb"
exit 1
fi
- builder:
name: chef-cookbook-rubocop
builders:
- shell: |
#!/bin/bash -x
if grep rubocop: Strainerfile; then
bundle exec strainer test --cookbooks-path=.cookbooks --only=rubocop
else
bundle exec rubocop
fi
- builder:
name: chef-cookbook-foodcritic
builders:
- shell: |
#!/bin/bash -x
if grep foodcritic: Strainerfile; then
bundle exec strainer test --cookbooks-path=.cookbooks --only=foodcritic
else
bundle exec foodcritic -f any -t ~FC003 -t ~FC023 .
fi
- builder:
name: chef-cookbook-chefspec
builders:
- shell: |
#!/bin/bash -x
COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\')
if grep chefspec: Strainerfile; then
bundle exec strainer test --cookbooks-path=.cookbooks --only=chefspec
else
bundle exec rspec .cookbooks/$COOKBOOK/spec
fi
- builder:
name: run-tests
builders:
- shell: "./run-tests.sh"
- builder:
name: selenium
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-selenium.sh"
- builder:
name: js-build
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-jsbuild.sh {command}"
- builder:
name: python26
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh 26"
- builder:
name: python27
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh 27"
- builder:
name: python33
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh 33"
- builder:
name: python34
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh 34"
- builder:
name: pypy
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh py"
- builder:
name: tox
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-tox.sh {envlist}"
- builder:
name: unittests
builders:
# NOTE(harlowja): the 'py' prefix will be added on automatically to the
# {envlist} by the internals of the run-unittests.sh script (so make
# sure you don't include it yourself).
- shell: "/usr/local/jenkins/slave_scripts/run-unittests.sh {envlist}"
- builder:
name: assert-no-extra-files
builders:
- shell: |
#!/bin/bash
OUT=`git ls-files --other --exclude-standard --directory`
if [ -z "$OUT" ]; then
echo "No extra files created during test."
exit 0
else
echo "The following un-ignored files were created during the test:"
echo "$OUT"
exit 0 # TODO: change to 1 to fail tests.
fi
- builder:
name: tarball
builders:
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/run-tarball.sh
/usr/local/jenkins/slave_scripts/run-wheel.sh
- builder:
name: devstack-checkout
builders:
- shell: |
#!/bin/bash -xe
if [[ ! -e devstack-gate ]]; then
git clone git://git.openstack.org/openstack-infra/devstack-gate
else
cd devstack-gate
git remote set-url origin git://git.openstack.org/openstack-infra/devstack-gate
git remote update
git reset --hard
if ! git clean -x -f ; then
sleep 1
git clean -x -f
fi
git checkout master
git reset --hard remotes/origin/master
if ! git clean -x -f ; then
sleep 1
git clean -x -f
fi
cd ..
fi
- builder:
name: experimental-devstack-checkout
builders:
- shell: |
#!/bin/bash -xe
if [[ ! -e devstack-gate ]]; then
git clone git://git.openstack.org/openstack-infra/devstack-gate
fi
cd devstack-gate
/usr/local/jenkins/slave_scripts/gerrit-git-prep.sh https://review.openstack.org git://git.openstack.org
cd ..
- builder:
name: link-logs
builders:
- shell: |
#!/bin/sh
echo "Detailed logs: http://logs.openstack.org/$LOG_PATH/"
- builder:
name: net-info
builders:
- shell: |
#!/bin/sh
export PATH=$PATH:/sbin
echo "Network interface addresses..."
ip address show
echo "Network routing tables..."
ip route show
ip -6 route show
echo "Network neighbors..."
ip neighbor show
- builder:
name: install-buck
builders:
- shell: |
#!/bin/bash -xe
if [[ ! -d "buck" ]]
then
git clone https://gerrit.googlesource.com/buck
cd buck
ant
fi
- builder:
name: zuul_swift_upload
builders:
- shell: "/usr/local/jenkins/slave_scripts/zuul_swift_upload.py --name {zuul_log_instruction_set} {upload_source}"
- builder:
name: zuul_swift_upload_logs
builders:
- zuul_swift_upload:
zuul_log_instruction_set: logs
upload_source: '{upload_source}'
- builder:
name: zuul_swift_upload_console_log
builders:
- shell: "/usr/local/jenkins/slave_scripts/grab_console_log.sh"
- zuul_swift_upload_logs:
upload_source: '/tmp/console.txt'
- builder:
name: zuul_swift_upload_logs_with_console
builders:
- shell: "/usr/local/jenkins/slave_scripts/grab_console_log.sh"
- zuul_swift_upload_logs:
upload_source: '{upload_source} /tmp/console.txt'
# ======================================================================
- wrapper:
name: build-timeout
wrappers:
- timeout:
timeout: '{timeout}'
timeout-var: 'BUILD_TIMEOUT'
fail: true
# ======================================================================
- publisher:
name: tarball
publishers:
- archive:
artifacts: 'dist/*.tar.gz'
- scp:
site: '{site}'
files:
- target: 'tarballs/{project}/'
source: 'dist/*.tar.gz'
- publisher:
name: wheel
publishers:
- archive:
artifacts: 'dist/*.whl'
- scp:
site: '{site}'
files:
- target: 'tarballs/{project}/'
source: 'dist/*.whl'
- publisher:
name: war
publishers:
- archive:
artifacts: '{warfile}'
- scp:
site: '{site}'
files:
- target: '{target}'
source: '{warfile}'
- publisher:
name: console-log
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
copy-console: true
copy-after-failure: true
- publisher:
name: devstack-logs
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'logs/**'
keep-hierarchy: true
copy-after-failure: true
- publisher:
name: coverage-log
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'cover/**'
keep-hierarchy: true
copy-after-failure: true
- publisher:
name: coverage-log-ruby
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'coverage/**'
keep-hierarchy: true
copy-after-failure: true
- publisher:
name: test-results
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: '**/*nose_results.html'
keep-hierarchy: false
copy-after-failure: true
- target: 'logs/$LOG_PATH'
source: '**/*testr_results.html.gz'
keep-hierarchy: false
copy-after-failure: true
- target: 'logs/$LOG_PATH'
source: '.testrepository/tmp*'
keep-hierarchy: false
copy-after-failure: true
- target: 'logs/$LOG_PATH'
source: '**/*subunit_log.txt.gz'
keep-hierarchy: false
copy-after-failure: true
- target: 'logs/$LOG_PATH/tox'
source: '.tox/*/log/*'
keep-hierarchy: false
copy-after-failure: true
- publisher:
name: upload-sphinx-draft
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'docs-draft/$LOG_PATH'
source: 'doc/build/html/**'
keep-hierarchy: true
copy-after-failure: true
- publisher:
name: upload-docs-draft
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'docs-draft/$LOG_PATH/'
source: 'publish-docs/**'
keep-hierarchy: true
copy-after-failure: true
- publisher:
name: upload-to-docs-site
publishers:
- ftp:
site: docs.openstack.org
source: 'publish-docs/**'
target: '/'
remove-prefix: 'publish-docs/'
- publisher:
name: upload-doc-build-results
publishers:
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'build-*.log.gz'
keep-hierarchy: false
copy-after-failure: true