7/6/2023 0 Comments Mytracks repository![]() ![]() The following example uses tags to check out the commit referenced by MyTag. The following example checks out the features/tools/ branch of the designated repository. When using a repository resource, specify the ref using the ref property. checkout: # checks out the commit referenced by MyTag. checkout: # also checks out the features/tools branch If you are using inline syntax, designate the ref by appending For example: - checkout: # checks out the features/tools branch The default branch is checked out unless you designate a specific ref. If you have any steps that depend on the source code being in the original location, those steps must be updated. For example, the code for a repository named tools would be checked out to C:\agent\_work\1\s when tools is the only repository, but if a second repository is added, tools would then be checked out to C:\agent\_work\1\s\tools. If you are using default paths, adding a second repository checkout step changes the default path of the code for the first repository. If (Agent.BuildDirectory) is C:\agent\_work\1 and your repositories are named tools and code, your code is checked out to C:\agent\_work\1\s\tools and C:\agent\_work\1\s\code. Multiple repositories: If you have multiple checkout steps in your job, your source code is checked out into directories named after the repositories as a subfolder of s in (Agent.BuildDirectory). If (Agent.BuildDirectory) is C:\agent\_work\1, your code is checked out to C:\agent\_work\1\s. Single repository: If you have a single checkout step in your job, or you have no checkout step which is equivalent to checkout: self, your source code is checked out into a directory called s located as a subfolder of (Agent.BuildDirectory). This directory is different depending on whether you are checking out a single repository or multiple repositories. Unless a path is specified in the checkout step, source code is placed in a default directory. ![]() If you specify any checkout steps, you must include checkout: self in order for self to be checked out. In the previous example, the self repository is not checked out. If your repository doesn't require a service connection, you can declare it inline with your checkout step. For more information on repository folder names and locations, see the following Checkout path section. In this example, the names of the repositories (as specified by the name property in the repository resource) are used for the folders, because no path is specified in the checkout step. If the self repository is named CurrentRepo, the script command produces the following output: CurrentRepo MyAzureReposGitRepo MyBitbucketRepo MyGitHubRepo. repository: MyAzureReposGitRepository # In a different organizationĮndpoint: MyAzureReposGitServiceConnection Name: MyBitbucketOrgOrUser/MyBitbucketRepo repository: MyGitHubRepo # The name used to reference this repository in the checkout step This example has four checkout steps, which checks out the three repositories declared as repository resources along with the current self repository that contains the pipeline YAML. The Azure Repos Git repository in another organization, GitHub, and Bitbucket Cloud repository resources require service connections, which are specified as the endpoint for those repository resources. In the following example, three repositories are declared as repository resources. You may use a repository resource even if your repository type doesn't require a service connection, for example if you have a repository resource defined already for templates in a different repository. Repository typeĪzure Repos Git repositories in a different organization than your pipeline The following repository types require a service connection. You must use a repository resource if your repository type requires a service connection or other extended resources field. When you check out Azure Repos Git repositories other than the one containing the pipeline, you may be prompted to authorize access to that resource before the pipeline runs for the first time.įor more information, see Why am I prompted to authorize resources the first time I try to check out a different repository? in the FAQ section. ![]()
0 Comments
Leave a Reply. |