Commit graph

176 commits

Author SHA1 Message Date
Martin Pitt
dcfa45c925 HACKING: Add session auth/startup with curl 2026-05-18 12:30:40 +02:00
Martin Pitt
84c3b83767 HACKING: Add an example how to use cpf and cpy 2026-05-18 12:30:40 +02:00
Martin Pitt
71f384743c HACKING: Debug hard-to-grab elements 2026-05-18 12:30:40 +02:00
Martin Pitt
036a3b6aa8 HACKING: Iterate on the bridge with the ws container 2026-05-18 12:30:40 +02:00
Martin Pitt
339b6e2962 HACKING: Update web server debug logging
This hasn't kept up in the last years, and was now grossly wrong.
cockpit.service just runs `cockpit-tls` which does not use glib. But
Running it as root is dangerous and also not at all helpful for
debugging!

Default to logging all debug messages, and drop the obsolete
"cockpit-bridge" log domain.

Refine the restarting of cockpit.service to just stopping it. Socket
activation will do the rest.

Refer to debug logging of the bridge.
2026-02-10 08:03:10 +01:00
Martin Pitt
4eaa454d80 HACKING: Drop trailing spaces 2026-02-10 08:03:10 +01:00
Freya Gustavsson
a2916a8099 doc: Using the blog post release note automation
We didn't showcase this anywhere and it was kinda just a "if you know
you know" kinda feature, or you looked into the blog post generation
script or release process docs. But for contributors there wasn't a good
way to add a release note when wanted and instead it became a thing we
added when we wanted to.

With this we now also tell the contributors how to add release notes if
they want to, but it is not mandatory for contributions.

Fixes: https://github.com/cockpit-project/cockpit/issues/22485
Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
2025-11-19 11:00:36 +01:00
Martin Pitt
d58c16af79 HACKING: Fix login page testing with bind mounts
Bind mount the whole dist directory. Rebuilding bundles with esbuild
removes and recreates the subdirectories, so that existing bind mounts
will go into the void.
2025-03-24 17:16:28 +01:00
Martin Pitt
e395923115 test: Move static-code into common/
It conceptually fits better there, as it's shared by all external
projects. That makes importing easier as it doesn't have to be
enumerated separately in COCKPIT_REPO_FILES any more.
2024-12-05 14:23:20 +01:00
Martin Pitt
dcd64c2159 Add systemd-sysext development install mode
Now that we don't install any suid root stuff any more and use fully
dynamic system users, we can build our git tree straight into a
systemd-sysext [1]. With that we can test all parts of cockpit
(including tls, ws, session, bridge, the login page, and systemd units)
in a safe manner on the host system. Nothing ever hits the disk (it's
installed to /run/extensions) and allows fast iteration.

This is primarily aimed at our documented development workflow of
building in a cockpit/tasks toolbox, but written in a generic way so
that it should work on Fedora, CentOS/RHEL, Debian/Ubuntu, and Arch, and
also directly from the host system. Use the "extension-release"
declaration to ensure compatibility between the build and host systems.

[1] https://www.freedesktop.org/software/systemd/man/latest/systemd-sysext.html

https://issues.redhat.com/browse/COCKPIT-1208
2024-11-27 17:44:24 +01:00
Martin Pitt
bfd622b9a4 HACKING: Clarify unit test section
The "Working on the non-web parts of Cockpit" section is mostly
concerned about running the unit tests, with a little bit of how to
build the source tree. Rename it, to disambiguate it from the later
"Working on your local machine" section.
2024-11-27 17:44:24 +01:00
Martin Pitt
209832ba14 HACKING.md: Describe the bridge, and stop mentioning the "new Python" one
The Python bridge is the one and only since commit 7c7ab45e3f. Stop
talking about it as an alternative.

Explain what the bridge actually does in high-level terms, to convey an
initial architectural understanding.
2024-10-31 13:11:32 +01:00
Martin Pitt
42b417c7b7 HACKING: Move cockpit.misc.print example to fsinfo
We want to deprecate fslist1.
2024-10-01 10:29:41 +02:00
Ashley Cui
bf0e2bb882 HACKING.md: Clarify installation
Make the session pages section easier to follow by telling the user to build the pages before giving the address to see the changes. Also, divide the section with subheaders to make it more ovbious to install the Cockpit server before trying to build and connect.

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-09-10 11:29:59 -04:00
Allison Karlitskaya
76e18fc8b8 qunit: add support for precise coverage reporting
You can now do something like this:

  $ pytest -k test_browser --js-cov-files='*/fsinfo.ts'

and get results like this:

  pkg/lib/cockpit/fsinfo.ts:33:49-33:63 json_merge
                                                         ▼ from here
      33         const updated = is_json_dict(current) ? { ...current } : { };
                                                                      ▲ to here

  pkg/lib/cockpit/fsinfo.ts:36:33-38:14 json_merge
                                         ▼ from here
      36             if (value === null) {
      37                 delete updated[key];
      38             } else {
                     ▲ to here

Since we also use the same approach for collecting data for integration
tests (Profiler.takePreciseCoverage), we could easily add support there
as well.
2024-08-27 17:35:49 +02:00
Allison Karlitskaya
4cbde72d53 HACKING.md: update outdated QUnit running information
QUnit tests are no longer driven by automake (and haven't been for a
long time) so adjust the hints about how to run individual tests to
mention pytest.
2024-08-27 17:35:49 +02:00
Martin Pitt
e4ae43ffc0 test: Drop CentOS 8 special cases
CentOS 8 is EOL, we have stopped running c8s tests on cockpit main long
ago, and the image got removed in
https://github.com/cockpit-project/bots/pull/6348
2024-05-07 14:55:37 +02:00
Jelle van der Waa
9d30e976af HACKING: add information on how to use React Developer Tools 2024-04-24 15:42:36 +02:00
Allison Karlitskaya
6298dd93c8 test/static-code: drop flake8
`ruff` in preview mode now implements the various E[123] rules that we
were depending on flake8 for.  Drop it.
2024-04-16 14:08:52 +02:00
Martin Pitt
a8c3aa5dc8 Move remaining quay.io/cockpit/tasks references to ghcr.io 2024-04-02 17:43:17 +02:00
Allison Karlitskaya
6f53f89568 misc: move to new tasks container location 2024-03-18 12:36:47 +01:00
Jelle van der Waa
359ea0ec1f ws: switch the default bridge to the Python bridge
Our default bridge is the Python bridge so test-server should by default
use the Python bridge.
2024-02-15 11:51:08 +01:00
Jelle van der Waa
eb59f57b28 HACKING.md: default to running test-server with Python bridge
The C bridge is the old bridge, new developers should run the unit tests
with the Python bridge.
2024-02-14 09:44:28 +01:00
Martin Pitt
1a28b31828 build: Drop ESLint from esbuild
Similar to what commit c9ac6736b3 did for stylelint, move
ESLint to static code checks as well. It already runs from there (and
actually correctly since the previous commit).
2024-02-07 18:35:09 +01:00
Martin Pitt
e8967c5385 HACKING: Keep your PR!
We've seen contributors close their PRs after each review and open a new
one. Don't do that.
2024-02-07 17:58:11 +01:00
Martin Pitt
c9ac6736b3 build: Move stylelint to test/static-code
stylelint 16 causes a deadlock/crash in esbuild [1]. There's no movement
on that issue, and we want stylelint 16 to be able to support the
Browser Baseline 2023.

So let's give up, and untangle stylelint from esbuild. We can just as
well call it from our static code checks. The main developer regression
is that the feedback cycle is faster in build.js watch mode than calling
test/static-code, but these days with IDE integration (like ALE) that
should hopefully not matter that much.

As we use `git ls-files` now, this also starts to cover files in doc/
and test/. Ignore the former for now, let's fix these separately.

[1] https://github.com/evanw/esbuild/issues/3542
2024-02-07 15:59:17 +01:00
Jelle van der Waa
8f2cc30676 HACKING: Add a section about Python bridge and debugging
Explain the COCKPIT_DEBUG environment variable.

Closes #19193
2023-08-24 13:16:13 +02:00
Martin Pitt
ec1afd64e7 HACKING: Warn against cloning a fork
New contributors keep trying this and fail, this has become a FAQ.
Explicitly point out that the given clone command is not an accident,
but deliberate, and show how to work with a fork.
2023-06-06 11:23:07 +02:00
Martin Pitt
0a51a881c3 build.js: Run rsync plugin also for $RSYNC env variable
starter-kit and derivatives don't understand the build.js `-r` option,
only the environment variable. So properly handle the latter, and update
the documentation to use the env variable, to get  a common workflow for
all our projects.

Also fix the destination path, the rsync plugin moved to
/usr/local/share/cockpit some time ago.
2023-05-26 13:26:54 +02:00
Martin Pitt
8164d5bf9c test: Fix qunit test path
Commit 18576f7d18 moved them to /qunit. Adjust the pytest wrapper,
documentation and example accordingly. This brings back the HTML tests
in the pytest unit test run.
2023-03-30 16:31:49 +02:00
Allison Karlitskaya
f1da46cab8 various: replace mentions of IRC with Matrix
The Cockpit Project is now on Matrix at #cockpit:fedoraproject.org.
2023-03-29 15:41:28 +02:00
Katerina Koukiou
fe89f2eff5 build.js: Move our front end build tool from webpack to esbuild
We don't need the `$ESLINT`/`$STYLELINT` env variables any more to
coordinate between build.js and webpack-config.js, as everything is in
build.js now. Update HACKING.md accordingly.

Implement our own watch mode due to the deficiencies of esbuild's [1].
This is similar to podman's [2], but with recursive watching.

Because the approach for redefining breakpoints changed, update pixel
tests for the spacing noise.

Co-Authored-By: Martin Pitt <mpitt@redhat.com>

Fixes #17629

[1] https://github.com/evanw/esbuild/issues/1204#issuecomment-1482909251
[2] https://github.com/cockpit-project/cockpit-podman/pull/1243
2023-03-27 15:22:36 +02:00
Garrett LeSage
54f198cbac
HACKING: Explain container updating
Also hange setup to a step-by-step list.
2023-03-27 13:15:25 +02:00
Martin Pitt
5e3a892d4c Update documentation and comments to not be webpack specific
webpack is an implementation detail and soon change to esbuild. Make the
verbiage more neutral.
2023-03-22 08:07:00 +01:00
Martin Pitt
4b97d35bfa Rename tools/webpack-make.js to ./build.js
This is our primary and only interaction point with building bundles, so it
should be in the top-level directory. Also, we are going to switch to esbuild
soon, so naming it "webpack" will be confusing. Move it to ./build.js like
cockpit-podman already did.

Keep tools/webpack-{make.js,watch} as a shell shim for a little while, which
points to the new tool and the documentation.
2023-03-21 15:51:31 +01:00
Martin Pitt
15469bb469 tools: Teach webpack-make.js to get node_modules by itself
This supports the "only work on web-y bits without autotools" workflow.
It avoids having to run `node-modules checkout` as a user from a clean
tree, and also helps after pulling new commits which change
node_modules.

As `argparse`, `webpack`, and our rsync plugin all live in node_modules,
to convert these to dynamic imports.
2023-03-21 15:51:31 +01:00
Garrett LeSage
bbfc06dab8 hacking: Improve used language 2023-03-20 19:57:30 +01:00
Martin Pitt
fdeb415a5c tools: Make webpack-make.js' directory argument optional
Now that our webpack config can build all webpacks in one go,
webpack-make.js does not require the directory any more. We want to make
tools/webpack-make.js the one true entry point, as this is also
compatible to the future esbuild conversion (where we can't run the
esbuild binary directly). Rename the `prefix` argument name to `onlydir`
to match the env variable.

This also allows us to use watch mode for all pages simultaneously. This
is still a lot slower than building a single page only, so until we
switch to esbuild, document both approaches.

In pkg/build, go back to calling tools/webpack-make.js.
2023-03-20 15:20:38 +01:00
Martin Pitt
64f7b4ed3d HACKING: Document webpack-make.js' --no-stylelint option 2023-03-20 15:20:38 +01:00
Martin Pitt
dc1ad67588 HACKING: Clarify what "page" means and where to list them. 2023-03-15 11:34:54 +01:00
Martin Pitt
8c862fb690 HACKING: Document node_modules checkout
This is required for webpack-watch etc. to work.
2023-03-15 11:34:54 +01:00
Martin Pitt
90d1f814fa HACKING: Emphasize webpack-watch based development process
Most contributors want to work on the web (HTML/JavaScript) parts of
Cockpit. For that it's not necessary to deal with autogen.sh, make,
etc., as that's really slow and irrelevant.

Thus move the webpack-watch part to the top, and stop treating it as
alternative workflow: It's the primary and recommended way to develop the
session pages. Don't make new contributors suffer through building things with
`make`.
2023-03-15 11:34:54 +01:00
Martin Pitt
8d7e185f3c HACKING: Recommend a cockpit/tasks based development environment
A lot of newcomers have been struggling with installing a lot of
packages on their distribution (especially Ubuntu). This is also really
not what they should do, as it clutters desktops with a lot of
development dependencies, and then it's still hard to get something
actually working.

Recommend running our cockpit/tasks container in toolbox or distrobox.
This works fine on Fedora, CentOS, RHEL, and Ubuntu, is much easier, safer, and
gives reproducible results.

Move the manual installation of development dependencies to the very end, and
trim and update it a bit.

Fixes #18460
2023-03-15 11:34:54 +01:00
Martin Pitt
fe906e6bc9 HACKING, test/README: Drop $ prefixes
These are annoying, as they break the "copy" button in GitHub's markdown
view and convenient "select and copy line". These commands are already
formatted as code.
2023-03-15 11:34:54 +01:00
Martin Pitt
07e5edf147 pkg: Support more than one target in window.debugging
It is sometimes necessary to enable more than one debug target, e.g.
`dbus` and `services`. But `all` is too much of a firehose.

Check window.debugging for a substring instead of equality, similar to
what the Services page did in commit 0d6166b174.
2023-03-13 09:40:47 +01:00
Garrett LeSage
c20390a73c Wrapped URLs in <> to make them linkable on the website 2023-03-06 15:24:12 +01:00
Martin Pitt
de6f6e61a8 lib, tools: Rename JS tool executables to *.js
This makes it compatible with webpack module builds, which require a .js
extension.
2023-02-17 19:17:02 +01:00
Jelle van der Waa
def798f22d HACKING: document required pytest version
Before 7.0.0 pytest did not support setting a pythonpath in
pyproject.toml
2022-11-28 15:13:29 +01:00
Allison Karlitskaya
e218b37d63 python: drop cockpit-bridge.pyz target
The official way to invoke the python bridge is now via python3 -m.

We'll bring back a .pyz as an implementation detail of our remote
injection system in the near future.
2022-11-15 09:27:36 +01:00
Allison Karlitskaya
79f378dfe0 python: merge make pycheck into pytest
Add a new testcase in test/pytest/test_server.py which knows how to run
the QUnit tests, including collection of coverage information.

Make sure we build the `test-server` and the webpacks before running
`pytest` from the Makefile.  For running `pytest` directly, the html
tests will be skipped if the test-server is missing or if there are no
`dist/*/test-*.html` files.

Remove the `make pycheck` target, and drop the extra scenario from the
unit-tests workflow.

`pytest` now takes significantly longer to run.  The pytest-xdist
plugin can help with this, and it works in combination with our other
plugins, pytest-timeout and pytest-cov.

For manual invocation of pytest, use something like the following:

  pytest -n auto --cov --timeout 30

We run the tests non-parallel in the unit-tests container because
there's no real advantage to speeding this up in that case, and running
in parallel makes the log output more difficult to read.
2022-11-15 09:27:36 +01:00