Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
408 stars 198 forks source link

[pipeline config] Add one-time confirmation for the remote #4197

Open vhvb1989 opened 2 months ago

vhvb1989 commented 2 months ago

When you have cloned a repo (or started a codespace) and you project is still tracking a git remote back to that repository, azd would return an error trying to configure that repo (as the user is not the owner).

If you run git remote -v you would see remote origin is set to the source repo.

May be adding a confirmation during azd pipeline config like:

azd pipeline config Found remote: origin for Organization: Azure-Samples and Repo: openai-chat-vision-quickstart Do you want to configure CI/CD for this repository now? [select an option, default Yes] Yes, continue to configure this remote No, remove this remote and let me select (or create a new) repository for this remote.

The new option would make azd to remove the remote (divorce your project from the main Sample’s repo) and configure a new one. Azd would add an ENV VAR to skip this prompt after user confirmation (we ideally want it just for the first time).

optionally, we can offer folks to clean all git history.

rajeshkamal5050 commented 2 months ago

@vhvb1989 can you capture the manual steps for removing the remote and configuring a new one. Just in-case if anyone needs it before we do this enhancement.

vhvb1989 commented 2 months ago

Sure. For listing existing remotes, run git remote -v The common case is to see one remote with the name origin following the original template's repository. For removing that remote, folks would run git remote remove origin (or use the name of the remote to remove)

Then folks can run azd pipeline config and let azd to set up a new remote for origin.

Optionally, if folks needs to keep the current origin remote, they can run azd pipeline config --remote-name other to configure a remote with the name other instead of using origin.