Skip to content

Commit

Permalink
COrrected bash file errors, trimmed down some statements
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveW-STFC committed Sep 19, 2024
1 parent e7e2e6f commit 0b30d59
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pr_copied_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
files: |
charts/staging/**
charts/prod/**
clusters/staging/**
clusters/prod/**
secrets/staging/**
secrets/prod**
# clusters/staging/**
# clusters/prod/**
# secrets/staging/**
# secrets/prod**

- name: Run step if any file(s) in the folder change
id: step1
Expand Down
23 changes: 12 additions & 11 deletions scripts/pr_check_copy.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash

# Script to check if the changed files to promote are a direct copy of earlier environment

devEnv="dev"
stagingEnv="staging"

compare_files() [
file1 = $1
file2 = $2
file3 = $3
compare_files() {
file1=$1
file2=$2
file3=$3

if [ "$#" -eq 2 ]; then
if cmp -s "$file1" "$file2" ; then
Expand All @@ -21,14 +22,14 @@ compare_files() [
else
return 1
fi
]
fi
}

# If the file is related to dev env then we are not interested.
# Will look to filter these out in the yaml file of the GitHub action.
if [[ $s1 == *"dev/"* ]] ; then
return 1;
elif [[ $s1 == *"staging/"* ]] ; then
compare_files "$s1" "${$s1/staging/"$devEnv"}"
elif [[$s1 == *"prod/"* ]] ; then
compare_files "$s1" "${$s1/prod/"$stagingEnv"}" "${$s1/prod/"$devEnv"}"
if [[ $1 == *"staging/"* ]] ; then
compare_files "$1" "${!$1/staging/"$devEnv"}"
else
compare_files "$1" "${!$1/prod/"$stagingEnv"}" "${!$1/prod/"$devEnv"}"
fi

0 comments on commit 0b30d59

Please sign in to comment.