3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Modifications copyright (c) 2017 AT&T Intellectual Property
18 # Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd.
19 # Modifications Copyright (C) 2021 Pantheon.tech
22 # Copy docker-compose.yml and application.yml to archives
23 mkdir -p $WORKSPACE/archives/docker-compose
24 cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/docker-compose
25 cd $WORKSPACE/archives/docker-compose
27 # Set env variables for docker compose
28 export DB_HOST=dbpostgresql
29 export DB_USERNAME=cps
30 export DB_PASSWORD=cps
31 # Use latest image version
34 # start CPS and PostgreSQL containers with docker compose
37 # Validate CPS service initialization completed via periodic log checking for line like below:
38 # org.onap.cps.Application ... Started Application in X.XXX seconds
44 while [ "$TIME" -le "$TIME_OUT" ]; do
45 LOG_FOUND=$( docker-compose logs --tail="all" | grep "org.onap.cps.Application" | egrep -c "Started Application in" )
47 if [ "$LOG_FOUND" -gt 0 ]; then
48 echo "CPS Service started"
52 echo "Sleep $INTERVAL seconds before next check for CPS initialization (waiting $TIME seconds; timeout is $TIME_OUT seconds)"
54 TIME=$((TIME + INTERVAL))
57 if [ "$TIME" -gt "$TIME_OUT" ]; then
58 echo "TIME OUT: CPS Service wasn't able to start in $TIME_OUT seconds, setup failed."
62 # TODO localhost works on a local environment, check if it's ok on jenkins
63 CPS_HOST="http://localhost:8883"
65 # Pass variables required for Robot test suites in ROBOT_VARIABLES
66 ROBOT_VARIABLES="-v SCRIPTS:$SCRIPTS -v CPS_HOST:$CPS_HOST"