cockpit/tools
Martin Pitt 356a7fc0cb workflows: Drop i386 unit test/container
We won't add a lot of new C code any more, valgrinding Python code isn't
very useful (or architecture specific), and more and more distributions
drop i386 support. Also, we still run the unit tests during RPM package
build through packit/COPR, which cover even more architectures.

This paves the way for dropping the unit test container altogether in
favor of running the tests in the cockpit/tasks container, once we agree
on how to build a proper staging setup.

Drop tools/valgrind.supp which was only relevant for i386.

Cherry-picked from main commit 59e1df60b3.
2024-02-20 11:29:02 +01:00
..
arch tools: sync Arch Linux upstream packaging changes 2023-09-13 05:45:39 +02:00
debian tools: Rely on pam.pc to get pam's libdir in Debian packaging 2024-01-22 19:49:34 +01:00
mock-build-env packit: Re-enable and fix dist build 2021-05-06 20:48:46 +02:00
vulture-suppressions Drop Python bridge 2024-02-14 09:23:36 +01:00
Makefile-tools.am test: introduce a proper git pre-push hook 2022-01-13 18:27:40 +01:00
Makefile.redirect tools: Allow 'make dist' from srcdir to work 2016-11-09 16:17:29 +01:00
README.dist Update documentation and comments to not be webpack specific 2023-03-22 08:07:00 +01:00
README.node_modules tools: update node_modules tool documentation 2024-02-05 08:14:15 +01:00
adjust-distdir-timestamps build: rip out automated version history 2022-09-23 11:26:56 +02:00
build-debian-copyright tools: mypy fixes/annotations for build-debian-copyright 2023-11-02 09:45:34 +01:00
cockpit.debian.pam tools: disallow root login by default 2022-11-16 07:25:34 +01:00
cockpit.pam tools: disallow root login by default 2022-11-16 07:25:34 +01:00
cockpit.spec Drop Python bridge 2024-02-14 09:23:36 +01:00
escape-to-c tools/escape-to-c: drop a superfluous f-string 2022-01-13 18:27:40 +01:00
fix-spec tools/fix-spec: use `mv -f` to avoid prompts 2023-05-03 09:50:03 +02:00
git-hook-post-commit tools/git-hook-post-commit: checkout extra files 2023-05-10 16:32:03 +02:00
git-hook-pre-push test: Move git hook scripts to tools/ 2022-06-23 11:12:30 +02:00
git-hook-pre-rebase tools: add git-hook-pre-rebase 2022-02-14 13:55:50 +01:00
glib.supp bridge: Fix valgrind memory leak in bridge's signal handler 2019-09-17 15:45:55 +02:00
make-debs misc: move make_dist.py users to make-dist 2022-03-10 00:11:14 +01:00
make-dist tools/make-dist: tweak "git" version number scheme 2023-05-03 09:50:03 +02:00
make-rpms misc: move make_dist.py users to make-dist 2022-03-10 00:11:14 +01:00
node-modules tools: don't parse --force as valid SHA 2023-07-28 16:50:31 +02:00
patch-metainfo flatpak: preserve xml declaration in installed metainfo 2022-11-09 16:08:07 +01:00
termschutz tools/termschutz: remove unused import 2021-12-21 20:18:58 +01:00
urls-check ruff: Enable UP032 f-string rule 2023-09-27 17:44:24 +02:00
webpack-make.js test: apply eslint to .js files as well 2023-10-27 13:42:46 +02:00
webpack-watch lib, tools: Rename JS tool executables to *.js 2023-02-17 19:17:02 +01:00

README.node_modules

# Cockpit Javascript Dependencies

For included Javascript libraries, and build processes
Cockpit uses Node.js dependencies to process its code. The required Node.JS
javascript code is packaged in the `node_modules/` directory when distributed.

Cockpit does not use Node.js or any npm packages code at runtime. In addition
when building straight from a tarball it is also not necessary to have Node.js
installed.

## Git builds

When building from Git, the `node_modules/` directory is managed as a git
submodule from the `node-cache` repository in the same project as the main
repository (ie: `cockpit-project/node-cache`).  That means that normal builds
won't need to run `npm install`.  Checking out the correct version of the
`node_modules` directory is managed by the script `tools/node-modules`, which
is automatically invoked from the build system on an as-needed basis, and has
good caching.  You can also do a recursive git checkout, if you'd prefer to
build in a no-network environment, but you'll lose the caching benefits.

The gitlink for `node_modules/` is always kept in sync with the `package.json`
file used to fetch that set of modules with `npm install`.

## Making changes

In the event that you need to modify `package.json`, the `node_modules` will
need to be regenerated, and a new commit recorded.  That can be managed locally
by running

```
tools/node_modules install
```

which will produce a commit which is available for local testing.

When you are ready to open a pull request with your changes, push the newly
created `node_modules` commit to the cache by running

```
tools/node_modules push
```

Then create a pull request with your `package.json` and `node_modules` changes.

## GitHub setup notes (documentation for project admins)

This section documents the way to setup the `node-cache` repository on GitHub,
from scratch.  This could potentially be automated, but it doesn't need to
happen regularly, so it's not a high priority.  These instructions may also be
useful for other projects or for forks.

On the GitHub side, the workflow is driven from the `npm-install.yml` script,
and makes use of the `node-cache upload` environment, which needs to be
configured with a `NODE_CACHE_DEPLOY_KEY` secret.  The exact steps:

 - create the `node-cache` repository under the same project as the main
   repository (or fork it)
 - add a commit to that repository with a `README`.  At least one commit on a
   named branch needs to be present in order for the GitHub web UI to function
   properly (eg: generate diffs, show tree contents, etc.)
 - generate an SSH key locally, without a passphrase, without touching the disk:
   `ssh-keygen -t ed25519 -C 'node-cache deploy' -f "${XDG_RUNTIME_DIR}/deploy-key" -N ''`
 - create an environment called `node-cache upload` in the settings of the
   primary repository:
   https://github.com/cockpit-project/cockpit/settings/environments/new
 - add the content of the private key `deploy-key` to the `node-cache upload`
   environment as a secret with the name `NODE_CACHE_DEPLOY_KEY`
 - upload the public key `deploy-key.pub` as a deploy key to `node-cache` with
   write access enabled:
   https://github.com/cockpit-project/node-cache/settings/keys/new
 - destroy the local copy: `rm ${XDG_RUNTIME_DIR}/deploy-key*`