Skip to content

Commit

Permalink
fixes PR body when opening PRs in other repos for minimal images (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxesn authored Nov 6, 2023
1 parent 69f66fa commit c9c7876
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
43 changes: 21 additions & 22 deletions eks-distro-base/update_base_image_other_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ else
ORIGIN_ORG=$REPO_OWNER
fi

EXTRA_PR_BODY=""

REPOS=(eks-distro eks-anywhere-build-tooling eks-anywhere)
for repo in "${REPOS[@]}"; do
${SCRIPT_ROOT}/../pr-scripts/update_local_branch.sh "$repo"
done
while IFS=, read -r key
do
key=${key:2} # strip leading - space
while IFS=, read -r image

EXTRA_PR_BODY=""
while IFS=, read -r key
do
image=${image:2} # strip leading - space
BASE_IMAGE_TAG_FILE="$(echo ${image^^} | tr '-' '_')_TAG_FILE"
key=${key:2} # strip leading - space
while IFS=, read -r image
do
image=${image:2} # strip leading - space
BASE_IMAGE_TAG_FILE="$(echo ${image^^} | tr '-' '_')_TAG_FILE"

if [[ "$key" == "al2023" ]]; then
BASE_IMAGE_TAG_FILE="$(echo ${image^^} | tr '-' '_')_AL2023_TAG_FILE"
fi
if [[ "$key" == "al2023" ]]; then
BASE_IMAGE_TAG_FILE="$(echo ${image^^} | tr '-' '_')_AL2023_TAG_FILE"
fi

IMAGE_TAG=$(yq e ".$key.\"$image\"" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)
# we will set the tag to null to trigger new builds. we dont want PRs being open setting
# tag file values to null
if [[ "${IMAGE_TAG}" = "null" ]]; then
continue
fi

IMAGE_TAG=$(yq e ".$key.\"$image\"" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)
# we will set the tag to null to trigger new builds. we dont want PRs being open setting
# tag file values to null
if [[ "${IMAGE_TAG}" = "null" ]]; then
continue
fi
for repo in "${REPOS[@]}"; do
${SCRIPT_ROOT}/../pr-scripts/update_image_tag.sh "$repo" '.*' $IMAGE_TAG $BASE_IMAGE_TAG_FILE

if [ "$(git -C ${OTHER_CLONE_ROOT}/${ORIGIN_ORG}/${repo} status --porcelain -- $BASE_IMAGE_TAG_FILE | wc -l)" -gt 0 ]; then
Expand All @@ -60,10 +60,9 @@ do
EXTRA_PR_BODY+="\n${BASE_IMAGE_TAG_FILE}\nThe following yum packages were updated:\n\`\`\`bash\n${UPDATE_PACKAGES}\n\`\`\`\n"
fi
fi
done
done < <(yq e ".$key | keys" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)
done < <(yq e "keys" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)

for repo in "${REPOS[@]}"; do
done < <(yq e ".$key | keys" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)
done < <(yq e "keys" $SCRIPT_ROOT/../EKS_DISTRO_TAG_FILE.yaml)

${SCRIPT_ROOT}/../pr-scripts/create_pr.sh "$repo" 'EKS_DISTRO*_TAG_FILE' "image-tag-update" "$EXTRA_PR_BODY"
done
2 changes: 1 addition & 1 deletion pr-scripts/create_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ else
fi

if [ -n "${EXTRA_PR_BODY}" ]; then
PR_BODY+="${EXTRA_PR_BODY}"
printf "${EXTRA_PR_BODY}" >> $PR_BODY_FILE
fi

# Adding this here to include the "do-not-merge/hold" label. Trying to use the gh client with the --label arg will not succeed
Expand Down

0 comments on commit c9c7876

Please sign in to comment.