Skip to content

Commit

Permalink
Merge pull request #3013 from spiffxp/redo-admin-update.sh
Browse files Browse the repository at this point in the history
update admin/update.sh
  • Loading branch information
k8s-ci-robot authored Sep 27, 2021
2 parents 726f425 + 1cc3c4a commit 657608a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,12 @@ test: config
verify:
./hack/verify.sh

.PHONY: update-prep
update-prep: config test peribolos

.PHONY: deploy # --confirm
deploy: config test peribolos
$(PERIBOLOS_CMD) \
--config-path $(MERGED_CONFIG) \
--fix-org \
--fix-org-members \
--fix-teams \
--fix-team-members \
$(shell [ -n "${GITHUB_TOKEN_PATH}" ] && echo "--github-token-path=${GITHUB_TOKEN_PATH}") \
$(patsubst %, --required-admins=%, $(ADMINS)) \
deploy:
./admin-update.sh
$(-*-command-variables-*-) $(filter-out $@,$(MAKECMDGOALS))

# actual targets that only get built if they don't already exist
Expand Down
39 changes: 26 additions & 13 deletions admin/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if [[ $# -lt 6 ]]; then
echo "Usage: bazel run //admin:update -- --github-token-path ~/my/github/token # --confirm" >&2
exit 1
fi

set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
set -x

REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
readonly REPO_ROOT

readonly admins=(
cblecker
fejta
idvoretskyi
mrbobbytables
nikhita
spiffxp
)

cd "${REPO_ROOT}"
make update-prep
cmd="${REPO_ROOT}/_output/bin/peribolos"
args=(
--config-path="${REPO_ROOT}/_output/gen-config.yaml"
--fix-org
--fix-org-members
--fix-teams
--fix-team-members
"${admins[@]/#/--required-admins=}"
)

pushd "$(dirname "$(realpath "$BASH_SOURCE")")"
bazel test //config:all
popd
peribolos="$1"
shift
echo $@
"$peribolos" $@
"${cmd}" "${args[@]}" "${@}"

0 comments on commit 657608a

Please sign in to comment.