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

🐛 Parse Gitlab Status fields to align w/Github Status and Conclusion #3706

Merged
merged 5 commits into from
Dec 4, 2023

Conversation

ashearin
Copy link
Contributor

What kind of change does this PR introduce?

Introduces code to parse status returned from gitlab to align with github status and conclusion fields

What is the current behavior?

When populating checkruns from Gitlab commits, we currently assign the gitlab status to the checkrun status and leave the conclusion blank (Since gitlab does not have an equivalent field, the gitlab status field is roughly a combination of the github status and conclusion fields)

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

Added a function to parse the gitlab status into the appropriate github equivalent status and conclusion. In most cases the Conclusion is still empty (since the pipeline is not completed), but the status will match the equivalent Github status.

References:

  • GItlab Status Enum

  • Github CheckRun Docs

    • looking at the response schema for status and conclusion fields
  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #3396

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.)


@ashearin ashearin requested a review from a team as a code owner November 29, 2023 23:45
@ashearin ashearin requested review from spencerschrock and laurentsimon and removed request for a team November 29, 2023 23:45
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #3706 (eb6ffe5) into main (ce0b54e) will decrease coverage by 5.53%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3706      +/-   ##
==========================================
- Coverage   76.31%   70.78%   -5.53%     
==========================================
  Files         210      210              
  Lines       14371    14397      +26     
==========================================
- Hits        10967    10191     -776     
- Misses       2757     3614     +857     
+ Partials      647      592      -55     

clients/gitlabrepo/checkruns.go Outdated Show resolved Hide resolved
clients/gitlabrepo/checkruns.go Show resolved Hide resolved
ashearin and others added 4 commits December 4, 2023 09:01
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
* Trust pinned GitHub download URLs

 Trust files that are downloaded from `raw.githubusercontent.com` where the file's ref is a Git SHA and therefore immutable.
Resolves ossf#3339.
Signed-off-by: martincostello <martin@martincostello.com>

* Move logic to function

- Add `hasUnpinnedURLs` function.
- Add test cases for different URLs.
Signed-off-by: martincostello <martin@martincostello.com>

* Fix formatting

Appease the linter.
Signed-off-by: martincostello <martin@martincostello.com>

* Suppress lint warnings

Suppress warning on three long URLs.
Signed-off-by: martincostello <martin@martincostello.com>

* Address peer review

Address peer review feedback.
Signed-off-by: martincostello <martin@martincostello.com>

* Fix lint warning

Fix lint warning.
Signed-off-by: martincostello <martin@martincostello.com>
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.16.1 to 0.17.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.16.1...v0.17.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
@spencerschrock spencerschrock merged commit e4fc815 into ossf:main Dec 4, 2023
36 checks passed
@ashearin ashearin deleted the gitlab-conclusion-fields branch December 11, 2023 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitLab job/pipeline don't have conclusion fields
3 participants