summaryrefslogtreecommitdiffstats
path: root/scripts/create_beaker_job
blob: f7602dcdd00f66725da5ac21fcba8d6d354b0233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh

### Exit if there not enough parameters specified.
if [ $# -lt 2 ];
then
  echo "Usage: ./create-beaker-job-xml unique_identifier Job_xml_config_file [--submit-job]"
  exit -1
fi

user_id=$1
### Directory with all the compose scripts
COMPOSE_DIR=`dirname $0 | cd ; pwd`

PKI_SOURCE_DIR=`cd $COMPOSE_DIR/..; pwd`

WORK_DIR=`cd $COMPOSE_DIR/../..;pwd`

BUILD_DIR="$WORK_DIR/package.tests"

if [ ! -d $BUILD_DIR ] ; then
    mkdir $BUILD_DIR
fi

cd $BUILDDIR

cp -r $PKI_SOURCE_DIR/tests .

cd tests/dogtag

sed -e "s|PKI_TEST_USER_ID|${user_id}|g"  beakerjob.dogtag.xml.template >> beakerjob.dogtag.xml

python update_beaker_job.py beakerjob.dogtag.xml $2

if [ $# -gt 2 ];
then
    if [ $3 = "--submit-job" ]
    then
        bkr job-submit beakerjob.dogtag.xml
    fi
fi

mv beakerjob.dogtag.xml ../../