azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

[Issue] Simplify azd installation process (dependencies)

Open savannahostrowski opened this issue 3 years ago • 8 comments

This week I had to fresh install WSL with Ubuntu because something went terribly wrong on my machine (unrelated to azd). However, this had me walk through the installation process again from scratch, it went something like this:

  • Install azd
  • Try to run azd up on an existing repo (todo-python-mongo)
  • Get error
  • Realize I was missing az, + go off to grab install command from their docs
  • Install az (see #709)
  • Authenticate az
  • Try to run azd up
  • Get error
  • Realize I don't have gh installed + go off to docs to grab install command from their docs
  • Go here https://github.com/cli/cli/blob/trunk/docs/install_linux.md to install
  • Authenticate gh
  • Run azd up again
  • Get error
  • Realize I'm missing node and npm
  • Go to their docs to grab install command
  • Install node
  • Install npm
  • Run azd up again
  • Success

I'm filing this as a separate issue from az dependency removal because this progressive disclosure of missing dependencies was really gnarly. That's quite a few steps to get started. You could argue that I could have just read the docs and found out the prerequisites but I still would have been required to jump around a bunch of places to find the right commands to install for my OS (still many steps before I get to actually azd up).

Is there a way that we can prompt to install the dependencies on behalf of the user if we detect they are missing during azd install so this becomes a single step? Open to suggestions here!

Moreover, should we consider having a command to check that a user has the dependencies to run the template locally (because node/npm are only required for templates that use JS)?

savannahostrowski avatar Oct 05 '22 22:10 savannahostrowski

Templates should describe what dependencies are required (maybe in azure.yaml) and then azd can do all the checks upfront.

jongio avatar Oct 05 '22 23:10 jongio

@jongio That makes sense to me on the template dep side.

Do you have thoughts around how we can simplify the overall dependency story for azd? Ideally, it'd be nice to make it so that a developer doesn't have to jump around from doc to doc to find installation instructions and so that missing dependencies are surfaced right away (not progressively disclosed). Is there anything we could do in azd to install on behalf of a user? Are there limitations there? Other similar CLIs don't have dependencies like we do AFAIK.

Additionally, the GH CLI as a dependency is just needed for pipeline config? Right?

savannahostrowski avatar Oct 06 '22 19:10 savannahostrowski

@rajeshkamal5050 - Would be good to have someone map out azd dependencies vs azd template dependencies and come up with a plan to address assessing them in bulk.

jongio avatar Oct 10 '22 18:10 jongio

Yes, agreed @jongio @savannahostrowski.

Adding it to On Deck to get this prioritized in our next iteration.

rajeshkamal5050 avatar Oct 10 '22 19:10 rajeshkamal5050

We're also missing one of Bicep CLI or Terraform CLI being mentioned as a dependency in our docs.

weikanglim avatar Oct 11 '22 16:10 weikanglim

Bicep is auto installed by the azure cli, so we'll need to make sure that is covered in the az effort that @wbreza is doing.

jongio avatar Oct 11 '22 17:10 jongio

Potentially add an install.sh / install.cmd to the root of each template repo that xcopies down azd but also does the checks/brings down other dependencies. Other solutions I've seen put azd.sh or azd.cmd in the root, that script passes all args through to azd.exe if it's found, if it's not found, it will go get it and then run it.

Petermarcu avatar Oct 14 '22 17:10 Petermarcu

Would be good to categorize different dependencies as well. It's good to check for all up front and give good warnings. For certain ones, getting it for the user is a good answer, for others, it's better to have them get it and configure it themselves.

Petermarcu avatar Oct 14 '22 17:10 Petermarcu

I think we want to investigate:

  • avoiding having the user install Bicep CLI
  • inlining gh CLI logic to remove that dependency

Can we get to a point where our only dependency is git?

savannahostrowski avatar Nov 17 '22 18:11 savannahostrowski

@rajeshkamal5050 Can we prioritize investigating removing the gh CLI dependency during the next iteration?

savannahostrowski avatar Jan 17 '23 23:01 savannahostrowski

This is also surfaced as issues in recent user study (https://github.com/Azure/azure-dev/issues/1401.)

We should prioritize prompting to install git on behalf of the user if we detect they are missing it during azd install. Template pre-req can come later.

puicchan avatar Jan 18 '23 02:01 puicchan

This issue has evolved and contains a few requirements. @savannahostrowski , can you help me identify what's what we still want here?

  • [ ] Removing github cli dependency.
  • [ ] Adding bootstrap script to all templates to install all dependencies locally. (Should we recommend folks using the devcontainer instead?)

Have you considered having an azd command to validate dependencies (probably on the same category as a command which checks that a template is valid)

vhvb1989 avatar Jan 31 '23 21:01 vhvb1989

For this issue, it's just exploring removing our dependency on the GH CLI for pipeline config. IIRC, it didn't sound like this was too complicated.

Adding bootstrap script to all templates to install all dependencies locally. (Should we recommend folks using the devcontainer instead?)

I view this as a separate ask as this issue is just around the tool installation process. I'm not sure that I've been in conversations where this was discussed. I'm not sure that's the approach I'd take.

savannahostrowski avatar Jan 31 '23 21:01 savannahostrowski

@savannahostrowski @rajeshkamal5050 Similar to the Azure CLI, the heaviest load from the GitHub cli is the authentication. We can implement the calls we are currently depending on the ghcli with a REST/GraphQL client, but all requests require an authorization token. So, we would need to do something similar to what we currently do for Azure DevOps and request users to provide a PAT to talk to github. Right now, when gh cli is not logged in, we just ask folks to run gh login.
So, instead, we would ask folks to enter a token. Would that be fine?

vhvb1989 avatar Jan 31 '23 21:01 vhvb1989

I would prefer if we didn't have users input a token because that would require a context switch and a bunch of jumping around to generate the PAT.

savannahostrowski avatar Jan 31 '23 22:01 savannahostrowski

I would prefer if we didn't have users input a token because that would require a context switch and a bunch of jumping around to generate the PAT.

Then, are we keeping the gh cli in favor of just asking users to run gh login ? It wouldn't feel right to implement GitHub login with azd. We could explore shipping the gh cli together with azd, and let azd to invoke gh login during azd pipeline config

vhvb1989 avatar Jan 31 '23 22:01 vhvb1989

@vhvb1989 If we've completed the gh CLI work, I'm going to close this for now. Feel free to re-open if there are other things we want to do.

savannahostrowski avatar Feb 18 '23 00:02 savannahostrowski