From 32edf18ce0dca3f1863249bb688a7ba64314cac1 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 26 Mar 2024 16:04:41 -0400 Subject: [PATCH 1/6] Un-hardcode the master branch in plugin updates --- bashenv/plugn.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bashenv/plugn.bash b/bashenv/plugn.bash index a3ce10c..9181f1a 100644 --- a/bashenv/plugn.bash +++ b/bashenv/plugn.bash @@ -56,15 +56,15 @@ update() { fi [[ -z "$committish" ]] && [[ ! $(git symbolic-ref HEAD) ]] && echo "Plugin pinned to $(< ./.plugin_committish)" && exit 0 - git checkout master &> /dev/null - git pull &> /dev/null - git checkout - &> /dev/null + git fetch &> /dev/null if [[ -n "$committish" ]]; then git fetch --tags &> /dev/null - git checkout $committish &> /dev/null + git checkout "$committish" &> /dev/null + git pull &> /dev/null # in case of branches echo "$committish" > ./.plugin_committish echo "Plugin ($plugin) updated and pinned to $committish" else + git pull &> /dev/null echo "Plugin ($plugin) updated" fi popd &> /dev/null From 41d58997ce2e948253b273bb6b88f0062a3b6d16 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Wed, 27 Mar 2024 10:01:26 -0400 Subject: [PATCH 2/6] Add tests for non-master plugin updates --- tests/functional/tests.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/functional/tests.sh b/tests/functional/tests.sh index 5ac675e..bc7d319 100755 --- a/tests/functional/tests.sh +++ b/tests/functional/tests.sh @@ -80,14 +80,21 @@ T_plugn-uninstall() { } T_plugn-update() { - plugn-test-pass "test-update" " - plugn init && \ - plugn install https://github.com/dokku/smoke-test-plugin && \ - plugn list | grep smoke-test-plugin && \ - plugn update smoke-test-plugin v0.2.0 && \ - plugn list | grep smoke-test-plugin | grep 0.2.0 && \ - plugn update smoke-test-plugin testing-branch-do-not-delete && \ - plugn list | grep smoke-test-plugin | grep 0.3.0-testing" + local -A repos=( + [master]="https://github.com/dokku/smoke-test-plugin" + [main]="https://github.com/dokku/smoke-test-plugin2" # TODO use an actual repo + ) + for key in "${!repos[@]}"; do + local repo="${repos[$key]}" + plugn-test-pass "test-update-$key" " + plugn init && \ + plugn install $repo && \ + plugn list | grep smoke-test-plugin && \ + plugn update smoke-test-plugin v0.2.0 && \ + plugn list | grep smoke-test-plugin | grep 0.2.0 && \ + plugn update smoke-test-plugin testing-branch-do-not-delete && \ + plugn list | grep smoke-test-plugin | grep 0.3.0-testing" + done } T_plugn-version() { From 74a854b70a2a41d7a2713b74febf15544a4ae9cc Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Wed, 27 Mar 2024 10:23:20 -0400 Subject: [PATCH 3/6] Update tests with a real repo --- tests/functional/tests.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/functional/tests.sh b/tests/functional/tests.sh index bc7d319..59093fe 100755 --- a/tests/functional/tests.sh +++ b/tests/functional/tests.sh @@ -82,18 +82,19 @@ T_plugn-uninstall() { T_plugn-update() { local -A repos=( [master]="https://github.com/dokku/smoke-test-plugin" - [main]="https://github.com/dokku/smoke-test-plugin2" # TODO use an actual repo + [main]="https://github.com/killjoy1221/smoke-test-plugin-using-main" ) for key in "${!repos[@]}"; do local repo="${repos[$key]}" + local name="${repo##*/}" plugn-test-pass "test-update-$key" " plugn init && \ plugn install $repo && \ - plugn list | grep smoke-test-plugin && \ - plugn update smoke-test-plugin v0.2.0 && \ - plugn list | grep smoke-test-plugin | grep 0.2.0 && \ - plugn update smoke-test-plugin testing-branch-do-not-delete && \ - plugn list | grep smoke-test-plugin | grep 0.3.0-testing" + plugn list | grep $name && \ + plugn update $name v0.2.0 && \ + plugn list | grep $name | grep 0.2.0 && \ + plugn update $name testing-branch-do-not-delete && \ + plugn list | grep $name | grep 0.3.0-testing" done } From 1dcb0e90f5902e762201d594661855f51a3778c6 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 23 Apr 2024 08:50:22 -0400 Subject: [PATCH 4/6] Use dokku/smoke-test-plugin-main git repo for test --- tests/functional/tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/tests.sh b/tests/functional/tests.sh index 59093fe..4fdbee7 100755 --- a/tests/functional/tests.sh +++ b/tests/functional/tests.sh @@ -82,7 +82,7 @@ T_plugn-uninstall() { T_plugn-update() { local -A repos=( [master]="https://github.com/dokku/smoke-test-plugin" - [main]="https://github.com/killjoy1221/smoke-test-plugin-using-main" + [main]="https://github.com/dokku/smoke-test-plugin-main" ) for key in "${!repos[@]}"; do local repo="${repos[$key]}" From d1932f6aada25a0b33ad2fa145a5b46bfe2d1d11 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Sat, 18 May 2024 12:16:58 -0400 Subject: [PATCH 5/6] Fix update test --- tests/functional/tests.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/functional/tests.sh b/tests/functional/tests.sh index 4fdbee7..20697a7 100755 --- a/tests/functional/tests.sh +++ b/tests/functional/tests.sh @@ -80,22 +80,25 @@ T_plugn-uninstall() { } T_plugn-update() { - local -A repos=( - [master]="https://github.com/dokku/smoke-test-plugin" - [main]="https://github.com/dokku/smoke-test-plugin-main" - ) - for key in "${!repos[@]}"; do - local repo="${repos[$key]}" - local name="${repo##*/}" - plugn-test-pass "test-update-$key" " - plugn init && \ - plugn install $repo && \ - plugn list | grep $name && \ - plugn update $name v0.2.0 && \ - plugn list | grep $name | grep 0.2.0 && \ - plugn update $name testing-branch-do-not-delete && \ - plugn list | grep $name | grep 0.3.0-testing" - done + plugn-test-pass "test-update" " + plugn init && \ + plugn install https://github.com/dokku/smoke-test-plugin && \ + plugn list | grep smoke-test-plugin && \ + plugn update smoke-test-plugin v0.2.0 && \ + plugn list | grep smoke-test-plugin | grep 0.2.0 && \ + plugn update smoke-test-plugin testing-branch-do-not-delete && \ + plugn list | grep smoke-test-plugin | grep 0.3.0-testing" +} + +T_plugn-update-main() { + plugn-test-pass "test-update-main" " + plugn init && \ + plugn install https://github.com/dokku/smoke-test-plugin-main && \ + plugn list | grep smoke-test-plugin-main && \ + plugn update smoke-test-plugin-main v0.2.0 && \ + plugn list | grep smoke-test-plugin-main | grep 0.2.0 && \ + plugn update smoke-test-plugin-main main && \ + plugn list | grep smoke-test-plugin-main | grep 0.9.0" } T_plugn-version() { From 02b39c5aefccfb1c345bdf6b1b522e78e2c15bfc Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Sat, 18 May 2024 19:50:11 -0400 Subject: [PATCH 6/6] Fix updates when in a detached HEAD --- bashenv/plugn.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashenv/plugn.bash b/bashenv/plugn.bash index 9181f1a..b1add02 100644 --- a/bashenv/plugn.bash +++ b/bashenv/plugn.bash @@ -60,7 +60,7 @@ update() { if [[ -n "$committish" ]]; then git fetch --tags &> /dev/null git checkout "$committish" &> /dev/null - git pull &> /dev/null # in case of branches + git pull &> /dev/null || true # in case of branches echo "$committish" > ./.plugin_committish echo "Plugin ($plugin) updated and pinned to $committish" else