Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This is just a recommendation and you should try this in your environment to see if it works correctly.

Approach

  • WebLogic resource properties file will be copied to <Endpoint Working Directory>/wlresources/<Project Id> at the end of successful deployment. This means that at the end of deployment we are trying remember artifact state of last deployment.
  • At start of Deployment, we will compare project version artifacts folder files with previously deployed files and will deploy only changed files.

...

WebLogic plugin createOrUpdateWeblogicConfig operation is used to perform deployment. But there are two shell plugin operations used, 1) Find changed files 2) update state folder with latest files that were deployed.

Here is code for two shell plugin operations for your quick reference, code for Shell plugin is also part of Workflow XML provided above in this page.

Code Block
languagebash
themeRDark
titlePrepare Files for Deployment
cd $FD_TEMP_DIR
cd ../..
PROJECT_ID=`pwd | awk -F'/' '{print $NF}'`
STATE_FOLDER=`echo $FD_TEMP_DIR/../../../../wlresources/$PROJECT_ID`
mkdir -p $STATE_FOLDER
DEPLOY_FOLDER=$FD_TEMP_DIR/resources
mkdir -p $DEPLOY_FOLDER

changesdetected=no
    
cd $FD_ARTIFACTS_DIR
files=`ls *.properties`
for file in $files
do
    echo $file - see if it needs to be deployed
    mainfilechanged=yes
    envfilechanged=no
    
    diff $file $STATE_FOLDER/$file 1>/dev/null 2>/dev/null
    if [[ "$?" == "0" ]]
    then
        mainfilechanged=no
        echo ---- $file NOT changed since last deployment.
    else
        echo ++++ $file changed since last deployment.
    fi
    
    if [[ -f $FD_ENVIRONMENT_CODE/$file ]]
    then
        diff $FD_ENVIRONMENT_CODE/$file $STATE_FOLDER/$FD_ENVIRONMENT_CODE/$file 1>/dev/null 2>/dev/null
        if [[ "$?" != "0" ]]
        then
            envfilechanged=yes
            echo ++++ $FD_ENVIRONMENT_CODE/$file changed since last deployment.
        else
            echo ---- $FD_ENVIRONMENT_CODE/$file NOT changed since last deployment.
        fi
    fi
    
    if [[ $mainfilechanged == "yes" || $envfilechanged == "yes" ]]
    then
        echo $file - wll be deployed
        changesdetected=yes
        cp $file $DEPLOY_FOLDER/$file
        if [[ -f $FD_ENVIRONMENT_CODE/$file ]]
        then
            cp $FD_ENVIRONMENT_CODE/$file $DEPLOY_FOLDER/$FD_ENVIRONMENT_CODE/$file
        fi
    else
        echo $file - wll NOT be deployed
    fi
    
done

setOutput CHANGES_DETECTED $changesdetected

...