Skip to content

Commit dbd5195

Browse files
authored
Merge pull request #10344 from github/aeisenberg/registries-in-workspace
Add information about the `registries` block in `codeql-workspace.yml`
2 parents 996695d + abdc79b commit dbd5195

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

docs/codeql/codeql-cli/about-codeql-workspaces.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ In most cases, you should store the CodeQL workspace and the CodeQL packs contai
1414
The ``codeql-workspace.yml`` file
1515
---------------------------------
1616

17-
A CodeQL workspace is defined by a ``codeql-workspace.yml`` yaml file. This file contains a ``provide`` block, and optionally an ``ignore`` block.
17+
A CodeQL workspace is defined by a ``codeql-workspace.yml`` yaml file. This file contains a ``provide`` block, and optionally ``ignore`` and ``registries`` blocks.
1818

1919
* The ``provide`` block contains a list of glob patterns that define the CodeQL packs that are available in the workspace.
2020
* The ``ignore`` block contains a list of glob patterns that define CodeQL packs that are not available in the workspace.
21+
* The ``registries`` block contains a list of GHES URLs and package patterns that control which container registry is used for publishing CodeQL packs. For more information, see :ref:`Working with CodeQL packs on GitHub Enterprise Server <working-with-codeql-packs-on-ghes>`.
2122

2223
Each entry in the ``provide`` or ``ignore`` section must map to the location of a ``qlpack.yml`` file. All glob patterns are defined relative to the directory that contains the workspace file. For a list of patterns accepted in this file, see" `@actions/glob <https://github.com/actions/toolkit/tree/main/packages/glob#patterns>`__ .
2324

24-
For example, the following ``codeql-workspace.yml`` file defines a workspace that contains all the CodeQL packs recursively found in the ``codeql-packs`` directory, except for the packs in the ``experimental`` directory:
25+
For example, the following ``codeql-workspace.yml`` file defines a workspace that contains all the CodeQL packs recursively found in the ``codeql-packs`` directory, except for the packs in the ``experimental`` directory. The ``registries`` block specifies that ``codeql/*`` packs should be downloaded from https://ghcr.io/v2/, which is GitHub's default container registry. All other packs should be downloaded from and published to the regsitry at ``GHE_HOSTNAME``.
2526

2627
.. code-block:: yaml
2728
@@ -30,6 +31,13 @@ For example, the following ``codeql-workspace.yml`` file defines a workspace tha
3031
ignore:
3132
- "*/codeql-packs/**/experimental/**/qlpack.yml"
3233
34+
registries:
35+
- packages: 'codeql/*'
36+
url: https://ghcr.io/v2/
37+
38+
- packages: '*'
39+
url: https://containers.GHE_HOSTNAME/v2/
40+
3341
To verify that your ``codeql-workspace.yml`` file includes the CodeQL packs that you expect, run the ``codeql pack ls`` command in the same directory as your workspace. The result of the command is a list of all CodeQL packs in the workspace.
3442

3543
.. _source-dependencies:

docs/codeql/codeql-cli/publishing-and-using-codeql-packs.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ The ``analyze`` command will run the default suite of any specified CodeQL packs
7474

7575
codeql <database> analyze <scope>/<pack> <scope>/<other-pack>
7676

77+
.. _working-with-codeql-packs-on-ghes:
78+
7779
Working with CodeQL packs on GitHub Enterprise Server
7880
-----------------------------------------------------
7981

@@ -91,13 +93,17 @@ For example, the following ``qlconfig.yml`` file associates all packs with the C
9193
.. code-block:: yaml
9294
9395
registries:
94-
- packages: 'codeql/*'
96+
- packages:
97+
- 'codeql/*'
98+
- 'other-org/*'
9599
url: https://ghcr.io/v2/
96100
- packages: '*'
97101
url: https://containers.GHE_HOSTNAME/v2/
98102
99103
The CodeQL CLI will determine which registry to use for a given package name by finding the first item in the ``registries`` list with a ``packages`` property that matches that package name.
100-
This means that you'll generally want to define the most specific package name patterns first.
104+
This means that you'll generally want to define the most specific package name patterns first. The ``packages`` property may be a single package name, a glob pattern, or a YAML list of package names and glob patterns.
105+
106+
The ``registries`` list can also be placed inside of a ``codeql-workspace.yml`` file. Doing so will allow you to define the registries to be used within a specific workspace, so that it can be shared amongst other CodeQL users of the workspace. The ``registries`` list in the ``codeql-workspace.yml`` will be merged with and take precedence over the list in the global ``qlconfig.yml``. For more information about ``codeql-workspace.yml``, see :ref:`About CodeQL workspaces <about-codeql-workspaces>`.
101107

102108
You can now use ``codeql pack publish``, ``codeql pack download``, and ``codeql database analyze`` to manage packs on GitHub Enterprise Server.
103109

0 commit comments

Comments
 (0)