Giter VIP home page Giter VIP logo

Comments (27)

fraserdarwent avatar fraserdarwent commented on July 19, 2024 4

Ran into the same issue. Docs definitely misleading.

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024 3

For completeness and @ngnkm if you still have issues, the workaround is correct but:

  • the command can be simplified into git -c http.extraheader=... clone -b master since the extra header will apply only to the current command so no need to specify a particular remote host
  • you can also use the extraheader Authorization: Basic <token> and generate the token based on a username and a personal access token (PAT), for example with the PowerShell command:
    $Authorization = "Authorization: Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('$(User):$(PAT)'))
    git clone -c http.extraheader="$Authorization" -b master $(RepoURL) $(Build.SourcesDirectory)/extra_repo
    This has the advantage of working with a GitHub repository. You can generate a PAT in your GitHub account settings.

from azure-pipelines-yaml.

michaelw85 avatar michaelw85 commented on July 19, 2024 3

I was running into similar issues trying to use ARM templates from a different repo in my multistage yaml pipeline.

I managed to clone the dependent repo using the header info from the repo you are currently using.

      - checkout: self
        clean: true
        persistCredentials: true

      - powershell: |
          $origin = git config remote."origin".url
          $extraheader = git config http.$origin.extraheader
          git clone -c http.extraheader="$extraheader" --depth 1 --branch ${{ parameters.branch }} ${{ parameters.repo }}
        displayName: Git clone
        workingDirectory: $(Build.SourcesDirectory)

Edit: Updated the example to be more generic

from azure-pipelines-yaml.

samiyaakhtar avatar samiyaakhtar commented on July 19, 2024 2

@ngnkm Nope this checkout step from azure-pipelines for an external repo doesn't work and their documentation is clearly messed up. Instead I ended up doing a manual git clone step through a shell script.

from azure-pipelines-yaml.

JamesDLD avatar JamesDLD commented on July 19, 2024 2

The "self" option on the checkout's task permits to checkout the repo where the initial Pipelines YAML file was found.
You currently can't replace this option with the name of your repo.
At the time speaking if you want to checkout your github repo with the "checkout" task you need to move your YAML file on your github repo.

Multi-repository support for YAML pipelines is planned for Q3 2019 in Azure DevOps roadmap and this might solve your issue, stay tunned : Azure DevOps Roadmap Q3 - ITEM 1454026

from azure-pipelines-yaml.

drdamour avatar drdamour commented on July 19, 2024 1

The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed

however if u came here looking for some secret sauce like me for something like tricking terraform to use the pipelines creds when importing modules from other DevOps repos in your project the secret is in this thread...kinda. The hint about PATs is good for non DevOps repos but if you are in DevOps repos there’s an easier command from
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#authorize-access-to-your-repositories

‘git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" ’

So the secret is that variable pipelines injects no need to generate it yourself. I passed that to terraform (via global git config trickery)

from azure-pipelines-yaml.

gswallow avatar gswallow commented on July 19, 2024 1

I have a Terraform project that includes another module in a private github repository and terraform init fails due to me needing to use a Github PAT. Do I still have to do this? If so, why?

  - checkout: self
    clean: true
    persistCredentials: true
  - task: Bash@3
    name: Add_Git_Credentials_to_Global_ExtraHeader_Config
    displayName: Add Git Credentials to http.extraheader
    inputs:
      targetType: inline
      script: |
        origin=$(git config remote.origin.url)
        origin=${origin%.git}
        git config http.extraheader "$(git config http.${origin}.extraheader)"

from azure-pipelines-yaml.

ngnkm avatar ngnkm commented on July 19, 2024

Hello.
Did you get a solution about this error?
Please let me know if that is the case.
Thanks

from azure-pipelines-yaml.

ngnkm avatar ngnkm commented on July 19, 2024

thanks for your response. Now I'm trying to clone my repo via a git clone command but the authorization failed. How did you configure it? I used this command but it's doesn't work. git -c http.https:*******/_git/*****.extraheader="AUTHORIZATION: bearer *******" clone https:*****/_git/**** --branch master

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024

Bump - Is there any plan/timeline to support this feature? This would be much easier than doing some manual git clone with custom PAT-based authorization, which is always tricky to get right and safe. Also the documentation should be updated to not advertise the feature if it is not implemented.

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024

Thanks @JamesDLD. In that case can you please fix the Azure Pipeline YAML documentation which currently suggests this feature is already implemented, as noted by @samiyaakhtar?

from azure-pipelines-yaml.

JamesDLD avatar JamesDLD commented on July 19, 2024

