diff options
author | Tim Smith <tsmith84@gmail.com> | 2021-03-01 12:24:13 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2021-03-01 13:38:02 -0800 |
commit | e76d98406c256845a48ef3cd67e1e579df4750ca (patch) | |
tree | d6149a59be0a4322e28bdf3901769ee65c13fcc2 | |
parent | bb53f8a16340463913d91a0769db2524409431b6 (diff) | |
download | chef-e76d98406c256845a48ef3cd67e1e579df4750ca.tar.gz |
Update update_dep to allow passing in the dep to update
We need to know the dep we're updating throughout this script and if
it's not a gem we don't know the name. Allow passing in the name via arg
Signed-off-by: Tim Smith <tsmith@chef.io>
-rwxr-xr-x[-rw-r--r--] | .expeditor/update_dep.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/.expeditor/update_dep.sh b/.expeditor/update_dep.sh index baf950c408..932c3dbbea 100644..100755 --- a/.expeditor/update_dep.sh +++ b/.expeditor/update_dep.sh @@ -11,11 +11,14 @@ set -evx +REPONAME=$(echo $EXPEDITOR_REPO | cut -d '/' -f 2) +DEPNAME="${EXPEDITOR_GEM_NAME:-${REPONAME:?Could not find gem name}}" + function new_gem_included() { - git diff | grep -E '^\+' | grep "${EXPEDITOR_GEM_NAME} (${EXPEDITOR_VERSION})" + git diff | grep -E '^\+' | grep "${DEPNAME} (${EXPEDITOR_VERSION})" } -branch="expeditor/${EXPEDITOR_GEM_NAME}_${EXPEDITOR_VERSION}" +branch="expeditor/${DEPNAME}_${EXPEDITOR_VERSION}" git checkout -b "$branch" tries=12 @@ -23,10 +26,10 @@ for (( i=1; i<=$tries; i+=1 )); do bundle lock --update new_gem_included && break || sleep 20 if [ $i -eq $tries ]; then - echo "Searching for '${EXPEDITOR_GEM_NAME} (${EXPEDITOR_VERSION})' ${i} times and did not find it" + echo "Searching for '${DEPNAME} (${EXPEDITOR_VERSION})' ${i} times and did not find it" exit 1 else - echo "Searched ${i} times for '${EXPEDITOR_GEM_NAME} (${EXPEDITOR_VERSION})'" + echo "Searched ${i} times for '${DEPNAME} (${EXPEDITOR_VERSION})'" fi done @@ -34,7 +37,7 @@ git add . # give a friendly message for the commit and make sure it's noted for any future audit of our codebase that no # DCO sign-off is needed for this sort of PR since it contains no intellectual property -git commit --message "Bump $EXPEDITOR_GEM_NAME to $EXPEDITOR_VERSION" --message "This pull request was triggered automatically via Expeditor when $EXPEDITOR_GEM_NAME $EXPEDITOR_VERSION was promoted to Rubygems." --message "This change falls under the obvious fix policy so no Developer Certificate of Origin (DCO) sign-off is required." +git commit --message "Bump $DEPNAME to $EXPEDITOR_VERSION" --message "This pull request was triggered automatically via Expeditor when $DEPNAME $EXPEDITOR_VERSION was promoted to Rubygems." --message "This change falls under the obvious fix policy so no Developer Certificate of Origin (DCO) sign-off is required." open_pull_request "$EXPEDITOR_BRANCH" |