Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[bug] Moon ci fails in Azure Devops Pull Request builds #1971

Copy link
Copy link
Open
@sharpepd

Description

@sharpepd
Issue body actions

Describe the bug

When running moon ci :myTask in a pull request in Azure DevOps, the build fails with the git diff command.

[DEBUG 23:25:22.271] moon_process::exec_command  Running command git merge-base 419774e6f5c5383cfbc17d8e25697122eac63659  pid=4884 env={} cwd="C:\\a\\1\\s"
[DEBUG 23:25:22.298] moon_process::exec_command  Running command git diff --name-status --no-color --relative --ignore-submodules -z refs/heads/main  pid=2428 env={} cwd="C:\\a\\1\\s"
Error: process::failed

  × Process git failed: exit code 128 
  │ 
  │ fatal: ambiguous argument 'refs/heads/main': unknown revision or path not
  │ in the working tree.
  │ Use '--' to separate paths from revisions, like this:
  │ 'git <command> [<revision>...] -- [<file>...]'

Steps to reproduce

  1. Create a pull request in Azure Devops for a merge to a branch with a build validation configured that runs a moon ci command.
  2. The step for running moon fails

Expected behavior

It is expected that moon ci shall correctly work in Azure DevOps in this scenario.

Screenshots

None

Environment

None


Additional context

We have done some investigation and what we are observing is that Azure Devops checks out in a detached head state and there is no local main branch created, which is leading to the error.

We have found that if we use the --base option as follows, we can work around the issue.

--base $(System.PullRequest.targetBranchName)

This is not ideal though, as this will only work if the target branch is single word. Branches like foo/bar would fail. Azure Devops provides the variable System.PullRequest.targetBranch but this is prefixed with refs/heads/, which the conan ci command does not handle.

Attached logs:

  • checkout.log
    checkout.log: Azure pipeline logs of the checkout it does.

  • moon.log: Azure pipeline log of the moon ci command.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.