Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from liquibase/hotfix/add-operation-value-to-end
Browse files Browse the repository at this point in the history
Hotfix/add operation value to end
  • Loading branch information
molivasdat authored Oct 22, 2020
2 parents 12542fb + a2a35bf commit 480ea2b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ The `operation` input expects one of the following:
* classpath
* changeLogFile

#### status
* classpath
* changeLogFile

#### diff
* referenceUrl

Expand Down
31 changes: 21 additions & 10 deletions entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,29 @@ COUNT=$7
TAG=$8
DATE=$9
REFERENCEURL=$10

PARAMS=()
VALUES=()

function check_required_param() {
local OP=$1
local KEY=$2
local VAL=$3
local IsVALUE=${4:-false}
if [ -z "$VAL" ]
then
echo "$OP requires $KEY to not be empty"
exit 1
fi
PARAMS+=(--$KEY=$VAL)
if [ "$IsVALUE" = true ]
then
VALUES+=($VAL)
else
PARAMS+=(--$KEY=$VAL)
fi
}


function validate_operation() {
case $OPERATION in
update)
Expand All @@ -36,40 +45,40 @@ function validate_operation() {
check_required_param updateCount classpath $CLASSPATH
check_required_param updateCount changeLogFile $CHANGELOGFILE
check_required_param updateCount url $URL
check_required_param updateCount count $COUNT
check_required_param updateCount count $COUNT true
;;

tag)
check_required_param tag url $URL
check_required_param tag tag $TAG
check_required_param tag tag $TAG true
;;

updateToTag)
check_required_param updateToTag classpath $CLASSPATH
check_required_param updateToTag changeLogFile $CHANGELOGFILE
check_required_param updateToTag url $URL
check_required_param updateToTag tag $TAG
check_required_param updateToTag tag $TAG true
;;

rollback)
check_required_param rollback classpath $CLASSPATH
check_required_param rollback changeLogFile $CHANGELOGFILE
check_required_param rollback url $URL
check_required_param rollback tag $TAG
check_required_param rollback tag $TAG true
;;

rollbackCount)
check_required_param rollbackCount classpath $CLASSPATH
check_required_param rollbackCount changeLogFile $CHANGELOGFILE
check_required_param rollbackCount url $URL
check_required_param rollbackCount count $COUNT
check_required_param rollbackCount count $COUNT true
;;

rollbackToDate)
check_required_param rollbackToDate classpath $CLASSPATH
check_required_param rollbackToDate changeLogFile $CHANGELOGFILE
check_required_param rollbackToDate url $URL
check_required_param rollbackToDate date $DATE
check_required_param rollbackToDate date $DATE true
;;

updateSQL)
Expand All @@ -81,10 +90,12 @@ function validate_operation() {
futureRollbackSQL)
check_required_param futureRollbackSQL classpath $CLASSPATH
check_required_param futureRollbackSQL changeLogFile $CHANGELOGFILE
check_required_param futureRollbackSQL url $URL
check_required_param futureRollbackSQL url $URL true
;;

status)
check_required_param updateSQL classpath $CLASSPATH
check_required_param updateSQL changeLogFile $CHANGELOGFILE
check_required_param status url $URL
;;

Expand All @@ -94,7 +105,7 @@ function validate_operation() {

diff)
check_required_param diff url $URL
check_required_param diff referenceUrl $REFERENCEURL
check_required_param diff referenceUrl $REFERENCEURL true
;;

*)
Expand All @@ -108,4 +119,4 @@ check_required_param $OPERATION username $USERNAME
check_required_param $OPERATION password $PASSWORD
validate_operation

docker-entrypoint.sh "${PARAMS[@]}" $OPERATION
docker-entrypoint.sh "${PARAMS[@]}" $OPERATION "${VALUES[@]}"

0 comments on commit 480ea2b

Please sign in to comment.