Skip to content

Fix regression on loading existing environments - #1219

Merged
ellismg merged 1 commit into
Azure:mainfrom
ellismg:ellismg/fix-upgrade-regression
Nov 29, 2022
Merged

Fix regression on loading existing environments#1219
ellismg merged 1 commit into
Azure:mainfrom
ellismg:ellismg/fix-upgrade-regression

Conversation

@ellismg

@ellismg ellismg commented Nov 29, 2022

Copy link
Copy Markdown
Member

In #1202 we added a config.json file in the environment, which we use to persist configured values for required infrastructure parameters which are not set in .parameters.json files.

As part of that logic, we made it so that the constructor of the environment would validate that a config.json file was present in the environment and if not, fail (similar to the check it already did for the .env file).

This worked for new environments, since .Save() will always write an empty config.json file. But for existing environments, the read of the config.json would fail, with ErrNotExists, which would be wrapped up and returned to the caller. The caller would use the ErrNotExists to mean "the environment doesn't exist" and so it would prompt the user to see if they wanted to create it.

Rework the constructor such that we return ErrNotExists when the directory for the environment doesn't exist, instead of using the existence of the .env file to mean anything and add some unit tests for these cases.

In Azure#1202 we added a `config.json` file in the environment, which we
use to persist configured values for required infrastructure
parameters which are not set in `.parameters.json` files.

As part of that logic, we made it so that the constructor of the
environment would validate that a `config.json` file was present in
the environment and if not, fail (similar to the check it already did
for the .env file).

This worked for new environments, since `.Save()` will always write an
empty `config.json` file. But for existing environments, the read of
the config.json would fail, with ErrNotExists, which would be wrapped
up and returned to the caller. The caller would use the ErrNotExists
to mean "the environment doesn't exist" and so it would prompt the
user to see if they wanted to create it.

Rework the constructor such that we return ErrNotExists when the
directory for the environment doesn't exist, instead of using the
existence of the `.env` file to mean anything and add some unit tests
for these cases.
@ellismg ellismg added the blocker Blocks release or critical path label Nov 29, 2022
@ghost ghost assigned ellismg Nov 29, 2022
@azure-sdk

Copy link
Copy Markdown
Collaborator

Azure Dev CLI Install Instructions

Install scripts

MacOS/Linux

May elevate using sudo on some platforms and configurations

bash:

curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/install-azd.sh | bash -s -- --base-url https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219 --version '' --verbose

pwsh:

Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219' -Version '' -Verbose

Windows

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1219' -Version '' -Verbose;"

Standalone Binary

Container

docker run -it azdevcliextacr.azurecr.io/azure-dev:pr-1219

@ellismg
ellismg merged commit 402c8af into Azure:main Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker Blocks release or critical path

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants