Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 00da7a8be965c09d044f978d6b9eafee1350bd30
Author: Azeem Shaikh <azeemshaikh38@gmail.com>
Date:   Tue Mar 14 23:07:19 2023 +0000

    Pr comments

commit 1127dd9
Merge: 274448f 23bd295
Author: Azeem Shaikh <azeemshaikh38@gmail.com>
Date:   Wed Mar 15 04:23:32 2023 +0530

    Merge branch 'main' into go-git

commit 274448f
Author: Azeem Shaikh <azeemshaikh38@gmail.com>
Date:   Tue Mar 14 22:52:30 2023 +0000

    Initial implementation of go-git client

    Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>

commit 23bd295
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Mar 14 20:28:41 2023 +0000

    :seedling: Bump github/codeql-action from 2.2.4 to 2.2.6 (#2741)

commit fc026ef
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Mar 14 17:04:31 2023 +0000

    :seedling: Bump github.com/google/ko from 0.12.0 to 0.13.0 in /tools (#2742)

commit 2e04214
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Mar 14 14:02:34 2023 +0000

    :seedling: Bump tj-actions/changed-files from 35.6.2 to 35.7.0

    Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 35.6.2 to 35.7.0.
    - [Release notes](https://github.com/tj-actions/changed-files/releases)
    - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
    - [Commits](tj-actions/changed-files@5ce975c...bd376fb)

    ---
    updated-dependencies:
    - dependency-name: tj-actions/changed-files
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

commit e36b590
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Mar 14 08:59:20 2023 -0500

    :seedling: Bump actions/cache from 3.3.0 to 3.3.1 (#2740)

    Bumps [actions/cache](https://github.com/actions/cache) from 3.3.0 to 3.3.1.
    - [Release notes](https://github.com/actions/cache/releases)
    - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
    - [Commits](actions/cache@940f3d7...88522ab)

    ---
    updated-dependencies:
    - dependency-name: actions/cache
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 6ff94eb
Author: Gabriela Gutierrez <gabigutierrez@google.com>
Date:   Mon Mar 13 19:42:37 2023 +0000

    :bug: Handle editable pip installs (#2731)

    * fix: Handle editable pip install

    Editable pip installs (-e) should be considered secure if the package is installed from a local source or a remote source (VCS install) but pinned by commit hash. To keep the behaviour we have for normal pip installs, we need to guarantee the package dependencies are pinned by hash too. For normal pip installs, we verify that by using --require-hashes flag. Unfortunately, --require-hashes flag is not compatible with editable installs, so we use --no-deps flag to verify the dependencies are not installed since we can't verify if they are pinned.

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Editable pip install in GHA

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Editable pip install in Dockerfile

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Editable pip install in shell script

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * fix: Code complexity increase

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * fix: Simplify boolean return

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * docs: Add pip editable install references in comments

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * fix: Handle multiple packages in editable pip install

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Multi editable pip install in GHA

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Multi editable pip install in Dockerfile

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    * test: Multi editable pip install in shell script

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>

    ---------

    Signed-off-by: Gabriela Gutierrez <gabigutierrez@google.com>
    Co-authored-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>

commit 110e352
Author: raghavkaul <8695110+raghavkaul@users.noreply.github.com>
Date:   Mon Mar 13 11:13:50 2023 -0400

    ✨ Gitlab support: RepoClient (#2655)

    * Add make targets and E2E test target for GitLab only

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>

    * Add GitLab support to RepoClient

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>

    * Build

    * Make target for e2e-gitlab-token
    * Only run Gitlab tests in CI that don't require a token

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>

    * Add tests

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>

    * Remove spurious printf

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>

    * 🐛 Check OSS Fuzz build file for Fuzzing check (#2719)

    * Check OSS-Fuzz using project list

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Use clients.RepoClient interface to perform the new OSS Fuzz check

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * wip: add eager client for better repeated lookup of projects

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Split lazy and eager behavior into different implementations.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Add tests and benchmarks

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Switch to always parsing JSON to determine if a project is present. The other approach of looking for a substring match would lead to false positives.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Add eager constructor to surface status file errors sooner.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Switch existing users to new OSS Fuzz client

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Mark old method as deprecated in the godoc

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * remove unused comment.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Use new OSS Fuzz client in e2e test.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * fix typo.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Fix potential path bug with test server.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Force include the two JSON files which were being ignored by .gitignore

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * trim the status json file

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    ---------

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    ---------

    Signed-off-by: Raghav Kaul <raghavkaul@google.com>
    Signed-off-by: Spencer Schrock <sschrock@google.com>
    Co-authored-by: Spencer Schrock <sschrock@google.com>

commit 5625dda
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sat Mar 11 17:14:42 2023 +0000

    :seedling: Bump github.com/onsi/ginkgo/v2 from 2.8.3 to 2.9.0 in /tools

    Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.8.3 to 2.9.0.
    - [Release notes](https://github.com/onsi/ginkgo/releases)
    - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
    - [Commits](onsi/ginkgo@v2.8.3...v2.9.0)

    ---
    updated-dependencies:
    - dependency-name: github.com/onsi/ginkgo/v2
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

commit d591e38
Author: Spencer Schrock <sschrock@google.com>
Date:   Fri Mar 10 16:02:05 2023 -0800

    🌱  Add RepoClient re-use E2E tests. (#2625)

    * Add e2e test for re-used repoclient.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Improve diff logging

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Skip scorecard e2e test during unit tests.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    * Fix linter.

    Signed-off-by: Spencer Schrock <sschrock@google.com>

    ---------

    Signed-off-by: Spencer Schrock <sschrock@google.com>

commit a7e81bb
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Mar 10 08:20:28 2023 -0600

    :seedling: Bump actions/cache from 3.2.6 to 3.3.0 (#2738)

    Bumps [actions/cache](https://github.com/actions/cache) from 3.2.6 to 3.3.0.
    - [Release notes](https://github.com/actions/cache/releases)
    - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
    - [Commits](actions/cache@69d9d44...940f3d7)

    ---
    updated-dependencies:
    - dependency-name: actions/cache
      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>
  • Loading branch information
azeemshaikh38 committed Mar 14, 2023
1 parent b5254fe commit 36f35fc
Show file tree
Hide file tree
Showing 47 changed files with 1,490 additions and 1,437 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

uses: github/codeql-action/init@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v1
uses: github/codeql-action/init@16964e90ba004cdf0cd845b866b5df21038b7723 # v1
with:
languages: ${{ matrix.language }}
queries: +security-extended
Expand All @@ -74,7 +74,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v1
uses: github/codeql-action/autobuild@16964e90ba004cdf0cd845b866b5df21038b7723 # v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -88,4 +88,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v1
uses: github/codeql-action/analyze@16964e90ba004cdf0cd845b866b5df21038b7723 # v1
16 changes: 8 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fetch-depth: 2
- id: files
name: Get changed files
uses: tj-actions/changed-files@5ce975c6021a0b11062c547acb6c26c96a34a8c5 #v35.6.2
uses: tj-actions/changed-files@bd376fbcfae914347656e4c70801e2a3fafed05b #v35.7.0
with:
files_ignore: '**.md'
- id: docs_only_check
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -262,7 +262,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -310,7 +310,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down Expand Up @@ -358,7 +358,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
# In order:
# * Module download cache
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,17 @@ jobs:
with:
files: ./e2e-coverage.out
verbose: true

- name: Run GitLab E2E #using retry because the GitHub token is being throttled.
uses: nick-invision/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd
with:
max_attempts: 3
retry_on: error
timeout_minutes: 30
command: make e2e-gitlab

- name: codecov
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # 2.1.0
with:
files: ./e2e-coverage.out
verbose: true
32 changes: 16 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 #v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -363,7 +363,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -459,7 +459,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -507,7 +507,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -555,7 +555,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -603,7 +603,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -651,7 +651,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -699,7 +699,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -771,7 +771,7 @@ jobs:

- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down Expand Up @@ -818,7 +818,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache builds
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
~/go/pkg/mod
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
retention-days: 5

- name: "Upload SARIF results"
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v1
uses: github/codeql-action/upload-sarif@16964e90ba004cdf0cd845b866b5df21038b7723 # v1
with:
sarif_file: results.sarif
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ e2e-gh-token: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN set to secrets.GITHUB_TOKEN must be used to run this.
TOKEN_TYPE="GITHUB_TOKEN" $(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out --keep-separate-coverprofiles ./...

e2e-gitlab-token: ## Runs e2e tests that require a GITLAB_TOKEN
TOKEN_TYPE="GITLAB_PAT" $(GINKGO) --race -p -vv --focus '.*GitLab Token' ./...

e2e-gitlab: ## Runs e2e tests for GitLab only. TOKEN_TYPE is not used (since these are public APIs), but must be set to something
TOKEN_TYPE="GITLAB_PAT" $(GINKGO) --race -p -vv --focus '.*GitLab' ./...

e2e-attestor: ## Runs e2e tests for scorecard-attestor
cd attestor/e2e; go test -covermode=atomic -coverprofile=e2e-coverage.out; cd ../..

Expand Down
54 changes: 43 additions & 11 deletions checker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ package checker
import (
"context"
"fmt"
"os"

"github.com/ossf/scorecard/v4/clients"
ghrepo "github.com/ossf/scorecard/v4/clients/githubrepo"
glrepo "github.com/ossf/scorecard/v4/clients/gitlabrepo"
"github.com/ossf/scorecard/v4/clients/localdir"
"github.com/ossf/scorecard/v4/clients/ossfuzz"
"github.com/ossf/scorecard/v4/log"
Expand All @@ -35,7 +37,9 @@ func GetClients(ctx context.Context, repoURI, localURI string, logger *log.Logge
clients.VulnerabilitiesClient, // vulnClient
error,
) {
var githubRepo clients.Repo
var repo clients.Repo
var makeRepoError error

if localURI != "" {
localRepo, errLocal := localdir.MakeLocalDirRepo(localURI)
var retErr error
Expand All @@ -50,18 +54,46 @@ func GetClients(ctx context.Context, repoURI, localURI string, logger *log.Logge
retErr
}

githubRepo, errGitHub := ghrepo.MakeGithubRepo(repoURI)
if errGitHub != nil {
return githubRepo,
nil,
nil,
nil,
nil,
fmt.Errorf("getting local directory client: %w", errGitHub)
_, experimental := os.LookupEnv("SCORECARD_EXPERIMENTAL")
var repoClient clients.RepoClient

//nolint:nestif
if experimental && glrepo.DetectGitLab(repoURI) {
repo, makeRepoError = glrepo.MakeGitlabRepo(repoURI)
if makeRepoError != nil {
return repo,
nil,
nil,
nil,
nil,
fmt.Errorf("getting local directory client: %w", makeRepoError)
}

var err error
repoClient, err = glrepo.CreateGitlabClientWithToken(ctx, os.Getenv("GITLAB_AUTH_TOKEN"), repo)
if err != nil {
return repo,
nil,
nil,
nil,
nil,
fmt.Errorf("error creating gitlab client: %w", err)
}
} else {
repo, makeRepoError = ghrepo.MakeGithubRepo(repoURI)
if makeRepoError != nil {
return repo,
nil,
nil,
nil,
nil,
fmt.Errorf("getting local directory client: %w", makeRepoError)
}
repoClient = ghrepo.CreateGithubRepoClient(ctx, logger)
}

return githubRepo, /*repo*/
ghrepo.CreateGithubRepoClient(ctx, logger), /*repoClient*/
return repo, /*repo*/
repoClient, /*repoClient*/
ossfuzz.CreateOSSFuzzClient(ossfuzz.StatusURL), /*ossFuzzClient*/
clients.DefaultCIIBestPracticesClient(), /*ciiClient*/
clients.DefaultVulnerabilitiesClient(), /*vulnClient*/
Expand Down

0 comments on commit 36f35fc

Please sign in to comment.