This content originally appeared on DEV Community and was authored by SOM4N
Introduction
Recently, I came across a problem that made me realize how much of a necessity it is to properly validate deployment and the role of the air sandbox diff command in ensuring that all changes were deployed correctly.
The Problem: An Overlooked Production Update
We had to tweak an Ab Initio graph in many places at 32 distinct points since there was a recent deployment. This can affect the graph's behavior, if any of them hadn't been applied, for all of them followed a recently introduced business requirement.
We also missed one critical change in otherwise very tight development and testing cycle after its deployment. As you can see, it is very laborious and error-prone to manually deduce where the missed change was in a graph of this size. It was obvious that an automated method was needed to identify the disparity.
Using air sandbox diff for Rapid Detection
I immediately used the air sandbox diff command-this is a highly powerful Ab Initio sandbox comparison tool. It would compare and show differences for configuration, metadata, graphs, and scripts, plus other files if any. It was through such a comparison where air sandbox diff helped to quickly give us the correct answer to an issue like that:
Differences Isolating
Air sandbox diff compared the deployed production sandbox against the development sandbox and instantly highlighted the missed change. This way, we wouldn't have to go through the painful process of poring over 32 points of modification, thus no detail was missed.
Detailed Analysis:
The -verbose option with the command above revealed discrepancies with sufficient detail to immediately expose the location of the change, which was missed in production. This meant that the problem could be resolved, rather than guessed at.
Using Air Sandbox Diff
- Use -verbose Mode: This provides a more detailed view, making it easier to catch anomalies, especially where significant changes have been made.
air sandbox diff -verbose /path/to/dev_sandbox /path/to/prod_sandbox
-
Repetitive Comparisons For your list of validation steps to run after the deployment, include the diff in the air sandbox, Use the
-summarize
option to get a quick overview of changes.
air sandbox diff -summarize /path/to/dev_sandbox /path/to/prod_sandbox
-
Ignore and Exclude
If you want to ignore specific file types, like logs, use the
-ignore
option and we can also Exclude files based on specific patterns, such as temporary files using-exclude
air sandbox diff -ignore "*.log" /path/to/dev_sandbox /path/to/prod_sandbox
air sandbox diff -exclude "temp_*" /path/to/dev_sandbox /path/to/prod_sandbox
Rapid Fix:
By identifying the missed change, we could directly effect a fix in production; ensure data flow continuity while sidestepping potential down streams.
This reminded us that we do need post-deployment validation. Though the missed update was caught by the air sandbox diff effectively, we still learned to include an additional verification layer.
In our future post-deployment checklists, we added one new step i.e., our admin team will send a summary of all the changes made as part of their post-deployment notes to developer and the support team for post validation.
Below we have created a skeleton of the code block in which we will copy and test graph
#!/bin/ksh
# Check if sufficient arguments are provided
if [[ $# -ne 4 ]]; then
echo "Usage: $0 <dev-pset-path> <prod-server> <prod-pset-path> <local-temp-dir>"
exit 1
fi
# Assign input arguments to variables
DEV_PSET=$1
PROD_SERVER=$2
PROD_PSET=$3
LOCAL_TEMP_DIR=$4
# Set local paths for temporary PROD PSET file copy
LOCAL_PROD_PSET=\"$LOCAL_TEMP_DIR/prod_pset.pset\"
# Make sure the temporary directory exists
mkdir -p $LOCAL_TEMP_DIR
# Copy the PSET file from PROD server to DEV server's local directory
echo "Fetching PSET from PROD server."
scp $PROD_SERVER:$PROD_PSET $LOCAL_PROD_PSET
if [[ $? -ne 0 ]]; then
echo "Failed to fetch PSET from PROD server."
exit 1
fi
# Compare the PSET files (DEV vs PROD)
echo "Comparing PSET files."
diff_output=$(air sandbx diff $DEV_PSET $LOCAL_PROD_PSET)
# Print the differences
if [[ -z "$diff_output" ]]; then
echo "No differences found between DEV and PROD PSET files."
else
echo "Differences found:"
echo "$diff_output"
fi
#
# Optionally, cleanup the local copy of PROD PSET
rm $LOCAL_PROD_PSET
exit 0
This content originally appeared on DEV Community and was authored by SOM4N
SOM4N | Sciencx (2024-11-03T18:02:43+00:00) Ensuring Deployment Accuracy with air sandbox diff in AbInitio. Retrieved from https://www.scien.cx/2024/11/03/ensuring-deployment-accuracy-with-air-sandbox-diff-in-abinitio/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.