Skip to content

Commit 7ed886f

Browse files
authored
✨ GitLab: Release (#3340)
* Remove experimental flag Signed-off-by: Raghav Kaul <raghavkaul@google.com> * Docs Signed-off-by: Raghav Kaul <raghavkaul@google.com> * update tests Signed-off-by: Raghav Kaul <raghavkaul@google.com> --------- Signed-off-by: Raghav Kaul <raghavkaul@google.com>
1 parent 76dc144 commit 7ed886f

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,24 @@ RESULTS
404404
|---------|------------------------|--------------------------------|--------------------------------|---------------------------------------------------------------------------|
405405
```
406406

407+
##### Using a GitLab Repository
408+
409+
To run Scorecard on a GitLab repository, you must create a [GitLab Access Token](https://gitlab.com/-/profile/personal_access_tokens) with the following permissions:
410+
411+
- `read_api`
412+
- `read_user`
413+
- `read_repository`
414+
415+
You can run Scorecard on a GitLab repository by setting the `GITLAB_AUTH_TOKEN` environment variable:
416+
417+
```bash
418+
export GITLAB_AUTH_TOKEN=glpat-xxxx
419+
420+
scorecard --repo gitlab.com/<org>/<project>/<subproject>
421+
```
422+
423+
For an example of using Scorecard in GitLab CI/CD, see [here](https://gitlab.com/ossf-test/scorecard-pipeline-example).
424+
407425
##### Using GitHub Enterprise Server (GHES) based Repository
408426

409427
To use a GitHub Enterprise host `github.corp.com`, use the `GH_HOST` environment variable.

checker/client.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package checker
1717
import (
1818
"context"
1919
"fmt"
20-
"os"
2120

2221
"github.com/ossf/scorecard/v4/clients"
2322
ghrepo "github.com/ossf/scorecard/v4/clients/githubrepo"
@@ -54,14 +53,11 @@ func GetClients(ctx context.Context, repoURI, localURI string, logger *log.Logge
5453
retErr
5554
}
5655

57-
_, experimental := os.LookupEnv("SCORECARD_EXPERIMENTAL")
5856
var repoClient clients.RepoClient
5957

60-
if experimental {
61-
repo, makeRepoError = glrepo.MakeGitlabRepo(repoURI)
62-
if repo != nil && makeRepoError == nil {
63-
repoClient, makeRepoError = glrepo.CreateGitlabClient(ctx, repo.Host())
64-
}
58+
repo, makeRepoError = glrepo.MakeGitlabRepo(repoURI)
59+
if repo != nil && makeRepoError == nil {
60+
repoClient, makeRepoError = glrepo.CreateGitlabClient(ctx, repo.Host())
6561
}
6662

6763
if makeRepoError != nil || repo == nil {

checker/client_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,17 @@ func TestGetClients(t *testing.T) { //nolint:gocognit
6868
wantErr: true,
6969
},
7070
{
71-
name: "repoURI is gitlab which is not supported",
71+
name: "repoURI is gitlab which is supported",
7272
args: args{
7373
ctx: context.Background(),
74-
repoURI: "https://gitlab.com/ossf/scorecard",
74+
repoURI: "https://gitlab.com/ossf-test/scorecard",
7575
localURI: "",
7676
},
7777
shouldOSSFuzzBeNil: false,
7878
shouldRepoClientBeNil: false,
7979
shouldVulnClientBeNil: false,
80-
shouldRepoBeNil: true,
81-
wantErr: true,
82-
},
83-
{
84-
name: "repoURI is gitlab and experimental is true",
85-
args: args{
86-
ctx: context.Background(),
87-
repoURI: "https://gitlab.com/ossf/scorecard",
88-
localURI: "",
89-
},
90-
shouldOSSFuzzBeNil: false,
9180
shouldRepoBeNil: false,
92-
shouldRepoClientBeNil: false,
93-
shouldVulnClientBeNil: false,
94-
shouldCIIBeNil: false,
9581
wantErr: false,
96-
experimental: true,
9782
},
9883
{
9984
name: "repoURI is corp github host",

0 commit comments

Comments
 (0)