Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions Templates/Common-Backend-Scripts/generateCleanupCommands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ Help() {
}

#
# Customization
# Configuration file leveraged by the backend scripts
# Either an absolute path or a relative path to the current working directory
SCRIPT_HOME="$(dirname "$0")"
pipelineConfiguration="${SCRIPT_HOME}/pipelineBackend.config"
buildUtilities="${SCRIPT_HOME}/utilities/dbbBuildUtils.sh"
# Customization - End
deleteScript="${SCRIPT_HOME}/../../Utilities/DeletePDS/DeletePDS.groovy"

#
# Internal Variables
Expand Down Expand Up @@ -241,6 +240,27 @@ validateOptions() {
echo $ERRMSG
fi

if [ -z "${dbbMetadataStoreType}" ]; then
rc=8
ERRMSG=$PGM": [ERROR] DBB MetadataStore Type is a required configuration in pipelineBackend.config . rc="$rc
echo $ERRMSG
else

case ${dbbMetadataStoreType} in
file)
cleanupDbbMetadataStoreOptions="--type file --location ${dbbFileMetadataStoreLocation}"
;;
db2)
cleanupDbbMetadataStoreOptions="--type db2 --user ${dbbMetadataStoreJdbcId} --password-file ${dbbMetadataStoreJdbcPwdFile} --db2-config ${dbbMetadataStoreJdbcConfigFile} --url ${dbbMetadataStoreJdbcUrl}"
;;
*)
rc=8
ERRMSG=$PGM": [INFO] Invalid DBB MetadataStore Type: ${dbbMetadataStoreType}. Check required configuration in pipelineBackend.config. rc="$rc
echo $ERRMSG
;;
esac

fi
}

# Prepare output files
Expand Down Expand Up @@ -319,7 +339,7 @@ genDeleteStatementsCollections() {

for applicationCollection in ${collectionsToBeDeleted[@]}; do

echo "dbb collection delete $applicationCollection ${dbbMetadataStoreOptions}" >>${cmdFileDeleteCollections}
echo "dbb collection delete $applicationCollection ${cleanupDbbMetadataStoreOptions}" >>${cmdFileDeleteCollections}

done

Expand All @@ -341,7 +361,7 @@ genDeleteStatementsBuildGroups() {

for buildGroup in ${buildgroupsToBeDeleted[@]}; do

echo "dbb build-group delete $buildGroup ${dbbMetadataStoreOptions}" >>${cmdFileDeleteBuildGroups}
echo "dbb build-group delete $buildGroup ${cleanupDbbMetadataStoreOptions}" >>${cmdFileDeleteBuildGroups}

done

Expand Down Expand Up @@ -381,7 +401,7 @@ if [ $rc -eq 0 ]; then
echo $PGM": [INFO] ** Cmd obsolete collections:" ${cmdFileDeleteCollections}
echo $PGM": [INFO] ** Cmd obsolete build groups:" ${cmdFileDeleteBuildGroups}
echo $PGM": [INFO] ** Cmd obsolete build datasets:" ${cmdFileDeleteBuildDatasets}
echo $PGM": [INFO] ** DBB Metadastore Config:" ${dbbMetadataStoreOptions}
echo $PGM": [INFO] ** DBB Metadastore Config:" ${cleanupDbbMetadataStoreOptions}
echo $PGM": [INFO] ** Process Cleanup Scripts:" ${executeCleanupCommandScripts}
echo $PGM": [INFO] **************************************************************"
echo ""
Expand All @@ -390,7 +410,7 @@ fi
if [ $rc -eq 0 ]; then
# Retrieve existing DBB Collections
echo $PGM": [STAGE] Retrieve all collections with application qualifier $App"
applicationCollections=$(dbb collection list $dbbMetadataStoreOptions | grep $App)
applicationCollections=$(dbb collection list $cleanupDbbMetadataStoreOptions | grep $App)
rc=$?
if [ ! $rc -eq 0 ]; then
ERRMSG=$PGM": [ERROR] Retrieving Collections failed. Check Log. rc="$rc
Expand Down
13 changes: 13 additions & 0 deletions Templates/Common-Backend-Scripts/pipelineBackend.config
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ dbbMetadataStoreJdbcId=""
# Default = None, Required.
dbbMetadataStoreJdbcPwdFile=""

# Absolute path to Db2 conf file containing db2 schema etc
# Default = None, currently only referenced in generateCleanupCommands.sh
dbbMetadataStoreJdbcConfigFile=""

# DBB Metadatastore implementation. 'db2' or 'file'
# Used to create the housekeeping instructions in generateCleanupCommands.sh
# Default: dbbMetadataStoreType=db2
dbbMetadataStoreType="db2"

# DBB File Metadatastore location. Only relevant when using dbbMetadataStoreType="file"
# Default dbbFileMetadataStoreLocation="${HOME}"
dbbFileMetadataStoreLocation="${HOME}"

# JDBC connection server url
# sample jdbc:db2://10.3.20.201:4740/MOPDBC0
# Optional if zAppBuild is configured to use the
Expand Down