From 41d3939b1ff963c23442d73cb713b1bb3d6489a3 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 19 Jul 2019 10:56:48 -0400 Subject: [PATCH] Quick and dirty script to update all plugins against latest Vault sdk/api and then pull those into Vault itself --- scripts/update_plugin_modules.sh | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 scripts/update_plugin_modules.sh diff --git a/scripts/update_plugin_modules.sh b/scripts/update_plugin_modules.sh new file mode 100755 index 0000000000..cbd1b12058 --- /dev/null +++ b/scripts/update_plugin_modules.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e + +## Make a temp dir +tempdir=$(mktemp -d update-plugin-modules.XXXXXX) + +## Set paths +cd $tempdir + +## Get Vault +echo "Fetching vault..." +git clone https://github.com/hashicorp/vault + +for plugin in $(grep github.com/hashicorp/vault-plugin- vault/go.mod | cut -f 2 | cut -d ' ' -f 1 | cut -d '/' -f 3) +do + echo "Fetching $plugin..." + git clone https://github.com/hashicorp/$plugin + cd $plugin + rm -rf vendor + go get github.com/hashicorp/vault/api@master + go mod tidy + go mod vendor + git add . + git commit --allow-empty -m "Updating vault dep" + if [ ! -z $PUSH_COMMITS ] + then + git push + fi + cd .. + cd vault + go get github.com/hashicorp/$plugin@master + cd .. +done + +cd vault +go mod tidy +rm -rf vendor +go mod vendor +git add . +git commit --allow-empty -m "Updating plugin deps" +if [ ! -z $PUSH_COMMITS ] +then + git push +fi