Skip to content

Commit

Permalink
Fix early git revision comparison in masterfiles-stage.sh
Browse files Browse the repository at this point in the history
We need to compare the revision in the mirror against the target
deploy directory, not the temporary checkout from the mirror. And
we can do this earlier in the process.

Ticket: ENT-11970
Changelog: None
  • Loading branch information
vpodzime committed Jul 12, 2024
1 parent a017384 commit b15ee23
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contrib/masterfiles-stage/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ git_deploy_refspec() {
mkdir -p "$(dirname "$1")" || error_exit "Failed to mkdir -p dirname $1"
# We don't mkdir $1 directly, just its parent dir if that doesn't exist.

if git_check_is_in_sync "${local_mirrored_repo}" "$1" "$2"; then
return 0
fi

########################## 1. CREATE EMPTY TEMP DIR
# Put staging dir right next to deploy dir to ensure it's on same filesystem
local temp_stage
Expand All @@ -112,10 +116,6 @@ git_deploy_refspec() {
mkdir -p "${temp_stage}/.git"
cp "${local_mirrored_repo}/HEAD" "${temp_stage}/.git/"

if git_check_is_in_sync "${local_mirrored_repo}" "${temp_stage}" "$2"; then
return 0
fi

########################## 3. SET PERMISSIONS ON POLICY SET
chown -R root:root "${temp_stage}" || error_exit "Unable to chown '${temp_stage}'"
find "${temp_stage}" \( -type f -exec chmod 600 {} + \) -o \
Expand Down Expand Up @@ -211,6 +211,10 @@ git_cfbs_deploy_refspec() {
mkdir -p "$(dirname "$1")" || error_exit "Failed to mkdir -p dirname $1"
# We don't mkdir $1 directly, just its parent dir if that doesn't exist.

if git_check_is_in_sync "${local_mirrored_repo}" "$1" "$2"; then
return 0
fi

########################## 1. CREATE EMPTY TEMP DIR
# Put staging dir right next to deploy dir to ensure it's on same filesystem
local temp_stage
Expand Down Expand Up @@ -238,10 +242,6 @@ git_cfbs_deploy_refspec() {
mkdir -p "${temp_stage}/out/masterfiles/.git"
cp "${local_mirrored_repo}/HEAD" "${temp_stage}/out/masterfiles/.git/"

if git_check_is_in_sync "${local_mirrored_repo}" "${temp_stage}/out/masterfiles" "$2"; then
return 0
fi

########################## 3. SET PERMISSIONS ON POLICY SET
chown -R root:root "${temp_stage}" || error_exit "Unable to chown '${temp_stage}'"
find "${temp_stage}" \( -type f -exec chmod 600 {} + \) -o \
Expand Down

0 comments on commit b15ee23

Please sign in to comment.