3 # ============LICENSE_START=======================================================
4 # Copyright (C) 2021-2022 Bell Canada.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
21 # Copy docker-compose.yml and application.yml to archives
22 mkdir -p $WORKSPACE/archives/docker-compose
23 cp $WORKSPACE/../*.yml $WORKSPACE/archives/docker-compose
24 cd $WORKSPACE/archives/docker-compose
26 # properties file with docker-compose service properties
27 source $WORKSPACE/plans/default/setup.properties
29 # download docker-compose of a required version (1.25.0 supports configuration of version 3.7)
30 curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose
31 chmod +x docker-compose
33 # Set environment variables for docker compose
34 export CPS_TEMPORAL_DOCKER_REPO=
35 export STABLE_CPS_CORE_VERSION=3.0.0
36 # start CPS Temporal, cps-core, timescaledb, PostgresSQL and kafka containers with docker compose
37 ./docker-compose up -d
39 # Validate CPS service initialization completed via periodic log checking for line like below:
40 # org.onap.cps.temporal.Application ... Started Application in X.XXX seconds
42 while [ "$TIME" -le "$TIME_OUT" ]; do
43 LOG_FOUND_CPS_TEMPORAL=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.temporal.Application" | egrep -c "Started Application in" )
44 LOG_FOUND_CPS=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.Application" | egrep -c "Started Application in" )
46 if [ "$LOG_FOUND_CPS" -gt 0 ] && [ "$LOG_FOUND_CPS_TEMPORAL" -gt 0 ]; then
47 echo "CPS Service started"
51 echo "Sleep $INTERVAL seconds before next check for CPS initialization (waiting $TIME seconds; timeout is $TIME_OUT seconds)"
53 TIME=$((TIME + INTERVAL))
56 if [ "$TIME" -gt "$TIME_OUT" ]; then
57 echo "TIME OUT: CPS services did not start in $TIME_OUT seconds, setup failed."
61 # Pass variables required for Robot test suites in ROBOT_VARIABLES
62 ROBOT_VARIABLES="-v CPS_TEMPORAL_HOST:$CPS_TEMPORAL_HOST -v CPS_TEMPORAL_PORT:$CPS_TEMPORAL_PORT -v CPS_HOST:$CPS_HOST -v CPS_PORT:$CPS_PORT -v MANAGEMENT_PORT:$MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data"