Commit 11a7398b authored by Ricardo Araujo's avatar Ricardo Araujo Committed by Ricardo Araujo
Browse files

Update tools

parent 4fb0c7d7
......@@ -40,11 +40,6 @@ export IMAGE_NAME=${IMAGE_NAME:-devstack-gate}
export NODEPOOL_SCRIPTDIR=${NODEPOOL_SCRIPTDIR:-nodepool/scripts}
export EXTRA_ELEMENTS=${EXTRA_ELEMENTS:-}
## Test your changes to system-config by overriding this; note you can
## get a CONFIG_REF from gerrit should you have uploaded a change
# export CONFIG_SOURCE=${CONFIG_SOURCE:-https://git.openstack.org/openstack-infra/system-config}
# export CONFIG_REF=${CONFIG_REF:-refs/changes/12/123456/1
ZUUL_USER_SSH_PUBLIC_KEY=${ZUUL_USER_SSH_PUBLIC_KEY:-$HOME/.ssh/id_rsa.pub}
if [ ! -f ${ZUUL_USER_SSH_PUBLIC_KEY} ]; then
echo "Error: There is no SSH public key at: ${ZUUL_USER_SSH_PUBLIC_KEY}"
......@@ -52,10 +47,18 @@ if [ ! -f ${ZUUL_USER_SSH_PUBLIC_KEY} ]; then
exit 1
fi
## Several parts of infra node bringup require EPEL, but we don't want
## to introduce dependencies on it, so keep disabled.
if [[ ${DISTRO} == "centos-minimal" ]]; then
EXTRA_ELEMENTS+="epel "
export DIB_EPEL_DISABLED=1
fi
## If your firewall won't allow outbound DNS connections, you'll want
## to set these to local resolvers
# NODEPOOL_STATIC_NAMESERVER_V4=192.168.0.1
# NODEPOOL_STATIC_NAMESERVER_V6=2000::...
# export NODEPOOL_STATIC_NAMESERVER_V4=192.168.0.1
# export NODEPOOL_STATIC_NAMESERVER_V6=2000::...
## This will get dib to drop you into a shell on error, useful for debugging
# export break="after-error"
......@@ -75,6 +78,7 @@ fi
## - project: openstack-infra/project-config
## - project: openstack-infra/system-config
## - project: openstack-dev/devstack
## - project: openstack/tempest
# export DIB_CUSTOM_PROJECTS_LIST_URL='file:///tmp/custom_projects.yaml'
......@@ -85,12 +89,12 @@ fi
## password.
## defaults
## DIB_DEV_USER_USERNAME=devuser
## DIB_DEV_USER_AUTHORIZED_KEYS=$HOME/.ssh/id_rsa.pub
## export DIB_DEV_USER_USERNAME=devuser
## export DIB_DEV_USER_AUTHORIZED_KEYS=$HOME/.ssh/id_rsa.pub
# EXTRA_ELEMENTS+=devuser
# DIB_DEV_USER_PWDLESS_SUDO=1
# DIB_DEV_USER_PASSWORD=devuser
# export DIB_DEV_USER_PWDLESS_SUDO=1
# export DIB_DEV_USER_PASSWORD=devuser
## The list of elements below should match those configured
## in nodepool/nodepool.yaml
......@@ -102,8 +106,6 @@ disk-image-create -x --no-tmpfs -o $IMAGE_NAME \
openstack-repos \
nodepool-base \
cache-devstack \
cache-bindep \
growroot \
infra-package-needs \
stackviz \
$EXTRA_ELEMENTS
......@@ -121,6 +121,12 @@ def main():
(('astor', 'Astor', 'astra', 'Astra', 'astara'), 'Astara')
)
if description:
# newlines here mess up cgit "repo.desc
if '\n' in description:
found_errors += 1
print("ERROR: Descriptions should not contain newlines:")
print(' "%s"' % description)
for words, should_be in badwords:
for word in words:
# look for the bad word hanging out on it's own. Only
......@@ -203,10 +209,12 @@ def main():
# Check redundant groups entry:
# By default the groups entry is repo_name, no need to add this.
groups = p.get('groups')
if groups and len(groups) == 1 and groups[0] == repo_name:
storyboard = p.get('use-storyboard', False)
if (groups and len(groups) == 1 and groups[0] == repo_name
and not storyboard):
found_errors += 1
print("ERROR: Project %s has default groups entry, remove it" %
name)
print("ERROR: Non-StoryBoard project %s has default groups entry, "
"remove it" % name)
if found_errors:
print("Found %d error(s) in %s" % (found_errors, args.infile))
......
......@@ -16,9 +16,12 @@
import io
import glob
import requests
import sys
import voluptuous as v
import os_service_types
# The files uses YAML extensions like !include, therefore use the
# jenkins-job-builder yaml parser for loading.
from jenkins_jobs import local_yaml
......@@ -200,8 +203,56 @@ def _check_tox_builder(schema, entry):
return count
# The jobs for which the service type needs to be checked
_API_JOBS = ['install-guide-jobs', 'api-guide-jobs', 'api-ref-jobs']
def validate_service_types():
print("Validating Service Types")
print("========================")
count = 0
# Load the current service-type-authority data
service_types = os_service_types.ServiceTypes(session=requests.Session(),
only_remote=True)
# Load the project job definitions
with io.open('jenkins/jobs/projects.yaml', 'r', encoding='utf-8') as f:
file_contents = local_yaml.load(f.read())
for item in file_contents:
project = item.get('project', {})
for job in project.get('jobs', []):
for api_job in _API_JOBS:
if api_job not in job:
continue
proj_data = service_types.get_service_data_for_project(
project['name'])
if not proj_data:
print('ERROR: Found service type reference "{}" for {} in '
'{} but not in authority list {}'.format(
job[api_job]['service'],
api_job,
project['name'],
service_types.url))
count += 1
else:
actual = job[api_job]['service']
expected = proj_data['service_type']
if actual != expected:
print('ERROR: Found service "{}" for {} '
'in {} but expected "{}"'.format(
job[api_job]['service'],
api_job,
project['name'],
expected))
count += 1
print('Found {} errors in service type settings '
'in jenkins/jobs/projects.yaml\n'.format(
count))
return count
def check_all():
errors = validate_jobs()
errors = errors or validate_service_types() # skip if formatting errors
errors = check_alphabetical() or errors
if errors:
......
......@@ -40,6 +40,10 @@ def check_merge_template():
print("\nChecking for usage of merge template")
print("====================================")
for project in layout['projects']:
# TODO(jeblair): Temporarily (for the zuul v3 transition)
# disable this check for infra repos
if project['name'].startswith('openstack-infra'):
continue
if project['name'] == 'z/tempest':
continue
try:
......@@ -181,6 +185,10 @@ def check_empty_check():
print("====================================")
for project in layout['projects']:
# TODO(jeblair): Temporarily (for the zuul v3 transition)
# disable this check for infra repos
if project['name'].startswith('openstack-infra'):
continue
# z/tempest is a fake project with no check queue
if project['name'] == 'z/tempest':
continue
......@@ -199,6 +207,10 @@ def check_empty_gate():
print("====================================")
for project in layout['projects']:
# TODO(jeblair): Temporarily (for the zuul v3 transition)
# disable this check for infra repos
if project['name'].startswith('openstack-infra'):
continue
gate_jobs = collect_pipeline_jobs(project, 'gate')
if not gate_jobs:
print("Project %s has no gate jobs" % project['name'])
......@@ -235,6 +247,10 @@ def check_gerrit_zuul_projects():
print("===================================================")
for gp in gerrit_projects:
# TODO(jeblair): Temporarily (for the zuul v3 transition)
# disable this check for infra repos
if gp.startswith('openstack-infra'):
continue
# Check the gerrit config for a different acl file
acls = [ x['acl-config'] if 'acl-config' in x else None \
......@@ -290,9 +306,11 @@ def check_all():
errors = check_projects_sorted()
# ricardoas: we do not have merge jobs
# errors = check_merge_template() or errors
errors = check_formatting() or errors
errors = check_empty_check() or errors
# ricardoas: we do not have gate jobs
# errors = check_empty_gate() or errors
errors = check_mixed_noops() or errors
errors = check_gerrit_zuul_projects() or errors
......
#!/bin/bash -e
# Copyright (c) 2012, AT&T Labs, Yun Mao <yunmao@gmail.com>
# All Rights Reserved.
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# Licensed 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.
rm -fr .test
mkdir .test
cd .test
/usr/zuul-env/bin/zuul-cloner -m ../tools/run-compare-clonemap.yaml --cache-dir /opt/git git://git.openstack.org openstack-infra/jenkins-job-builder
cd jenkins-job-builder
# These are $WORKSPACE/.test/jenkins-job-builder/.test/...
mkdir -p .test/old/config
mkdir -p .test/old/out
mkdir -p .test/new/config
mkdir -p .test/new/out
cd ../..
GITHEAD=$(git rev-parse HEAD)
# First generate output from HEAD~1
git checkout HEAD~1
cp jenkins/jobs/* .test/jenkins-job-builder/.test/old/config
# Then use that as a reference to compare against HEAD
git checkout $GITHEAD
cp jenkins/jobs/* .test/jenkins-job-builder/.test/new/config
cd .test/jenkins-job-builder
tox -e compare-xml-old
tox -e compare-xml-new
diff -r -N -u .test/old/out .test/new/out
CHANGED=$? # 0 == same ; 1 == different ; 2 == error
echo
echo "You are in detached HEAD mode. If you are a developer"
echo "and not very familiar with git, you might want to do"
echo "'git checkout branch-name' to go back to your branch."
exit $CHANGED
#!/bin/bash -e
# Copyright 2013 OpenStack Foundation
#
# Licensed 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.
mkdir -p .test
cd .test
[ -d zuul ] || git clone https://git.openstack.org/openstack-infra/zuul --depth 1
[ -d jenkins-job-builder ] || git clone https://git.openstack.org/openstack-infra/jenkins-job-builder --depth 1
cd jenkins-job-builder
# These are $WORKSPACE/.test/jenkins-job-builder/.test/...
mkdir -p .test/new/config
mkdir -p .test/new/out
cd ../..
cp jenkins/jobs/* .test/jenkins-job-builder/.test/new/config
cd .test/jenkins-job-builder
tox -e compare-xml-new
cd ..
find jenkins-job-builder/.test/new/out/ -printf "%f\n" > job-list.txt
cd zuul
tox -e venv -- zuul-server -c etc/zuul.conf-sample -l ../../zuul/layout.yaml -t ../job-list.txt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment