You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/codeql/codeql-cli/creating-and-working-with-codeql-packs.rst
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,3 +68,11 @@ This command downloads all dependencies to the shared cache on the local disk.
68
68
Note
69
69
70
70
Running the ``codeql pack add`` and ``codeql pack install`` commands will generate or update the ``qlpack.lock.yml`` file. This file should be checked-in to version control. The ``qlpack.lock.yml`` file contains the precise version numbers used by the pack.
71
+
72
+
.. pull-quote::
73
+
74
+
Note
75
+
76
+
By default ``codeql pack install`` will install dependencies from the Container registry on GitHub.com.
77
+
You can install dependencies from a GitHub Enterprise Server Container registry by creating a ``qlconfig.yml`` file.
78
+
For more information, see ":doc:`Publishing and using CodeQL packs <publishing-and-using-codeql-packs>`."
The Container registry for GitHub Enterprise Server supports CodeQL query packs from GitHub Enterprise Server 3.6 onward.
84
+
85
+
By default, the CodeQL CLI expects to download CodeQL packs from and publish packs to the Container registry on GitHub.com. However, you can also work with CodeQL packs in a Container registry on GitHub Enterprise Server 3.6, and later, by creating a ``qlconfig.yml`` file to tell the CLI which Container registry to use for each pack.
86
+
87
+
Create a ``~/.codeql/qlconfig.yml`` file using your preferred text editor, and add entries to specify which registry to use for one or more package name patterns.
88
+
For example, the following ``qlconfig.yml`` file associates all packs with the Container registry for the GitHub Enterprise Server at ``GHE_HOSTNAME``, except packs matching ``codeql/*``, which are associated with the Container registry on GitHub.com:
89
+
90
+
.. code-block:: yaml
91
+
92
+
registries:
93
+
- packages: 'codeql/*'
94
+
url: https://ghcr.io/v2/
95
+
- packages: '*'
96
+
url: https://containers.GHE_HOSTNAME/v2/
97
+
98
+
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.
99
+
This means that you'll generally want to define the most specific package name patterns first.
100
+
101
+
You can now use ``codeql pack publish``, ``codeql pack download``, and ``codeql database analyze`` to manage packs on GitHub Enterprise Server.
102
+
103
+
Authenticating to GitHub Container registries
104
+
---------------------------------------------
105
+
106
+
You can publish packs and download private packs by authenticating to the appropriate GitHub Container registry.
107
+
108
+
You can authenticate to the Container registry on GitHub.com in two ways:
109
+
110
+
1. Pass the ``--github-auth-stdin`` option to the CodeQL CLI, then supply a GitHub Apps token or personal access token via standard input.
111
+
2. Set the ``GITHUB_TOKEN`` environment variable to a GitHub Apps token or personal access token.
112
+
113
+
Similarly, you can authenticate to a GHES Container registry, or authenticate to multiple registries simultaneously (for example, to download or run private packs from multiple registries) in two ways:
114
+
115
+
1. Pass the ``--registries-auth-stdin`` option to the CodeQL CLI, then supply a registry authentication string via standard input.
116
+
2. Set the ``CODEQL_REGISTRIES_AUTH`` environment variable to a registry authentication string.
117
+
118
+
A registry authentication string is a comma-separated list of ``<registry-url>=<token>`` pairs, where ``registry-url`` is a GitHub Container registry URL, such as ``https://containers.GHE_HOSTNAME/v2/``, and ``token`` is a GitHub Apps token or personal access token for that GitHub Container registry.
119
+
This ensures that each token is only passed to the Container registry you specify.
120
+
For instance, the following registry authentication string specifies that the CodeQL CLI should authenticate to the Container registry on GitHub.com using the token ``<token1>`` and to the Container registry for the GHES instance at ``GHE_HOSTNAME`` using the token ``<token2>``:
0 commit comments