Giter Site home page Giter Site logo

Comments (6)

IMDiSc avatar IMDiSc commented on June 2, 2024

One thing that comes to mind would be the following:

Instead of creating a PAT, base64 encode that with : in front of it and passing that to the reportgenerator task,

why not do the same, but use the predefined $(System.AccessToken) variable?

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#systemaccesstoken

from reportgenerator.

IMDiSc avatar IMDiSc commented on June 2, 2024

Updated my OP
Adding the custom settings with the header does solve the errors about not being able to access the file, however when I look at the report, I still see HTML code for the Azure DevOps signin page.

I also went ahead and tried the following combinations:

  • Use Authorization=Bearer $(System.AccessToken)
    This also got rid of the errors, but still the same issue with the HTML being shown
  • Use Authorization=Basic $(System.AccessToken)
    Same result as above, weirdly. I'd expect a error here about not being able to authorize
  • Added a powershell task right before the reportgenetor one, which would base64 encode my PAT (stored in Library group) and then publish the encoded value as a variable, which i'd then use in the reportgenerator task.

from reportgenerator.

IMDiSc avatar IMDiSc commented on June 2, 2024

Just found #574, which is exactly what I'm experiencing but there the custom header thing solved it

from reportgenerator.

IMDiSc avatar IMDiSc commented on June 2, 2024

Just had a look at the XML of the coverage.cobertura.xml file on the build server.

This is such a class element:

<class name="MyFile" filename="https://dev.azure.com/<org>/<project>/_apis/git/repositories/<repo>/items?api-version=1.0&amp;versionType=commit&amp;version=cd08f3ea70b6f2af6759105e6354412912f4607a&amp;path=/path/to/MyFile.cs" line-rate="0" branch-rate="1" complexity="1">
	<methods>
		<method name="Slice" signature="(T[],System.Int32,System.Int32)" line-rate="0" branch-rate="1" complexity="1">
			<lines>
				<line number="9" hits="0" branch="false"/>
				<line number="10" hits="0" branch="false"/>
				<line number="11" hits="0" branch="false"/>
			</lines>
		</method>
	</methods>
	<lines>
		<line number="9" hits="0" branch="false"/>
		<line number="10" hits="0" branch="false"/>
		<line number="11" hits="0" branch="false"/>
	</lines>
</class>

When I manually visit the URL, I expected the file to be shown.
Instead, I got a JSON response:

{
    "count": 1,
    "value": [
        {
            "objectId": "ff0f119466f3a659fccfbc3c55da2a7f010d688f",
            "gitObjectType": "tree",
            "commitId": "437a707e7c785092f2bc86876e60a4ba3d6f5c61",
            "path": "/",
            "isFolder": true,
            "url": "https://dev.azure.com/<org>/e02f8955-9af5-4c0b-b176-6d84d4bf262f/_apis/git/repositories/5b4d0245-81fb-49de-b9fd-c3a6c29010da/items?path=%2F&versionType=Branch&versionOptions=None"
        }
    ]
}

Replaced sensitive data with placeholders in the URLs ofcourse

from reportgenerator.

IMDiSc avatar IMDiSc commented on June 2, 2024

If I however manually fix the URL from
https://dev.azure.com/<org>/<proj>/_apis/git/repositories/<repo>/items?api-version=1.0&amp;versionType=commit&amp;version=cd08f3ea70b6f2af6759105e6354412912f4607a&amp;path=/Path/To/MyFile.cs
to
https://dev.azure.com/<org>/<proj>/_apis/git/repositories/<repo>/items?api-version=1.0&versionType=commit&version=cd08f3ea70b6f2af6759105e6354412912f4607a&path=/Path/To/MyFile.cs

I do get back the file contents.

So this might be an issue in coverlet / coberatura then?

from reportgenerator.

IMDiSc avatar IMDiSc commented on June 2, 2024

After going through this file:

if (path.StartsWith("http://") || path.StartsWith("https://"))

I'd figured I give clearing that cache folder a go.

And it seems to be working correctly now, so I'll go ahead and close this for now.

My build pipelines heavily relies on templates from another repository, in which I was making most changes. So that's probably why it would grab the cached items, because the commit hash of the actual repo being built hadn't changed.

from reportgenerator.

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.