Skip to content

Commit

Permalink
Merge pull request #433 from zebrunner/develop
Browse files Browse the repository at this point in the history
1.6 rc
  • Loading branch information
vdelendik authored Mar 15, 2021
2 parents 2e2caac + e7dd584 commit fcf8156
Show file tree
Hide file tree
Showing 8 changed files with 4,016 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ZBR_VERSION=1.5
ZBR_VERSION=1.6
TAG_NGINX=1.17
2 changes: 0 additions & 2 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ When it is "abort" we halt the entire pipeline as only failed job detected. It m
</br>
<b>jenkinsFailedSlackChannels</b> - This property takes a comma separated list of slack channels to notify about failures.
</br>
<b>jenkinsQueueRegistration</b> - This property is a boolean parameter to manage queue registration. Disabling is recommended for suites with dynamic number of tests or dynamic test names.
</br>
<b>jenkinsDefaultRetryCount</b> - This property allows to provide custom retry_count property (number of extra attempts for test execution).
</br>
<b>jenkinsNodeLabel</b> - This property allows to override slave label and execute test on custom server.
Expand Down
2 changes: 1 addition & 1 deletion mcloud
116 changes: 116 additions & 0 deletions patch/1.6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

export_settings() {
export -p | grep "ZBR" > backup/settings.env
}

confirm() {
local message=$1
local question=$2
local isEnabled=$3

if [[ "$isEnabled" == "1" ]]; then
isEnabled="y"
fi
if [[ "$isEnabled" == "0" ]]; then
isEnabled="n"
fi

while true; do
if [[ ! -z $message ]]; then
echo "$message"
fi

read -p "$question y/n [$isEnabled]:" response
if [[ -z $response ]]; then
if [[ "$isEnabled" == "y" ]]; then
return 1
fi
if [[ "$isEnabled" == "n" ]]; then
return 0
fi
fi

if [[ "$response" == "y" || "$response" == "Y" ]]; then
return 1
fi

if [[ "$response" == "n" || "$response" == "N" ]]; then
return 0
fi

echo "Please answer y (yes) or n (no)."
echo
done
}

replace() {
#TODO: https://github.com/zebrunner/zebrunner/issues/328 organize debug logging for setup/replace
file=$1
#echo "file: $file"
content=$(<$file) # read the file's content into
#echo "content: $content"

old=$2
#echo "old: $old"

new=$3
#echo "new: $new"
content=${content//"$old"/$new}

#echo "content: $content"

printf '%s' "$content" >$file # write new content to disk
}

TARGET_VERSION=1.6

source backup/settings.env
SOURCE_VERSION=${ZBR_VERSION}

if ! [[ "${TARGET_VERSION}" > "${SOURCE_VERSION}" ]]; then
#target Zebrunner version less or equal existing
echo "No need to perform upgrade to ${TARGET_VERSION}"
exit 2
fi

echo "Upgrading Zebrunner from ${SOURCE_VERSION} to ${TARGET_VERSION}"
# apply reporting changes
if [[ ! -f reporting/.disabled ]] ; then
docker stop reporting-service
sleep 3
docker cp patch/sql/reporting-1.22-db-migration.sql postgres:/tmp
if [[ $? -ne 0 ]]; then
echo "ERROR! Unable to proceed upgrade as postgres container not available."
exit 1
fi
docker exec -i postgres /usr/bin/psql -U postgres -f /tmp/reporting-1.22-db-migration.sql
if [[ $? -ne 0 ]]; then
echo "ERROR! Unable to apply reporting-1.22-db-migration.sql"
exit 1
fi
fi

# #424: apply selenoid changes
cp selenoid/.env selenoid/.env_1.5
cp selenoid/.env.original selenoid/.env
if [[ ! $ZBR_MINIO_ENABLED -eq 1 ]]; then
# use case with AWS S3
replace selenoid/.env "S3_REGION=us-east-1" "S3_REGION=${ZBR_STORAGE_REGION}"
replace selenoid/.env "S3_ENDPOINT=http://minio:9000" "S3_ENDPOINT=${ZBR_STORAGE_ENDPOINT_PROTOCOL}://${ZBR_STORAGE_ENDPOINT_HOST}"
replace selenoid/.env "S3_BUCKET=zebrunner" "S3_BUCKET=${ZBR_STORAGE_BUCKET}"
replace selenoid/.env "S3_ACCESS_KEY_ID=zebrunner" "S3_ACCESS_KEY_ID=${ZBR_STORAGE_ACCESS_KEY}"
replace selenoid/.env "S3_SECRET=J33dNyeTDj" "S3_SECRET=${ZBR_STORAGE_SECRET_KEY}"

if [[ ! -z $ZBR_STORAGE_TENANT ]]; then
replace selenoid/.env "/artifacts" "${ZBR_STORAGE_TENANT}/artifacts"
fi
fi

echo "Upgrade to ${TARGET_VERSION} finished successfully"

#remember successfully applied version in settings.env file
export ZBR_VERSION=${TARGET_VERSION}

#save information about upgraded zebrunner version
export_settings
Loading

0 comments on commit fcf8156

Please sign in to comment.