Commit Graph

490 Commits

Author SHA1 Message Date
Thomas Eizinger
73e60795d8 feat(relay): add smoke test script (#1834)
I finally figured out why the smoke test script was being funny. It
turns out that the TURN client I still had lying around in the `gateway`
binary was reading from the UDP socket in the background and thus
sometimes grabbed the relayed data and wanted to interpret it as a STUN
packet.

However, for this test, the `gateway` doesn't actually need a TURN
client at all. It communicates with the relay as if it were the `client`
itself.

By modifying the script to only work on localhost, we can avoid use of a
TURN client altogether in the relay and make this script deterministic
which is a big win for our CI confidence!
2023-07-31 20:13:27 +00:00
Jamil
8474f5acc3 elixir: Bump setup-chromedriver action (#1827)
Squeezing in this fix from #1727 to unblock other PRs as that one is
being reviewed.
2023-07-29 16:47:20 -07:00
Gabi
06c1a53fae ci: fix test flakiness (#1810) 2023-07-20 21:04:31 +00:00
Jamil
504d118539 Announce 1.0 early access (#1791)
- Add 1.0 blogpost
- Update font to `Public Sans` since it has all weights and offers
better readability
- Various layout/style fixes
- Disable kotlin draft release job

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Dryga <andrew@dryga.com>
2023-07-17 22:48:35 +00:00
Pratik Velani
fc3be9a6b3 android: update connlib dependency and integration (#1752)
- Replaced connlib dependency to use `rust/connlib/clients/android/lib`
project
- Added `rust-android-gradle` to android project
- Set the `cargo build` target directory to
`rust/connlib/clients/android/lib/build/cargo-target`
- Moved `logger`, `session`, and `vpn` classes to their independent
packages.
- Added `SessionCallback` contract for the session callbacks.

---------

Signed-off-by: Pratik Velani <pratikvelani@gmail.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-07-17 18:50:39 +00:00
dependabot[bot]
ed8a74e642 Bump hashicorp/tfc-workflows-github from 1.0.0 to 1.0.2 (#1780)
Bumps
[hashicorp/tfc-workflows-github](https://github.com/hashicorp/tfc-workflows-github)
from 1.0.0 to 1.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/hashicorp/tfc-workflows-github/releases">hashicorp/tfc-workflows-github's
releases</a>.</em></p>
<blockquote>
<h2>v1.0.2</h2>
<p>Bug fixes from <a
href="https://github.com/hashicorp/tfc-workflows-tooling/releases/tag/v1.0.2">tfc-workflows-tooling@v1.0.2</a>
version bump.</p>
<h2>v1.0.1</h2>
<p>Bug fixes and enhancements from <a
href="https://github.com/hashicorp/tfc-workflows-tooling/releases/tag/v1.0.1">tfc-workflows-tooling@v1.0.1</a>
version bump</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/hashicorp/tfc-workflows-github/blob/main/CHANGELOG.md">hashicorp/tfc-workflows-github's
changelog</a>.</em></p>
<blockquote>
<h1>v1.0.2</h1>
<ul>
<li>Bug fixes and enhancements from <a
href="https://github.com/hashicorp/tfc-workflows-tooling/releases/tag/v1.0.2">tfc-workflows-tooling@v1.0.2</a>
version bump</li>
</ul>
<h1>v1.0.1</h1>
<ul>
<li>Bug fixes and enhancements from <a
href="https://github.com/hashicorp/tfc-workflows-tooling/releases/tag/v1.0.1">tfc-workflows-tooling@v1.0.1</a>
version bump</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="02ae73d5f2"><code>02ae73d</code></a>
Prepare for v1.0.2 (<a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/11">#11</a>)</li>
<li><a
href="c198b4e6a2"><code>c198b4e</code></a>
Prepare v1.0.1 release (<a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/8">#8</a>)</li>
<li><a
href="c18b3c5402"><code>c18b3c5</code></a>
Merge pull request <a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/6">#6</a>
from raisedadead/fix/comment-in-actions</li>
<li><a
href="e79c9911cd"><code>e79c991</code></a>
fix(workflows): adjust the PR comment for formatting</li>
<li><a
href="90c7396325"><code>90c7396</code></a>
Merge pull request <a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/4">#4</a>
from juicybaba/main</li>
<li><a
href="1179034dd0"><code>1179034</code></a>
fix: update use to uses</li>
<li><a
href="e3eae1bb99"><code>e3eae1b</code></a>
Merge pull request <a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/3">#3</a>
from hashicorp/mjyocca/add-pr-template</li>
<li><a
href="e0a9002100"><code>e0a9002</code></a>
add pull request template</li>
<li><a
href="71bf0a0e30"><code>71bf0a0</code></a>
Merge pull request <a
href="https://redirect.github.com/hashicorp/tfc-workflows-github/issues/2">#2</a>
from hashicorp/mjyocca/add-change-log-cleanup</li>
<li><a
href="e9851adbf1"><code>e9851ad</code></a>
fix descriptions and add links to docs</li>
<li>Additional commits viewable in <a
href="https://github.com/hashicorp/tfc-workflows-github/compare/v1.0.0...v1.0.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=hashicorp/tfc-workflows-github&package-manager=github_actions&previous-version=1.0.0&new-version=1.0.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-15 17:30:51 +00:00
Jamil
3c2b0c7505 Pass checks with proper matrix args (#1795) 2023-07-15 00:05:48 -07:00
Jamil
b782436f98 Fix Rust/Swift caching and parallelize swift build (#1793)
- Renames remnants of `cloud` ref to `main`
- Uses matrix for macOS, iphoneos builds
2023-07-14 23:09:15 -07:00
Roopesh Chander
9ad557f568 Integrate connlib build into apple build (#1759)
This PR improves the build process for the macOS / iOS apps by building
connlib as part of the macOS / iOS app build.

Fixes firezone/product#625.

This is how the build would work after this PR:
- `build-rust.sh` creates `libconnlib.a` for the appropriate target
triples only. lipo is not used. When creating macOS debug builds, it’s
built only for the native architecture.
- The network extension targets in the Xcode project set a library
search path as the cargo target dir, so that the Xcode build for a
target triple can pickup the appropriate `libconnlib.a` at link time.

Swift code reorganizations:
  - connlib’s Adapter has moved to the main app
- connlib’s CallbackHandler’s logic has moved to Adapter, which is set
as CallbackHandler’s delegate. The CallbackHandler serves as an
interface to receive callbacks from the FFI. In case we need to change
the FFI, CallbackHandler should change as well, so it remains in the
connlib directory. In case of changes to the Rust FFI, as part of the
Rust FFI change PR, we can modify the CallbackHandler class and leave
the delegate unchanged, so that the app can continue to be built without
errors.
- `Connlib.xcodeproject` and build scripts for building
`Connlib.xcframework` are removed
- Connlib headers and Swift files are copied to
`FirezoneNetworkExtension/Connlib` as part of the build process, and
used from there.

Rust build changes:
- The rust target dir remains the same, but it’s ~~passed explicitly as
`--target-dir`~~ used to set `CARGO_TARGET_DIR`, so that the same target
dir can be used to populate Xcode’s library search paths
- The `build.rs` for connlib-apple had lots of code to build Swift code
as part of the Rust build. This PR reverts it to the previous simple
version. With this PR, building connlib-apple (i.e. running
`build-rust.sh`) only builds the Rust code.
- ~~We set `cargo:rerun-if-env-changed=CONNLIB_MOCK`.~~ We don't set
this because it's not required.
- The Rust CI job for building connlib-apple is removed. It's built when
the macOS / iOS apps are built in swift.yml. This means that with this
PR, connlib-apple is tested only when `rust/connlib/**` changes, not
when `rust/**` changes. Is that ok?

Other changes not directly related to the build process change but part
of this PR:
  - There’s a cleanup script: `./cleanup.sh`
  - Fixed a typo in `swift-pass-checks.yml`: “paths-ginore”
2023-07-13 05:23:24 +00:00
Andrew Dryga
4f16caa5ff Add slack notification for failed deployments 2023-07-11 14:19:23 -06:00
Jamil
d27da5ee3d Fix cache for Docker buildx (#1750)
~~This is an attempt to fix the CI bug
[here](https://github.com/firezone/firezone/actions/runs/5491388141/jobs/10007864417#step:4:1638)
possibly introduced in
[d9eb2d18](https://github.com/firezone/firezone/commit/d9eb2d18#diff-88bd94db0d5cfd5f0617b7c4ed48c0212597378ed7e28714c5d86c95999b4c7dR29)
and uncovered / exacerbated in Elixir 1.15~~

Edit: looks like this ended up being a couple cache issues with GitHub
actions:
1. The `elixir_api-container-build` cache would always overwrite the
`elixir_web-container-build` on subsequent builds of the same
`github.ref_name` (cache is scoped to branch name by default), leading
to the consistent error `Elixir.Web.Mailer.NoopAdapter does not exist`
whenever a branch was pushed to more than once.
2. The same thing happens with the `integration_test-basic-flow` job
because the `api` service gets built after the `web` service in
docker-compose.yml, overwriting its cache

For some reason it seems the `APPLICATION_NAME` ARG is not busting the
Docker cache properly on GitHub actions for elixir container builds, so
the fix here was to [use
`scope=`](https://docs.docker.com/build/cache/backends/gha/#scope) to
segregate the cache layers between builds of the same branch.
2023-07-10 17:30:09 +00:00
Jamil
aadf8fd866 Pass-checks workflow per subdir (#1749) 2023-07-07 16:25:21 -07:00
Jamil
35eeb9904c Pass all required checks that weren't triggered in the PR (#1748)
Fixes #1747 
Fixes #1746
2023-07-07 15:04:42 -07:00
Roopesh Chander
c9c13e1e11 Bring in apple client into monorepo (#1737)
This PR brings in the apple client into the monorepo.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-07-07 10:37:24 -07:00
Gabi
eb5fc34f35 CI: add a flow that test client to resource ping (#1729)
This PR fixes a bunch of small things to allow a new flow to test
clients pinging a resource within docker compose.

Masquerade/Forwarding is enabled directly in the container for now, this
might change in the future.

Also added a README to be able to run this locally.

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-07-05 03:17:26 +00:00
Gabi
9cb024e787 Fix ubuntu 20.04 CI (#1734)
add a prefix key with host os to rust test job to prevent caching issues
2023-07-05 02:03:43 +00:00
Andrew Dryga
991759fbc2 Drop invalid cache restore keys 2023-07-04 18:23:43 -06:00
Andrew Dryga
8539543d3d Bump Elixir/OTP versions (#1730) 2023-07-03 23:11:47 +00:00
Jamil
5679d63206 Attempt to enable merge queue (#1713)
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group
2023-07-03 11:52:35 -07:00
Thomas Eizinger
9deae3653a chore: unify and optimize Rust CI (#1710)
- Instead of having two, very similar jobs, we run our fmt, clippy and
tests steps across all crates and operating systems.
- We remove the dependency of the android and apple builds on the tests
and thus get faster feedback.
- We force clippy to fail on any warning. This one is super important
IMO. Warnings in Rust are very useful and ignoring them can lead to bugs
(think "unused Result" etc).

Resolves #1714.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Francesca Lovebloom <franlovebloom@gmail.com>
2023-06-29 23:33:02 +00:00
Jamil
d35208bf17 Stub out client app directories in monorepo structure (#1716)
Stubs out the client app dirs and basic CI workflow for the client apps
in preparation to move them into this repository.

After this is merged @roop @pratikvelani you should be able to add the
client repos here.
2023-06-29 20:16:29 +00:00
Thomas Eizinger
d4e2624c28 fix(relay): remove smoke test CI script (#1717)
Unfortunately, this doesn't seem to be stable. I don't really understand
why. Judging from the logs, the problem is not in the relay but somehow
the final UDP packet doesn't arrive at the `gateway` binary.

To not unnecessarily block other PRs, I am removing the check for now.
2023-06-29 19:24:54 +00:00
Francesca Lovebloom
a4810986c7 connlib: Improve FFI bridges for Apple and Android (#1691)
This makes it possible to build the Apple/Android FFI bridges and
integrate them with their respective client apps.

---------

Signed-off-by: Francesca Lovebloom <franlovebloom@gmail.com>
Co-authored-by: Roopesh Chander <roop@roopc.net>
2023-06-28 11:29:59 -06:00
Andrew Dryga
e7d5d0579b Authentication for the live app (#1674)
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-06-27 13:11:36 -06:00
Gabi
e9be4b9ef5 connlib: moves it to the main firezone library
This brindgs connlib from its own separated repo to firezone's monorepo.
    
 On top of bringing connlib we also add and unify the Dockerfile for all
 rust binaries and add a docker-compose that can run a headless client, a
 relay and a gateway which eventually will test the whole flow between a
 client and a resource. For this to work we also incorporated some elixir
 scripts to generate portal tokens for those components.
2023-06-23 16:39:58 -06:00
Jamil
0faf8d906c Add pnpm to runners (#1683)
Found another place where pnpm needs to be added.
2023-06-23 12:42:35 -05:00
Jamil
8d8687224b Use pnpm over yarn (#1678)
Did some research when picking a package manager for the website and
settled on `pnpm` for the following reasons:

- CLI-compatible with `npm`
- Typically faster than even `yarn` especially on Apple silicon
- Security: Pnpm uses a different dependency resolution algorithm and
different folder structure of node_modules that prevents illegal access
to packages by other packages.

I think I caught all the places, but I may be missing something, so if
this isn't a good idea we can revert back.

This PR also cleans up the actions workflows to remove dead code.
2023-06-22 10:40:32 -07:00
Jamil
8fa12b8492 jamilbk%feat/stub website in cloud (#1675)
* Remove `www/`
* Stub empty `website/` to silence Vercel. This shouldn't cause
conflicts when we merge `cloud` to `master`. Perhaps we want to start
working off `master` soon, and move the current tip of master to
`legacy`?
2023-06-22 11:08:28 -06:00
Thomas Eizinger
0f594f44bc ci: install musl target via rust-toolchain.toml file (#1664)
Targets specified in the `rust-toolchain.toml` file are automatically installed by `rustup`. This avoid setup steps for other devs and also simplifies the CI setup.

To be able to compile native code to musl, we do need `musl-gcc` which comes with the `musl-tools` package on ubuntu.
2023-06-19 18:51:54 -03:00
Thomas Eizinger
533b12c99e ci: specify workspace directory for cache action correctly (#1663) 2023-06-18 10:37:34 -07:00
Thomas Eizinger
5090d207c2 feat(relay): implement nonces for authentication (#1654)
To complete the authentication scheme for the relay, we need to prompt
the client with a nonce when they send an unauthenticated request. The
semantic meaning of a nonce is opaque to the client. As a starting
point, we implement a count-based scheme. Each nonce is valid for 10
requests. After that, a request will be rejected with a 401 and the
client has to authenticate with a new nonce.

This scheme provides a basic form of replay-protection.
2023-06-15 09:11:08 -07:00
Andrew Dryga
89b7e3b474 Fix assets pipeline, add Elixir deps audit, add Android applink manifest (#1659) 2023-06-14 17:15:38 -06:00
Andrew Dryga
67482857b6 Add double quotes to the var itself 2023-06-12 15:52:25 -06:00
Andrew Dryga
36c8fa3beb Try to wrap tf vars in backticks 2023-06-12 15:49:47 -06:00
Andrew Dryga
17b18444a7 Add missing env for terraform workflow 2023-06-12 15:42:12 -06:00
Andrew Dryga
5cfd3867c8 Do not attempt to persist tag versions back to the repo 2023-06-12 15:31:26 -06:00
Andrew Dryga
a845c2999d Fix github branch name 2023-06-12 15:03:17 -06:00
Andrew Dryga
571e861f62 Try pushing update using GH API 2023-06-12 14:52:50 -06:00
Andrew Dryga
54d19f50a9 Bump checkout action vsn in rust workflow 2023-06-12 14:29:00 -06:00
Andrew Dryga
c7f0a463ae Rename pre-commit step 2023-06-12 14:26:28 -06:00
Andrew Dryga
9b3468d4f7 Fix path to versions file 2023-06-12 14:26:12 -06:00
Andrew Dryga
01f428fd35 Inherit secrets to child workflows 2023-06-12 14:13:30 -06:00
Andrew Dryga
d8c9cf1a89 Fix races for concurrency control 2023-06-12 14:11:15 -06:00
Andrew Dryga
7c883a0ba0 Remove copy-pasted required inputs 2023-06-12 14:08:41 -06:00
Andrew Dryga
bf61b7964a Add missing on_workflow call 2023-06-12 14:03:42 -06:00
Andrew Dryga
32ebd7cae3 Try a different CI setup 2023-06-12 14:00:47 -06:00
Andrew Dryga
9dbffee560 Experiment with condition
Workflow is not picked up by GitHub for some reason
2023-06-12 12:42:04 -06:00
Andrew Dryga
ecb016f03c Lave a note on workflow_run feature and fix checkout feature 2023-06-12 12:33:31 -06:00
Andrew Dryga
a7274fa671 Continuous delivery to staging (#1655) 2023-06-12 12:15:55 -06:00
Andrew Dryga
7dd512e372 Run pre-commit CI step on all PRs 2023-06-07 09:12:53 -06:00