0

I have a Pipelines (for yaml) repo and a Source (for product source) repo. The pipeline job does the work of cloning Sources for a build. This works - so long as "Don't sync sources" is checked in the pipeline / YAML / Get Sources (from Pipelines) tab. I'm to the point where I need to sync Pipelines for scripts that get dot-sourced by inline powershell.

I tried adding:

- checkout: self
  persistCredentials: true

discussed in another thread, but that didn't help.

steps:
  - powershell: |
      $commit = git ls-remote $ENV:REPOURL $ENV:BRANCH
      . "$(Build.SourcesDirectory)\PowerShell\awesome_stuff.ps1"
      Start-Awesome -WorkingDirectory  $(Agent.BuildDirectory) -CloningDirectory $ENV:CLONING_DIRECTORY -BranchName $ENV:BRANCH -RepositryUrl $ENV:REPOURL -Commit $commit
    errorActionPreference: continue
    displayName: "Run Awesome"

If I "Don't sync sources", awesome_stuff.ps1 doesn't exist. If I do sync, git ls-remote errors with:

fatal: could not read Username for 'https://proj.contoso.com': terminal prompts disabled
You cannot call a method on a null-valued expression.
B.McKee
  • 328
  • 1
  • 2
  • 15
  • From the Git side, all we can tell you is that access to the repository via https requires a user name and password (or PAT on GitHub). You've set things up with a system in which the user name is not supplied, and Git was about to ask for one when it noticed that the surrounding system told it: **never try to ask for a user name**, so it stopped at that point. – torek Sep 22 '21 at 06:18
  • You'll need to figure out how to get the surrounding system to provide the user name, or use a URL that does not require a separate user name (e.g., ssh URLs). – torek Sep 22 '21 at 06:19

1 Answers1

0

Manually cloning multiple repos worked.

I checked "Don't sync sources". and added a function to clone Pipelines under $(Agent.BuildDirectory)\Scripts\Pipelines, and that did not interfere the usual sources clone under $(Agent.BuildDirectory)\client\src.

B.McKee
  • 328
  • 1
  • 2
  • 15