Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add files support for Azure DevOps #4414

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

JamieMagee
Copy link
Contributor

What kind of change does this PR introduce?

Files support for the Azure DevOps client

What is the current behavior?

ListFiles, LocalPath, and GetFileReader all throw an unsupported feature error.

What is the new behavior (if this is a feature change)?**

ListFiles, LocalPath, and GetFileReader have implementations

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Next step of #4177

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

Add files support to Azure DevOps client

@JamieMagee JamieMagee marked this pull request as ready for review November 15, 2024 20:59
@JamieMagee JamieMagee requested a review from a team as a code owner November 15, 2024 20:59
@JamieMagee JamieMagee requested review from justaugustus and spencerschrock and removed request for a team November 15, 2024 20:59
Copy link
Member

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level this looks good and matches the style in the other ones, but it's also late on a Friday. Left a few comments.

Out of curiosity, how do file-only based checks look like on your test repo now? Such as License, and Binary-Artifacts?

clients/azuredevopsrepo/zip.go Show resolved Hide resolved
clients/azuredevopsrepo/zip.go Outdated Show resolved Hide resolved
clients/azuredevopsrepo/zip.go Show resolved Hide resolved
clients/azuredevopsrepo/zip.go Outdated Show resolved Hide resolved
Signed-off-by: Jamie Magee <[email protected]>
@JamieMagee
Copy link
Contributor Author

At a high level this looks good and matches the style in the other ones, but it's also late on a Friday. Left a few comments.

Thank you! And I completely understand.

Out of curiosity, how do file-only based checks look like on your test repo now? Such as License, and Binary-Artifacts?

They look good. Here's are a couple of examples

No license
$ env SCORECARD_EXPERIMENTAL=1 go run . --repo dev.azure.com/jamiemagee/jamiemagee/_git/jamiemagee --checks License
Starting [License]
Finished [License]

RESULTS
-------
Aggregate score: 0.0 / 10

Check scores:
|--------|---------|---------------------------|--------------------------------------------------------------------|
| SCORE  |  NAME   |          REASON           |                     DOCUMENTATION/REMEDIATION                      |
|--------|---------|---------------------------|--------------------------------------------------------------------|
| 0 / 10 | License | license file not detected | https://github.com/ossf/scorecard/blob/main/docs/checks.md#license |
|--------|---------|---------------------------|--------------------------------------------------------------------|
With license
$ env SCORECARD_EXPERIMENTAL=1 go run . --repo dev.azure.com/jamiemagee/jamiemagee/_git/jamiemagee --checks License --commit d26320a77a943045905aed76a7c08a353b3bc3c2
Starting [License]
Finished [License]

RESULTS
-------
Aggregate score: 9.0 / 10

Check scores:
|--------|---------|-----------------------|--------------------------------------------------------------------|
| SCORE  |  NAME   |        REASON         |                     DOCUMENTATION/REMEDIATION                      |
|--------|---------|-----------------------|--------------------------------------------------------------------|
| 9 / 10 | License | license file detected | https://github.com/ossf/scorecard/blob/main/docs/checks.md#license |
|--------|---------|-----------------------|--------------------------------------------------------------------|
No binary artifacts
env SCORECARD_EXPERIMENTAL=1 go run . --repo dev.azure.com/jamiemagee/jamiemagee/_git/jamiemagee --checks Binary-Artifacts --commit d26320a77a943045905aed76a7c08a353b3bc3c2
Starting [Binary-Artifacts]
Finished [Binary-Artifacts]

RESULTS
-------
Aggregate score: 10.0 / 10

Check scores:
|---------|------------------|-------------------------------|-----------------------------------------------------------------------------|
|  SCORE  |       NAME       |            REASON             |                          DOCUMENTATION/REMEDIATION                          |
|---------|------------------|-------------------------------|-----------------------------------------------------------------------------|
| 10 / 10 | Binary-Artifacts | no binaries found in the repo | https://github.com/ossf/scorecard/blob/main/docs/checks.md#binary-artifacts |
|---------|------------------|-------------------------------|-----------------------------------------------------------------------------|
With binary artifacts
env SCORECARD_EXPERIMENTAL=1 go run . --repo dev.azure.com/jamiemagee/jamiemagee/_git/jamiemagee --checks Binary-Artifacts --commit 696984c21bbf3f37cf4d4809e0b4ff1051c40f09
Starting [Binary-Artifacts]
Finished [Binary-Artifacts]

RESULTS
-------
Aggregate score: 9.0 / 10

Check scores:
|--------|------------------|--------------------------------|-----------------------------------------------------------------------------|
| SCORE  |       NAME       |             REASON             |                          DOCUMENTATION/REMEDIATION                          |
|--------|------------------|--------------------------------|-----------------------------------------------------------------------------|
| 9 / 10 | Binary-Artifacts | binaries present in source     | https://github.com/ossf/scorecard/blob/main/docs/checks.md#binary-artifacts |
|        |                  | code                           |                                                                             |
|--------|------------------|--------------------------------|-----------------------------------------------------------------------------|

Copy link
Member

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the examples. Just a few minor things.

They look good. Here's are a couple of examples

Unrelated to this PR, I'm surprised AZDO doesn't allow Scorecard without a token for a public repo. I can access the web GUI just fine and view commits/files. But trying to run without a token (or with an anonymose connection):

Error: scorecard.Run: internal error: ListCommits:error during commitsHandler.setup: request for commits failed with TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.

clients/azuredevopsrepo/zip.go Outdated Show resolved Hide resolved
clients/azuredevopsrepo/zip.go Show resolved Hide resolved
clients/azuredevopsrepo/zip.go Outdated Show resolved Hide resolved
Signed-off-by: Jamie Magee <[email protected]>
@spencerschrock spencerschrock enabled auto-merge (squash) November 18, 2024 22:24
@spencerschrock spencerschrock merged commit 99b664e into ossf:main Nov 18, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants