Skip to content

Commit 3286380

Browse files
authored
docs: add instructions for analyzing GitLab repositories (#361)
Signed-off-by: Nathan Nguyen <nathan.nguyen@oracle.com>
1 parent 7013b09 commit 3286380

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

docs/source/pages/using.rst

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ Using Macaron
1111

1212
.. _analyze-action:
1313

14-
------------------------------------
14+
.. contents:: :local:
15+
16+
----------------------------------
17+
Analyzing a source code repository
18+
----------------------------------
19+
20+
''''''''''''''''''''''''''''''''''''
1521
Analyzing a public Github repository
16-
------------------------------------
22+
''''''''''''''''''''''''''''''''''''
1723

1824
Macaron can analyze a Github public repository (and potentially the repositories of it dependencies) to determine its SLSA posture following the specification of `SLSA v0.1 <https://slsa.dev/spec/v0.1/>`_.
1925

@@ -52,6 +58,38 @@ With the example above, the generated output reports can be seen here:
5258
- `micronaut-core.html <../_static/examples/micronaut-projects/micronaut-core/analyze_with_repo_path/micronaut-core.html>`__
5359
- `micronaut-core.json <../_static/examples/micronaut-projects/micronaut-core/analyze_with_repo_path/micronaut-core.json>`__
5460

61+
'''''''''''''''''''''''''''''
62+
Analyzing a GitLab repository
63+
'''''''''''''''''''''''''''''
64+
65+
Macaron supports analyzing GitLab repositories, whether they are hosted on `gitlab.com <https://gitlab.com>`_ or on your self-hosted GitLab instance. The set up in these two cases are a little bit different.
66+
67+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
68+
Analyzing a repository on `gitlab.com <https://gitlab.com>`_
69+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
70+
71+
Analyzing a public repository on `gitlab.com <https://gitlab.com>`_ is quite similar to analyzing a public GitHub repository -- you just need to pass a proper GitLab repository URL to ``macaron analyze``.
72+
73+
To analyze a private repository hosted on ``gitlab.com``, you need to obtain a GitLab access token having at least the ``read_repository`` permission and store it into the ``MCN_GITLAB_TOKEN`` environment variable. For more detailed instructions, see `GitLab documentation <https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token>`_.
74+
75+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
76+
Analyzing a repository on a self-hosted GitLab instance
77+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
78+
79+
To analyze a repository on a self-hosted GitLab instance, you need to do the following:
80+
81+
- Add the following ``[git_service.gitlab.self_hosted]`` section into your ``.ini`` config. In the default .ini configuration (generated using ``macaron dump-default`` -- :ref:`see instructions <action_dump_defaults>`), there is already this section commented out. You can start by un-commenting this section and modifying the ``domain`` value with the domain of your self-hosted GitLab instance.
82+
83+
.. code-block:: ini
84+
85+
# Access to a self-hosted GitLab instance (e.g. your organization's self-hosted GitLab instance).
86+
# If this section is enabled, an access token must be provided through the ``MCN_SELF_HOSTED_GITLAB_TOKEN`` environment variable.
87+
# The `read_repository` permission is required for this token.
88+
[git_service.gitlab.self_hosted]
89+
domain = internal.gitlab.org
90+
91+
- Obtain a GitLab access token having at least the ``read_repository`` permission and store it into the ``MCN_SELF_HOSTED_GITLAB_TOKEN`` environment variable. For more detailed instructions, see `GitLab documentation <https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token>`_.
92+
5593
-------------------------------------------------
5694
Verifying provenance expectations in CUE language
5795
-------------------------------------------------

src/macaron/config/defaults.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ domain = github.com
7474
domain = gitlab.com
7575

7676
# Access to a self-hosted GitLab instance (e.g. your organization's self-hosted GitLab instance).
77-
# If this section is enabled, an access token must be provided through the `MCN_PUBLICLY_HOSTED_GITLAB_TOKEN` environment variable.
77+
# If this section is enabled, an access token must be provided through the `MCN_SELF_HOSTED_GITLAB_TOKEN` environment variable.
7878
# The `read_repository` permission is required for this token.
7979
# [git_service.gitlab.self_hosted]
8080
# domain = example.org

0 commit comments

Comments
 (0)