3

This is what I want to do, as soon as someone in your org create a repository in Azure DevOps (or GitHub), a defined project scaffold/structure is build for them. For example, a fresh repo (my_proj) is created, then DevOps/GitHub creates such a folder structure for you (you defined it somewhere):

───my_proj
   │   ReadMe.md
   │
   ├───docs
   ├───res
   │   ├───file
   │   └───img
   ├───scr
   └───tests

I know you can do these things after you clone the repo using some codes/libraries, but is there a way to do it automatically?

mas
  • 339
  • 7
  • 22

1 Answers1

2

As mentioned in "Create template git-repo in in azure devops", there is no native feature allowing you to chose a given Git repository template when initializing a new Project with Azure DevOps.

That means you could:

  • clone a template repository (created in advance on Azure DevOps=
  • push it back to your new empty Azure DevOp repository (by changing its URL with git remote set-url ...)

You can see that approach atomated through Azure piplines with "Create a new repository from a template in Azure DevOps" from Stephen Allwright

  1. Create a repository in Azure DevOps that you would like to use as your template. Let's call it 'project-template'
  2. Create a second repository to contain the build pipeline you will create. We will call this 'utilities'. This is a useful repository to have in general to house all your automation pipelines and other functions which improve the ease of development
  3. Create a starter build pipeline and host it within the utilities repository
  4. Create a variable within the pipeline UI called 'project-name', this will be used as the name of your newly created repository. Defining this variable within the UI allows us to choose a project name when we run the pipeline in DevOps
  5. Use the following code, making sure to replace 'devops-organisation', 'devops-project', 'email', and 'user' with your own values
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks! don't you think this should be a native feature? or I'm missing something here – mas Nov 25 '21 at 22:14
  • 1
    @mas It absolutely could, as it is already for GitHub (owned by Microsoft, which hosts Azure): https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository. I don't see that feature in past releases, or in preview though: https://azure.microsoft.com/en-us/updates/?category=developer-tools,devops&query=template – VonC Nov 25 '21 at 22:33