Commit Graph

811 Commits

Author SHA1 Message Date
Jamil
83340b9252 ci: Don't run browser tests on release images (#4722)
Fixes https://github.com/firezone/firezone/actions/runs/8763390111
2024-04-20 00:37:12 -07:00
Gabi
adc0bb73f7 test(client): add reconnection tests from a client using a headless browser (#4569)
Considered using Elixir and Rust to write the tests.

For Elixir, `wallaby` doesn't seem to have a way to attach to an
existing `chromium` instance, launching it each time, which makes it
hard to coordinate with the relay restart.

For Rust we considered `thirtyfour` which would be very nice since we
could test both firefox and chrome but each time it connects to the
instance it launches a new session making it hard to test the DNS cache
behavior.

We also considered `chrome_headless` for Rust it needs a small patch to
prevent it from closing the browser after `Drop` but it still presents a
problem, since it has no easy way to retrieve if loading a page has
succeeded. There are some workarounds such as retrieving the title that
we could have used but after some testing they are quite finnicky and we
don't want that for CI.

So I ended up settling for TypeScript but I'm open to other options, or
a fix for the previous ones!

There are some modifications still incoming for this PR, around the test
name and that sleep in the middle of the test doesn't look good so I
will probably add some retries, but the gist is here, will keep it in
draft until we expect it to be passing.

So feel free to do some initial reviews.

Note: the number of lines changed is greatly exaggerated by
`package.lock`

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-20 06:57:07 +00:00
Thomas Eizinger
51089b89e7 feat(connlib): smoothly migrate relayed connections (#4568)
Whenever we receive a `relays_presence` message from the portal, we
invalidate the candidates of all now disconnected relays and make
allocations on the new ones. This triggers signalling of new candidates
to the remote party and migrates the connection to the newly nominated
socket.

This still relies on #4613 until we have #4634.

Resolves: #4548.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-04-20 06:16:35 +00:00
Reactor Scram
7081c71c10 chore(linux-client): allow custom token path (#4666)
```[tasklist]
# Before merging
- [x] Remove file extension `.txt`
- [x] Wait for `linux-group` test to go green on `main` (#4692)
- [x] *all* compatibility tests must be green on this branch
```

Closes #4664 
Closes #4665 

~~The compatibility tests are expected to fail until the next release is
cut, for the same reasons as in #4686~~

The compatibility test must be handled somehow, otherwise it'll turn
main red.
`linux-group` was moved out of integration / compatibility testing, but
the DNS tests do need the whole Docker + portal setup, so that one can't
move.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-19 18:50:24 +00:00
Andrew Dryga
1b60c49f32 Also exclude acceptance tests 2024-04-19 12:23:41 -06:00
Andrew Dryga
5b153f9ba4 Provider a way to disable flaky Elixir tests on CI 2024-04-19 11:27:31 -06:00
Thomas Eizinger
69644054ce ci: remove setting of unused env variable (#4710) 2024-04-19 14:11:58 +00:00
Reactor Scram
bc22fb2bf2 test(linux-client): move linux-group test out of integration tests (#4692)
Closes #4669 

This should stop the problem of `linux-group` failing because of trying
to test an older release that doesn't have the right CLI features

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-19 02:52:31 +00:00
Jamil
f024570c6c ci(fix): replace more invalid ref chars (#4687)
https://github.com/firezone/firezone/actions/runs/8741173474/job/23986580117

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-04-18 20:56:04 +00:00
Reactor Scram
68016a8a56 test(linux-client): disable failing test (#4689) 2024-04-18 19:40:06 +00:00
Reactor Scram
926ffe6f07 test(linux-client): fix linux-group integration test (#4671)
Closes #4669 
(Once I figure out the cause and then fix it)
2024-04-18 14:05:24 +00:00
Reactor Scram
6da6fc8569 test(linux-client): temporarily disable failing linux-group integration test (#4670)
Refs #4669. That issue will be for fixing and re-enabling the test.

This is only needed for Linux IPC which isn't in production yet, so it's
easier to disable first and debug second
2024-04-17 23:48:22 +00:00
Reactor Scram
2f6f2ef260 test(linux-client): check if we can add the user to a group in a CI test (#4600)
Refs #4513

The next step after this is to use this to test security in the Linux
IPC code, it should reject any IPC commands from users not in the
`firezone` group.
2024-04-17 20:40:27 +00:00
Jamil
9415a64900 chore(ci): build docker dev images with main (#4643)
Fixes broken pulling of images for dev
2024-04-16 20:29:11 +00:00
Andrew Dryga
e60fd1c665 Add global concurrency group to production deployments 2024-04-16 11:59:28 -06:00
Andrew Dryga
a6f32aa769 chore(devops): Fix GH overriding main branch statuses (#4639) 2024-04-16 10:41:13 -06:00
Jamil
9a317247a1 chore(ci): .env not available in with shared workflow context (#4631)
Le sigh
2024-04-16 00:01:17 +00:00
Jamil
42385fd565 ci: Add tag name to build-dev-images (#4629)
dev images don't uses releases and shouldn't rely on release-drafter,
instead following the `VERSION` that's set in CI.

Fixes https://github.com/firezone/firezone/actions/runs/8696082974
2024-04-15 22:10:54 +00:00
Jamil
254fe6fbbc ci: Only build debug images for linux/amd64 (#4612)
refs #4602 

- Removes `debug` stage building of `arm` and `arm64` binaries and
images (PRs only) -- these just get thrown away since we only test in CI
with `amd64`
- Removes `perf` builds for snownet-tests and http-test-server
- `base-base*` jobs are expected to fail since these changes haven't hit
`main` yet
- 
This changes our required checks, so after approval I'll need to update
those.
2024-04-14 15:10:54 +00:00
Jamil
c15f4f0868 ci: Enable client compatibility tests (#4610)
Meant to do this sooner.
2024-04-13 20:55:13 +00:00
Jamil
e9020ddd73 fix(ci): Override release_drafter commitish since we run on PRs now (#4608)
Fixes
https://firezonehq.slack.com/archives/C067DSY7TFX/p1712964715027229
2024-04-12 18:06:14 -07:00
Reactor Scram
8e642e86d8 refactor(perf-tests): add prefixes 'base' and 'head' (#4598)
This makes it easier to tell them apart, which had been confusing me
while working on #4578

<img width="304" alt="image"
src="https://github.com/firezone/firezone/assets/13400041/5c9b3505-45ca-490f-9f7a-00e1a5c2eb30">
2024-04-12 21:35:33 +00:00
Jamil
89e05b0fd6 fix(ci): autolabeler to fix changelog drafting (#4591)
Fixes the autolabeler so that changelog generation and edit process is
much less time-consuming

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-04-12 21:23:53 +00:00
Reactor Scram
c01c3c1dd8 test(integration): remove redundant integration-test- prefix (#4601)
They all have the same prefix anyway, and it uses up real estate in the
CI page

**After**
<img width="311" alt="image"
src="https://github.com/firezone/firezone/assets/13400041/8028f9bf-5c13-4170-9e01-06bfd393751c">

**Before**
<img width="292" alt="image"
src="https://github.com/firezone/firezone/assets/13400041/8cabf67e-6be2-4719-b06f-4a76cf5c8111">
2024-04-12 18:15:11 +00:00
Thomas Eizinger
be1a719e2c chore(relay): perform graceful shutdown upon receiving SIGTERM (#4552)
Upon receiving a SIGTERM, we immediately disconnect from the websocket
connection to the portal and set a flag that we are shutting down.

Once we are disconnected from the portal and no longer have an active
allocations, we exit with 0. A repeated SIGTERM signal will interrupt
this process and force the relay to shutdown.

Disconnecting from the portal will (eventually) trigger a message to
clients and gateways that this relay should no longer be used. Thus,
depending on the timeout our supervisor has configured after sending
SIGTERM, the relay will continue all TURN operations until the number of
allocations drops to 0.

Currently, we also allow clients to make new allocations and refreshing
existing allocations. In the future, it may make sense to implement a
dedicated status code and refuse `ALLOCATE` and `REFRESH` messages
whilst we are shutting down.

Related: #4548.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-04-12 08:45:08 +00:00
Jamil
0e9dea9d5e test(ci): Remove e2e false start (#4580)
As we've learned more about how we can test for increased coverage and
certain failure scenarios, I think continuing down this path is a losing
battle.

Apple is the only platform we can't theoretically test in GitHub
actions, and we may be able to accomplish that with #4375. With #4506 in
progress, I think we can get decent coverage with a mix of CI
integration tests and portal-stubbed clients in CI.

If we can stub out the control plane I/O we can test clients in CI.
2024-04-11 13:32:19 +00:00
Reactor Scram
3a67eacfbe refactor(linux-client): replace client-tunnel with headless-client which is the same thing (#4516)
Unfortunately I had to keep `linux-client` to get the compatibility
tests to pass. #4578 aims to remove that package.

Please add to this list if you think of anything:

```[tasklist]
# Things that may break that CI/CD won't catch
- [ ] Github release artifacts
- [ ] Knowledge base 
- [ ] Docker images
- [ ] Docker containers
- [ ] Existing `linux-client` users
- [ ] Anything that downloads ghcr artifacts
- [ ] Nix (Not sure if it's built in CI. It had a merge conflict)
```

Refs #4515, and #3712, #3782

I think this is what Thomas and I agreed on in Slack / Github

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-10 22:01:55 +00:00
Jamil
09532ea845 chore(ci): Add portal and relay downtime DNS resource tests (#4517)
Tests that DNS still works in the client with established connections
after the portal and/or relay go down.
2024-04-08 09:43:59 +00:00
Jamil
7a27ed466c chore(ci): Use target-specific cache when cross building (#4519)
I suspect the cache is being saved from cross builds, so this PR further
isolates the cross cache per target.


https://github.com/firezone/firezone/actions/runs/8564714747/job/23471683253?pr=4517
2024-04-04 21:47:35 -07:00
Jamil
c24a291956 chore(ci): scope cache by arch too (#4512)
https://github.com/firezone/firezone/actions/runs/8558739208/job/23453931061
2024-04-04 18:07:43 +00:00
Jamil
a58dd99e9f chore(ci): Scope GH rust cache per os type (#4504)
I suspect this is a cache issue:


https://github.com/firezone/firezone/actions/runs/8549331928/job/23424473070

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-04-04 16:47:51 +00:00
Thomas Eizinger
97e6a92e39 chore(rust): remove unused dependencies (#4475)
These were all found by `cargo-udeps`.

Resolves: #4403.
2024-04-03 14:11:02 +00:00
Jamil
f73508e40d fix(gateway): Publish all platforms for Gateway, not just amd64 (#4459)
Fixes #4458
2024-04-03 00:18:30 +00:00
Reactor Scram
74a81b2a56 test(gui-client): unit test for Linux IPC (#4277)
(After GA)

This adds a unit test for the Unix domain sockets that I intend to use
for process splitting on Linux.

The length-prefixed encoding and decoding are copied from `subzone`, but
most of that code will not be re-used since it's Windows-specific and
also specific to a Chromium-like process model, which won't work for
Firezone.
2024-04-02 19:34:24 +00:00
Reactor Scram
1e4ed7bad6 refactor(ci): move DNS control method up to docker-compose.yml (#4341)
This is part of a yak shave towards CI testing of #3812 

Moving the DNS control method out of `docker-compose.yml` and up to the
integration tests themselves allows us to test these scenarios:

- `systemd-resolved`
- `etc-resolv-conf`
- `systemd-resolved` but we're in a container where that won't work, so
we should gracefully degrade to just allowing IP/CIDR resources
2024-04-02 17:11:29 +00:00
Jamil
c30138b38e chore(connlib): Remove atomicwrites and tokio::fs from apple compile path (#4395)
Fixes #4377 


Manually verified by running `nm` on the resulting binaries. I'll open
another PR to handle #4393

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-03-29 21:01:53 +00:00
Reactor Scram
6aec8ce287 test(firezone-tunnel): create a tunnel device in unit tests during CI (#4254)
This catches two of the mutants, according to `cargo-mutants`.

~~Unfortunately since `cargo test` runs in one process, it's
all-or-nothing for sudo, this will run all unit tests as sudo.~~
(This explanation is not exactly correct, `cargo test` does run _a_
subprocess, but still, there is no way to request sudo or non-sudo
runners for specific tests, since it's just an environment variable, and
since many tests run in parallel in different threads of the same
process.)

Here it is passing in Linux:
https://github.com/firezone/firezone/actions/runs/8382799272/job/22957555987#step:5:3160

And Windows:
https://github.com/firezone/firezone/actions/runs/8382799272/job/22957558003#step:5:1006

```[tasklist]
### Before merging
- [x] Try `#[ignore]` attribute
- [x] Fail gracefully if `sudo` isn't available
```
2024-03-28 17:03:32 +00:00
Thomas Eizinger
18033eafec ci: ensure roaming between networks doesn't abort file download (#4213)
This adds an integration test that downloads a 10MB file from a server
and simulates the client roaming to another network while the download
is active.

We use a DNS resource for this to ensure it also doesn't take too long
in that case. DNS resources are what most users will be using and we
clear some internal DNS caches on connection failures. Hence, using a
DNS resource here is a somewhat roundabout way to test that we aren't
failing and re-establishing the connection but migrate it to a new
network path.
2024-03-26 05:44:59 +00:00
Jamil
251a324c9f chore(ci): Fix tauri upload asset (#4255)
Fixes tauri release builds in CI
2024-03-21 23:47:01 +00:00
Reactor Scram
e3b150cfdb ci(tauri): fix typo (#4256)
You know what I want, when I'm waiting 15-60 minutes on a CI job?

I want a stringly-typed language

I want the compiler to do

as

little

work

as

possible

If there even _is_ a compile step. Cause I love waiting and squinting at
underscores.
2024-03-21 23:00:19 +00:00
Reactor Scram
a6d0a18035 ci(windows): publish Windows Client MSI (#4251)
I think this was just a small regression from the big CI refactor last
week. `update-release-draft` doesn't exist in this file anymore.

Closes #4248
2024-03-21 21:42:07 +00:00
Jason Elie Bou Kheir
83030a155d test(android): add github action workflow step for unit tests (#4177)
Fixes #2309 

Not sure how to test the workflow itself in this PR 🤔

---------

Signed-off-by: Jason Elie Bou Kheir <5115126+jasonboukheir@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-03-21 16:25:13 +00:00
Reactor Scram
e05cbbe0a0 build(gui-client/linux): include an empty firezone-tunnel binary with the Tauri deb package (#4220)
I thought this was going to use `cargo-deb` but it was actually easy
with the Tauri deb bundling we already use.

```[tasklist]
### Before merging
- [x] Make sure every file in the Tauri deb is also in our deb (e.g. icons)
```
2024-03-20 14:11:41 +00:00
Reactor Scram
651ea3ae00 build(gui-client/linux): make sure debug symbols get uploaded for the Linux GUI client (#4217)
- Split up CI artifacts into "exe", "pkg", and "syms" so it's easy to
check they're being uploaded. This shouldn't affect published artifacts
- Set `strip = "none"` which seems to be necessary to get the debug
symbols in Linux, although they still end up in the exe and not the dwp
file 🤔 don't know why
- Test Linux stacktrace in CI

Stacktrace examples:
- On Linux we at least get function names, but we aren't getting line
numbers for some reason
https://github.com/firezone/firezone/actions/runs/8350493514/job/22857032124#step:10:268
- On Windows we also get line numbers, as before
https://github.com/firezone/firezone/actions/runs/8350493514/job/22857033367#step:11:351

I didn't test downloading the files and doing a stacktrace locally, but
I have batched that up for whenever I do a big manual test of the
CD-produced release artifacts:
https://github.com/firezone/firezone/issues/3887
2024-03-19 22:18:03 +00:00
Jamil
66f3781413 chore(deps): Need to bump Swift dependencies manually, Dependabot can't figure them out from Package.resolved (#4204)
Refs #4203
2024-03-19 18:42:22 +00:00
Reactor Scram
74026d8b13 build(gui-client): disable AppImage bundling (#4216)
AppImages won't work with process splitting. (#3713)

As far as I can tell, they just produce one binary. Internally they use
FUSE or something to mount a squashfs image, but that image won't be
able to hook into systemd and run with root permissions and everything.
I don't think it's practical, and Tauri's AppImage bundling doesn't have
the features for it.

Even their deb bundler doesn't have any way to specify a path for a
daemon to be installed. The sidecar feature only seems intended for the
GUI app to call, not anything else on the system.

(There is such a thing as installing AppImages, but I don't think it's
worth pursuing - We should just do debs)
2024-03-19 17:26:25 +00:00
Reactor Scram
504ff3ffca ci(tauri-client): try to enable smoke tests for Ubuntu 22.04 (#3770)
Closes #3699 if successful

Ref #3972 

I don't understand why it started working. There's at least 3
possibilities:
- Some unrelated change in the last few weeks fixed it (Maybe bumping
Tauri to 1.6.1? https://github.com/firezone/firezone/pull/3881)
- It was a bug in the Github CI runner image that they fixed
- It's an awful race condition and adding `tracing::debug!` fixed it

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-03-19 15:41:37 +00:00
Jamil
de687f4c59 chore(ci): Lock AzureSignTool to version 4 (#4190)
Fixes #4185
2024-03-18 13:42:24 +00:00
Andrew Dryga
f3c8c734ab feat(portal): Filtering, Fulltext Search, Pagination, Preloads (#3751)
On the domain side this PR extends `Domain.Repo` with filtering,
pagination, and ordering, along with some convention changes are
removing the code that is not needed since we have the filtering now.
This required to touch pretty much all contexts and code, but I went
through all public functions and added missing tests to make sure
nothing will be broken.

On the web side I've introduced a `<.live_table />` which is as close as
possible to being a drop-in replacement for the regular `<.table />`
(but requires to structure the LiveView module differently due to
assigns anyways). I've updated all the listing tables to use it.
2024-03-16 13:27:48 -06:00
Andrew Dryga
114696c0ba chore(infra): Split terraform files into folders and add domain to production app (#4172) 2024-03-16 11:54:06 -06:00