-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Support default tofu version #41
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
feature: support `TOFUENV_TOFU_DEFAULT_VERSION` env variable to provide a default version for all operations ([#34](https://github.com/tofuutils/tofuenv/issues/34)) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,14 @@ function tofuenv-version-name() { | |
&& log 'debug' "TOFUENV_VERSION_FILE retrieved from tofuenv-version-file: ${TOFUENV_VERSION_FILE}" \ | ||
|| log 'error' 'Failed to retrieve TOFUENV_VERSION_FILE from tofuenv-version-file'; | ||
|
||
TOFUENV_VERSION="$(cat "${TOFUENV_VERSION_FILE}" || true)" \ | ||
&& log 'debug' "TOFUENV_VERSION specified in TOFUENV_VERSION_FILE: ${TOFUENV_VERSION}"; | ||
|
||
TOFUENV_VERSION_SOURCE="${TOFUENV_VERSION_FILE}"; | ||
if [[ -f "${TOFUENV_VERSION_FILE}" ]]; then | ||
TOFUENV_VERSION="$(cat "${TOFUENV_VERSION_FILE}" || true)" \ | ||
&& log 'debug' "TOFUENV_VERSION specified in TOFUENV_VERSION_FILE: ${TOFUENV_VERSION}"; | ||
TOFUENV_VERSION_SOURCE="${TOFUENV_VERSION_FILE}"; | ||
else | ||
TOFUENV_VERSION="${TOFUENV_TOFU_DEFAULT_VERSION:-"latest"}"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Continuing my comment in the discussion, I suggest setting the version to an empty string by default, ex. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anastasiiakozlova245 Won't that mean that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @orbitz could you please clarify what you mean by not having a consistent behaviour? As stated in the docs, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps I'm confused bu but
However, with this change:
This is the behaviour I would expect, is this not the behaviour you would expect? If so, what is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @orbitz I believe when you call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there are a few things to consider:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just bumping this discussion. |
||
TOFUENV_VERSION_SOURCE='TOFUENV_TOFU_DEFAULT_VERSION'; | ||
fi; | ||
|
||
else | ||
TOFUENV_VERSION="${TOFUENV_TOFU_VERSION}" \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ function test_uninstall() { | |
tofuenv install "${v}" || return 1; | ||
tofuenv uninstall "${v}" || return 1; | ||
log 'info' 'Confirming uninstall success; an error indicates success:'; | ||
check_active_version "${v}" && return 1 || return 0; | ||
env TOFUENV_AUTO_INSTALL=false "${TOFUENV_ROOT}/bin/tofu" version && return 1 || return 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I bypass the helper function here, but this guarantees that |
||
}; | ||
|
||
log 'info' '### Test Suite: Uninstall Local Versions'; | ||
|
@@ -88,13 +88,13 @@ done; | |
echo "### Uninstall removes versions directory" | ||
cleanup || error_and_die "Cleanup failed?!" | ||
( | ||
tofuenv install 1.6.0-beta5 || exit 1 | ||
tofuenv install 1.6.0-beta4 || exit 1 | ||
[ -d "./versions" ] || exit 1 | ||
tofuenv uninstall 1.6.0-beta5 || exit 1 | ||
[ -d "./versions" ] || exit 1 | ||
tofuenv uninstall 1.6.0-beta4 || exit 1 | ||
[ -d "./versions" ] && exit 1 || exit 0 | ||
tofuenv install 1.6.0-beta5 || error_and_die "Failed to install 1.6.0-beta5" | ||
tofuenv install 1.6.0-beta4 || error_and_die "Failed to install 1.6.0-beta" | ||
[ -d "./versions" ] || error_and_die "Versions directory does not exist" | ||
tofuenv uninstall 1.6.0-beta5 || error_and_die "Failed to uninstall 1.6.0-beta5" | ||
[ -d "./versions" ] || error_and_die "Versions directory does not exist - 2" | ||
tofuenv uninstall 1.6.0-beta4 || error_and_die "Failed to uninstall 1.6.0-beta4" | ||
[ -d "./versions" ] && error_and_die "Versions directory exists but shouldn't" || exit 0 | ||
) || error_and_proceed "Removing last version deletes versions directory" | ||
|
||
if [ "${#errors[@]}" -gt 0 ]; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please also rename 47.txt to 41.txt - filename should point to pull request number