Indeed the doc highlighted by @samiyaakhtar here on GitHub shows that we can use other parameters that "none" or "self" in the "checkout" task..
This is probably being released, hopefully!
Note that I am not working at Microsoft about your ask about updating MS doc.

At the time writting the official documentation indicates only two options :
image

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024

Ok sorry @JamesDLD I didn't check you profile.
The docs points by @samiyaakhtar is the master branch, maybe we're too early and the feature is being rolled out but didn't make it to prod yet. That would be consistent with the roadmap you linked.

from azure-pipelines-yaml.

blacklabnz avatar blacklabnz commented on July 19, 2024

same issues here, not sure the document says about and even give instruction on features that are not there.

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024

Yes but this is very annoying and error prone. Your case is quite simple @michaelw85, so your solution works here. But things get complicated fast when cloning repositories with submodules for example, or when trying to optimize checkout of a particular commit for large repos like the built-in checkout does. Also some hosts like GitHub don't support checking out random commits, only refs, so you need a more complex series of commands.

Also incidentally git commands output to stderr, which powershell assumes are errors, so you should make sure to handle that to avoid spurious failures. See again the built-in checkout. There is a flag failOnStderr on the powershell task, but it doesn't work for me. So I ended up wrapping all my git commands with a PS function call capturing stderr and checking the exit code instead for errors. My checkout script is now 50 lines or so.

All of that to say, this could be handled by the built-in checkout, probably should for the sake of users, and hopefully will be soon as @JamesDLD pointed.

from azure-pipelines-yaml.

djee-ms avatar djee-ms commented on July 19, 2024

I just found that doc which very clearly says this is supported and details the steps to configure multiple repositories. I am assuming this is not rolled out yet?

from azure-pipelines-yaml.

andreujuanc avatar andreujuanc commented on July 19, 2024

I can't even do checkout:self, i get ""Checkout of multiple repositories is not supported."
Troubleshoot".
I think priority for this work item should be increased, checking out multiple repos is a must.

UPDATE:
I figured out it was because the checkout:self cannot appear multiple times. Error message is misleading, because it's not multiple repos, but multiple times the same repo.

from azure-pipelines-yaml.

graham768 avatar graham768 commented on July 19, 2024

Looks like this feature is still in development for Q4, but I found some more official documentation for a workaround if anyone is still struggling with this before the release comes
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/pipeline-options-for-git?view=azure-devops#clone-a-second-repo

from azure-pipelines-yaml.

ericycs avatar ericycs commented on July 19, 2024

The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed

Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.

from azure-pipelines-yaml.

drdamour avatar drdamour commented on July 19, 2024

The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed

Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.

U setup that alias in the resources section per the docs?

from azure-pipelines-yaml.

ericycs avatar ericycs commented on July 19, 2024

The recent DevOps rollout has this multi checkout natively supported now and docs seemed updated...so I think this can be closed

Not working on my devops org yet.
Getting error:
Checkout of repository 'otherRepo' is not supported. Only 'self', 'none', or a repository alias are supported.

U setup that alias in the resources section per the docs?

Found the issue. Doesn't work in deployment job. Will be fixed in 3 week in next rollout as per this issue item:
https://github.com/MicrosoftDocs/vsts-docs/issues/6683

from azure-pipelines-yaml.

nbfva1 avatar nbfva1 commented on July 19, 2024

The checkout: self works fine but a checkout: myrepo , defined in a resources: list fails with fatal: repository 'myrepo...' not found

The url shown in line 20 is correct and works with a manual git clone etc

image

from azure-pipelines-yaml.

stale avatar stale commented on July 19, 2024

In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community. Sorry for any confusion resulting from this move.

from azure-pipelines-yaml.

Saibamen avatar Saibamen commented on July 19, 2024

Moved into Developer Community: https://developercommunity.visualstudio.com/content/problem/1007479/unable-to-checkout-external-repo.html
Please use "Follow" button on the right to track it

from azure-pipelines-yaml.

Saibamen avatar Saibamen commented on July 19, 2024

@samiyaakhtar: Please go to this link and check if this issue is still happen: https://developercommunity.visualstudio.com/content/problem/1007479/unable-to-checkout-external-repo.html

from azure-pipelines-yaml.

samiyaakhtar avatar samiyaakhtar commented on July 19, 2024

@Saibamen seems to be working now, thanks!

from azure-pipelines-yaml.

airowe avatar airowe commented on July 19, 2024

Getting this error now. Is it a versioning issue?

from azure-pipelines-yaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.