Skip to content

Commit 8edd378

Browse files
authored
Merge pull request github#12077 from github/codeql-cli-articles-migration-update
Update CodeQL CLI docs articles and links to point to new location on GitHub Docs site
2 parents cd660e1 + 75b0676 commit 8edd378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+276
-3311
lines changed

docs/codeql/CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ We welcome contributions to our CodeQL docs. Want to improve existing docs or ad
44

55
## Contributing to CodeQL docs on `codeql.github.com`
66

7-
To make changes to the documentation on [codeql.github.com](https://codeql.github.com/docs/codeql-overview/), you can make changes to the documentation files using the GitHub UI, a codespace, or a local text editor, and then open a pull request for review. For more information about the format and structure of the CodeQL documentation on [codeql.github.com](https://codeql.github.com/docs/codeql-overview/), please see the [README](docs/codeql/README.rst).
7+
To make changes to the documentation on [codeql.github.com](https://codeql.github.com/docs/codeql-overview/), you can make changes to the documentation files using the GitHub UI, a codespace, or a local text editor, and then open a pull request for review. For more information about the format and structure of the CodeQL documentation on [codeql.github.com](https://codeql.github.com/docs/codeql-overview/), please see the [README](README.rst).
88

99
## Contributing to CodeQL CLI docs on `docs.github.com`
1010

11-
We are in the process of moving all documentation about the CodeQL CLI from [github/codeql](docs/codeql) to the public [github/docs](https://github.com/github/docs) repository so that this documentation is published on the [GitHub Docs](https://docs.github.com/en/code-security/code-scanning) site. This includes all articles that are currently published under "[Using the CodeQL CLI](https://codeql.github.com/docs/codeql-cli/using-the-codeql-cli/)" and "[CodeQL CLI reference](https://codeql.github.com/docs/codeql-cli/codeql-cli-reference/)" categories on the CodeQL microsite. This will make it easier for code scanning users to find information about using CodeQL to query their codebases.
11+
We have moved documentation about the CodeQL CLI from [github/codeql](docs/codeql) to the public [github/docs](https://github.com/github/docs) repository so that this documentation is published on the [GitHub Docs](https://docs.github.com/en/code-security/codeql-cli) site. This includes all articles that were under the "[Using the CodeQL CLI](https://codeql.github.com/docs/codeql-cli/using-the-codeql-cli/)" and "[CodeQL CLI reference](https://codeql.github.com/docs/codeql-cli/codeql-cli-reference/)" categories on the CodeQL microsite. This will make it easier for code scanning users to find information about using CodeQL to query their codebases.
1212

13-
**Note**: For a brief time, we will have source files for CodeQL CLI documentation in two locations. During this period we will not accept changes to the old files in the `codeql` repository, only to the new files in the `docs` repository.
14-
15-
To contribute to these docs, which are located in the [`code-scanning`](https://github.com/github/docs/tree/main/content/code-security/code-scanning) directory, please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file in the `docs` repository.
13+
To contribute to these docs, which are located in the [`codeql-cli`](https://github.com/github/docs/tree/main/content/code-security/codeql-cli) directory, please refer to the [CONTRIBUTING.md](https://github.com/github/docs/blob/main/CONTRIBUTING.md) file in the `docs` repository.
1614

1715

1816

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

Lines changed: 20 additions & 388 deletions
Large diffs are not rendered by default.

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

Lines changed: 9 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,14 @@
33
About CodeQL workspaces
44
=======================
55

6-
.. include:: ../reusables/beta-note-package-management.rst
6+
.. pull-quote::
7+
This article was moved to "`About CodeQL workspaces <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-workspaces>`__" on the `GitHub Docs <https://docs.github.com/en/code-security/codeql-cli>`__ site as of January 2023.
8+
9+
.. include:: ../reusables/codeql-cli-articles-migration-note.rst
710

8-
CodeQL workspaces are used to group multiple CodeQL packs together. A typical use case for a CodeQL workspace is to develop a set of CodeQL library and query packs that are mutually dependent. For more information on CodeQL packs, see ":doc:`About CodeQL packs <about-codeql-packs>`."
11+
.. include:: ../reusables/codeql-cli-migration-toc-note.rst
912

10-
The main benefit of a CodeQL workspace is that it makes it easier for you to develop and maintain multiple CodeQL packs. When you use a CodeQL workspace, all the CodeQL packs in the workspace are available as *source dependencies* for each other when you run a CodeQL command that resolves queries. This makes it easier to develop, maintain, and publish multiple, related CodeQL packs.
11-
12-
In most cases, you should store the CodeQL workspace and the CodeQL packs contained in it in one git repository. This makes it easier to share your CodeQL development environment.
13-
14-
The ``codeql-workspace.yml`` file
15-
---------------------------------
16-
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.
18-
19-
* The ``provide`` block contains a list of glob patterns that define the CodeQL packs that are available in the workspace.
20-
* 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>`.
22-
23-
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>`__ ."
24-
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``.
26-
27-
.. code-block:: yaml
28-
29-
provide:
30-
- "*/codeql-packs/**/qlpack.yml"
31-
ignore:
32-
- "*/codeql-packs/**/experimental/**/qlpack.yml"
33-
34-
registries:
35-
- packages: 'codeql/*'
36-
url: https://ghcr.io/v2/
37-
38-
- packages: '*'
39-
url: https://containers.GHE_HOSTNAME/v2/
40-
41-
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.
42-
43-
.. _source-dependencies:
44-
45-
Source Dependencies
46-
-------------------
47-
48-
Source dependencies are CodeQL packs that are resolved from the local file system outside of the CodeQL package cache. These dependencies can be in the same CodeQL workspace, or specified as a path option using the ``--additional-packs`` argument. When you compile and run queries locally, source dependencies override any dependencies found in the CodeQL package cache as well as version constraints defined in the ``qlpack.yml``. All references to CodeQL packs in the same workspace are resolved as source dependencies.
49-
50-
This is particularly useful in the following situations:
51-
52-
- One of the dependencies of the query pack you are running is not yet published. Resolving from source is the only way to reference that pack.
53-
- You are making changes to multiple packs at the same time and want to test them together. Resolving from source ensures that you are using the version of the pack with your changes in it.
54-
55-
CodeQL workspaces and query resolution
56-
--------------------------------------
57-
58-
All CodeQL packs in a workspace are available as source dependencies for each other when you run any CodeQL command that resolves queries or packs. For example, when you run ``codeql pack install`` in a pack directory in a workspace, any dependency that can be found in the workspace will be used instead of downloading that dependency to the package cache and adding it to the ``codeql-pack.lock.yml`` file. For more information, see ":ref:`Adding and Installing Dependencies <adding-and-installing-dependencies>`."
59-
60-
Similarly, when you publish a CodeQL query pack to the GitHub container registry using ``codeql pack publish`` the command will always use the dependencies from the workspace instead of using dependencies found in the local package cache.
61-
62-
This ensures that any local changes you make to a query library in a dependency are automatically reflected in any query packs you publish from that workspace.
63-
64-
Example
65-
~~~~~~~
66-
67-
Consider the following ``codeql-workspace.yml`` file:
68-
69-
.. code-block:: yaml
70-
71-
provide:
72-
- "**/qlpack.yml"
73-
74-
And the following CodeQL library pack ``qlpack.yml`` file in the workspace:
75-
76-
.. code-block:: yaml
77-
78-
name: my-company/my-library
79-
library: true
80-
version: 1.0.0
81-
82-
And the following CodeQL query pack ``qlpack.yml`` file in the workspace:
83-
84-
.. code-block:: yaml
85-
86-
name: my-company/my-queries
87-
version: 1.0.0
88-
dependencies:
89-
my-company/my-library: "*"
90-
codeql/cpp-all: ~0.2.0
91-
92-
Notice that the ``dependencies`` block for the CodeQL query pack, ``my-company/my-queries``, specifies ``"*"`` as the version of the library pack. Since the library pack is already defined as a source dependency in ``codeql-workspace.yml``, the library pack's content is always resolved from inside the workspace. Any version constraint you define will be ignored in this case. We recommend that you use ``"*"`` for source dependencies to make it clear that the version is inherited from the workspace.
93-
94-
When you execute ``codeql pack install`` from the query pack directory, an appropriate version of ``codeql/cpp-all`` is downloaded to the local package cache. Also, a ``codeql-pack.lock.yml`` file is created that contains the resolved version of ``codeql/cpp-all``. The lock file won't contain an entry for ``my-company/my-library`` since it is resolved from source dependencies. The ``codeql-pack.lock.yml`` file will look something like this:
95-
96-
.. code-block:: yaml
97-
98-
dependencies:
99-
codeql/cpp-all:
100-
version: 0.2.2
101-
102-
When you execute ``codeql pack publish`` from the query pack directory, the ``codeql/cpp-all`` dependency from the package cache and the ``my-company/my-library`` from the workspace are bundled with ``my-company/my-queries`` and published to the GitHub container registry.
13+
* `The codeql-workspace.yml file <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-workspaces#the-codeql-workspaceyml-file>`__
14+
* `Source dependencies <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-workspaces#source-dependencies>`__
15+
* `CodeQL workspaces and query resolution <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-workspaces#codeql-workspaces-and-query-resolution>`__
16+
* `Example <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-workspaces#example>`__

docs/codeql/codeql-cli/about-ql-packs.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
About QL packs
44
==============
55

6-
This page has been moved to ":doc:`About CodeQL packs <about-codeql-packs>`."
7-
6+
.. pull-quote::
7+
This page was moved to "`About CodeQL packs <https://docs.github.com/en/code-security/codeql-cli/codeql-cli-reference/about-codeql-packs>`__" on the `GitHub Docs <https://docs.github.com/en/code-security/codeql-cli>`__ site as of January 2023.
8+
9+
.. include:: ../reusables/codeql-cli-articles-migration-note.rst
810

911
.. toctree::
1012
:hidden:

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

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,11 @@
33
About the CodeQL CLI
44
====================
55

6-
Software developers and security researchers can secure their code
7-
using the CodeQL CLI.
6+
.. pull-quote::
7+
This article was moved to "`About the CodeQL CLI <https://docs.github.com/en/code-security/codeql-cli/using-the-codeql-cli/about-the-codeql-cli>`__" on the `GitHub Docs <https://docs.github.com/en/code-security/codeql-cli>`__ site as of January 2023.
8+
9+
.. include:: ../reusables/codeql-cli-articles-migration-note.rst
810

9-
The CodeQL CLI is a command-line tool used to run CodeQL processes locally on
10-
open source software projects. You can use the CodeQL CLI to:
11+
.. include:: ../reusables/codeql-cli-migration-toc-note.rst
1112

12-
- Run CodeQL analyses using queries provided by GitHub engineers and the open
13-
source community
14-
- Create CodeQL databases to use in the CodeQL for Visual Studio Code
15-
- Develop and test custom CodeQL queries to use in your own analyses
16-
17-
For information about using the CodeQL CLI, see
18-
":ref:`Getting started with the CodeQL CLI <getting-started-with-the-codeql-cli>`."
19-
20-
CodeQL CLI commands
21-
-------------------
22-
23-
The CodeQL CLI includes commands to create and analyze CodeQL databases from the
24-
command line. To run a command, use::
25-
26-
codeql [command] [subcommand]
27-
28-
To view the reference documentation for a command, add the ``--help`` flag, or visit the
29-
"`CodeQL CLI manual <../manual>`__."
13+
* `CodeQL CLI commands <https://docs.github.com/en/code-security/codeql-cli/using-the-codeql-cli/about-the-codeql-cli#codeql-cli-commands>`__

0 commit comments

Comments
 (0)