forked from stfc/cloud-deployed-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created new script to remove carraige returns
- Loading branch information
1 parent
3787dfb
commit 49aec42
Showing
3 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# Script to check if the changed files to promote are a direct copy of earlier environment | ||
|
||
# Function to compare the files, file1 is our original file passed to the script followed by two possible further files | ||
compare_files() { | ||
file1=$1 | ||
file2=$2 | ||
file3=$3 | ||
|
||
# Check the number of arguments passed to the function for comparison | ||
# To know the number of files for comparison | ||
# We then check whether the files exist in the previous environment, if not the PR needs review | ||
if [ "$#" -eq 2 ]; then | ||
if [ -f $file2 ]; then | ||
if cmp -s "$file1" "$file2"; then | ||
echo $((0)) | ||
else | ||
echo $((1)) | ||
fi | ||
else | ||
echo $((1)) | ||
fi | ||
else | ||
if [[ -f $file2 && -f $file3 ]]; then | ||
if cmp -s "$file1" "$file2" && cmp -s "$file1" "$file3"; then | ||
echo $((0)) | ||
else | ||
echo $((1)) | ||
fi | ||
else | ||
echo $((1)) | ||
fi | ||
fi | ||
} | ||
|
||
# Check the file path to determine if it's from staging or prod folder | ||
# If it's staging we pass it along with a url to the file in dev folder | ||
# If it's from prod we pass both the staging and dev file also for comparison | ||
path=$1 | ||
curr_env=$2 | ||
comp_env=$3 | ||
comp_env2=$4 | ||
|
||
if [[ -z $4 ]]; then | ||
compare_files "$1" "${path/$curr_env/"$comp_env"}" | ||
else | ||
compare_files "$1" "${path/$curr_env/"$comp_env"}" "${path/$curr_env/"$comp_env2"}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
apiVersion: v2 | ||
name: argocd | ||
version: 1.0.3 | ||
version: 1.0.4 |