Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Colas Pomies
LbNightlyTools
Commits
2b010853
Commit
2b010853
authored
Apr 24, 2015
by
cpomies
Browse files
Added scripts for check precondtions
parent
d4c44a15
Changes
5
Hide whitespace changes
Inline
Side-by-side
jenkins/check_preconditions.sh
0 → 100755
View file @
2b010853
#!/bin/bash
###############################################################################
# (c) Copyright 2013 CERN #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
# hack because of a bug with non-writable home (this script is run by tomcat)
export
HOME
=
$PWD
# Set common environment
.
$(
dirname
$0
)
/common.sh
export
CMTCONFIG
=
$platform
lbn-check-preconditions
--verbose
${
config_file
}
jenkins/preconditions.sh
View file @
2b010853
...
...
@@ -18,4 +18,4 @@ export HOME=$PWD
export
CMTCONFIG
=
$platform
lbn-
check-
preconditions
--verbose
${
config_file
}
lbn-preconditions
--verbose
${
config_file
}
python/LbNightlyTools/CheckSlotPreconditions.py
0 → 100644
View file @
2b010853
###############################################################################
# (c) Copyright 2013 CERN #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
from
platform
import
platform
'''
Module containing the classes and functions used to check if a slot have
preconditions and write files with parameters for next jobs in Jenkins
'''
__author__
=
'Colas Pomies <colas.pomies@cern.ch>'
import
os
from
LbNightlyTools.Configuration
import
load
from
LbNightlyTools.Utils
import
JobParams
def
parseConfigFile
(
path
):
'''
Extract required information from the configuration file.
'''
data
=
load
(
path
)
return
data
.
get
(
u
'preconditions'
,
[])
import
LbUtils.Script
class
Script
(
LbUtils
.
Script
.
PlainScript
):
'''
Script to Check.
The configuration file must be in JSON format containing an object with the
attribute 'projects', a list of objects with defining the projects to be
checked out.
For example::
{"preconditions": [{"name": "waitForFile",
"args": {"path": "path/to/file"}}]}
'''
__usage__
=
'%prog [options] <config.json>'
__version__
=
''
def
main
(
self
):
'''
Script main function.
'''
if
len
(
self
.
args
)
!=
1
:
self
.
parser
.
error
(
'wrong number of arguments'
)
data
=
load
(
self
.
args
[
0
])
preconds
=
data
.
get
(
u
'preconditions'
,
[])
if
preconds
:
output_file
=
'slot-precondition-{0}-{1}.txt'
else
:
output_file
=
'slot-build-{0}-{1}.txt'
if
os
.
environ
.
has_key
(
'platforms'
)
and
os
.
environ
[
'platforms'
]
!=
''
:
platforms
=
os
.
environ
[
'platforms'
].
split
()
else
:
platforms
=
data
.
get
(
u
'default_platforms'
,
[])
for
platform
in
platforms
:
os_label
=
platform
.
split
(
'-'
)[
1
]
output_file_name
=
output_file
.
format
(
os
.
environ
[
'slot'
],
platform
)
open
(
output_file_name
,
'w'
)
\
.
write
(
str
(
JobParams
(
slot
=
os
.
environ
[
'slot'
],
slot_build_id
=
os
.
environ
[
'slot_build_id'
],
platform
=
platform
,
os_label
=
os_label
,
))
+
'
\n
'
)
self
.
log
.
debug
(
'%s written'
,
output_file_name
)
return
0
scripts/lbn-check-preconditions
View file @
2b010853
...
...
@@ -12,6 +12,6 @@
import
LbUtils.Log
LbUtils
.
Log
.
_default_log_format
=
'%(asctime)s:'
+
LbUtils
.
Log
.
_default_log_format
from
LbNightlyTools.SlotPreconditions
import
Script
from
LbNightlyTools.
Check
SlotPreconditions
import
Script
import
sys
sys
.
exit
(
Script
().
run
())
scripts/lbn-preconditions
0 → 100755
View file @
2b010853
#!/usr/bin/env python
###############################################################################
# (c) Copyright 2013 CERN #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
import
LbUtils.Log
LbUtils
.
Log
.
_default_log_format
=
'%(asctime)s:'
+
LbUtils
.
Log
.
_default_log_format
from
LbNightlyTools.SlotPreconditions
import
Script
import
sys
sys
.
exit
(
Script
().
run
())
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment