Adding of layout and jjb jobs compatibility job
Added check for availability all jobs from layout in jjb Change-Id: I3e47bff5fe56bdc40712dcee33f609ee8b481d23
This commit is contained in:
parent
b19f95d0e9
commit
32e68055e6
@ -145,10 +145,11 @@ projects:
|
|||||||
- dib-storm_1.0.1-u14-aio
|
- dib-storm_1.0.1-u14-aio
|
||||||
- dib-ambari_2.2-c7
|
- dib-ambari_2.2-c7
|
||||||
- dib-ambari_2.2-u14
|
- dib-ambari_2.2-u14
|
||||||
|
|
||||||
- name: openstack/sahara-ci-config
|
- name: openstack/sahara-ci-config
|
||||||
check:
|
check:
|
||||||
- sahara-ci-syntax-check
|
- sahara-ci-syntax-check
|
||||||
|
- sahara-ci-layout
|
||||||
|
|
||||||
- name: openstack/heat
|
- name: openstack/heat
|
||||||
noop:
|
noop:
|
||||||
|
55
host-scripts/check_layout.py
Normal file
55
host-scripts/check_layout.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
layout = yaml.load(open(sys.argv[1]))
|
||||||
|
|
||||||
|
|
||||||
|
def grep(source, pattern):
|
||||||
|
found = False
|
||||||
|
p = re.compile(pattern)
|
||||||
|
for line in source:
|
||||||
|
if p.match(line):
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
return found
|
||||||
|
|
||||||
|
|
||||||
|
def get_pipelines():
|
||||||
|
pipelines = []
|
||||||
|
for pipeline in layout['pipelines']:
|
||||||
|
pipelines.append(pipeline['name'])
|
||||||
|
return pipelines
|
||||||
|
|
||||||
|
|
||||||
|
def check_jobs():
|
||||||
|
errors = False
|
||||||
|
|
||||||
|
pipelines = get_pipelines()
|
||||||
|
|
||||||
|
job_list_file = sys.argv[2]
|
||||||
|
if not os.path.isfile(job_list_file):
|
||||||
|
print("Job list file %s does not exist, not checking jobs section"
|
||||||
|
% job_list_file)
|
||||||
|
return False
|
||||||
|
|
||||||
|
with open(job_list_file, 'r') as f:
|
||||||
|
job_list = [line.rstrip() for line in f]
|
||||||
|
|
||||||
|
for project in layout['projects']:
|
||||||
|
for pipeline in pipelines:
|
||||||
|
jobs = project.get(pipeline, [])
|
||||||
|
for job in jobs:
|
||||||
|
found = grep(job_list, job)
|
||||||
|
if not found:
|
||||||
|
print ("Regex %s has no matches in job list" % job)
|
||||||
|
errors = True
|
||||||
|
|
||||||
|
return errors
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(check_jobs())
|
9
host-scripts/check_layout.sh
Executable file
9
host-scripts/check_layout.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir out
|
||||||
|
jenkins-jobs test -o out/ $WORKSPACE/jenkins_job_builder/
|
||||||
|
|
||||||
|
|
||||||
|
find out/ -printf "%f\n" > job-list.txt
|
||||||
|
|
||||||
|
python $WORKSPACE/host-scripts/check_layout.py $WORKSPACE/config/zuul/layout.yaml job-list.txt
|
@ -71,6 +71,24 @@
|
|||||||
publishers:
|
publishers:
|
||||||
- console-log
|
- console-log
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: sahara-ci-layout
|
||||||
|
project-type: freestyle
|
||||||
|
defaults: global
|
||||||
|
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.\
|
||||||
|
\n<p>Please use this repository to make changes: <a href=\"https://git.openstack.org/openstack/sahara-ci-config\">https://git.openstack.org/openstack/sahara-ci-config</a></b>\
|
||||||
|
\n<p>This job check compatibility zuul layout and jobs from jjb"
|
||||||
|
disabled: false
|
||||||
|
concurrent: false
|
||||||
|
node: master
|
||||||
|
|
||||||
|
builders:
|
||||||
|
- gerrit-git-prep
|
||||||
|
- shell: "$WORKSPACE/host-scripts/check_layout.sh"
|
||||||
|
|
||||||
|
publishers:
|
||||||
|
- console-log
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: update-config
|
name: update-config
|
||||||
node: master
|
node: master
|
||||||
|
Loading…
Reference in New Issue
Block a user