Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New updater/installer #1698

Open
wants to merge 56 commits into
base: v2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5002567
[desktop] Minor tauri fixes and improvments
vlabo Aug 2, 2024
9472a1f
[desktop] Add update tauri process README
vlabo Aug 2, 2024
4c340f7
[desktop] Fix all clippy warning. Add clippy to CI.
vlabo Aug 2, 2024
556e5dd
[desktop] tauri remove some global variables.
vlabo Aug 5, 2024
abf4446
[WIP] New updater
vlabo Aug 13, 2024
9bae1af
[WIP] New updater first working prototype
vlabo Aug 16, 2024
f7abb70
[WIP] Fix SELinux permissions
vlabo Aug 27, 2024
701505a
[WIP] working download and replace.
vlabo Aug 30, 2024
8c6eb04
[desktop] Fix merge issues
vlabo Sep 5, 2024
83ec18f
[WIP] Updater support for windows
vlabo Sep 11, 2024
84a15b5
[WIP] updater rafactoring, minor improvments
vlabo Sep 17, 2024
1a86658
[WIP] Refactoring and bug fixes
vlabo Sep 18, 2024
072d7e6
[WIP] Minor improvments
vlabo Sep 19, 2024
b3ff6f1
[WIP] Error and state handleing improvments, better logs
vlabo Sep 19, 2024
89b533f
[WIP] Refactoring
vlabo Sep 20, 2024
1b6ee72
[WIP] Fix edge upgrade edge cases
vlabo Sep 25, 2024
08830f2
[WIP] Fix ui api authentication
vlabo Sep 25, 2024
7cf20b2
[WIP] Remove old code
vlabo Sep 25, 2024
c9631da
[WIP] Add update notifications
vlabo Sep 26, 2024
61babe2
[WIP] Add restart command to instance
vlabo Sep 26, 2024
f027276
[WIP] Add restart service command for windows
vlabo Sep 27, 2024
97ce3c0
[WIP] Fix uninstaller deletion bug.
vlabo Sep 30, 2024
a452f0c
[WIP] Add RecoverIPTables command on linux
vlabo Sep 30, 2024
3411e08
[WIP] Fix cargo clippy lint build
vlabo Sep 30, 2024
8e1f3c0
[WIP] Add CI for building deb,rpm installers
vlabo Oct 2, 2024
71f67a8
[WIP] Improve CI build
vlabo Oct 7, 2024
1942272
[WIP] Improve windows installer build script
vlabo Oct 7, 2024
a79be8b
[WIP] Improve downloader resilience
vlabo Oct 7, 2024
a8517cd
[WIP] Fix minor bugs
vlabo Oct 8, 2024
a874ec9
[WIP] Fix unit tests
vlabo Oct 8, 2024
8b68243
[WIP] Add update from custom url functionality
vlabo Oct 9, 2024
5d9088f
[WIP] Improve bundle generation
dhaavi Oct 9, 2024
a1a4bf6
[WIP] Use cobra for updatemgr
dhaavi Oct 10, 2024
02791a4
[WIP] Add fallback on corrupted install
vlabo Oct 10, 2024
dd643a2
[WIP] Github workflow for the installers
vlabo Oct 11, 2024
a74720b
[WIP] Update release.yml
vlabo Oct 11, 2024
61a5b80
[WIP] Update release workflow
vlabo Oct 11, 2024
a7d97fe
[WIP] Update release workflow
vlabo Oct 11, 2024
7a28e40
[WIP] Update release workflow
vlabo Oct 11, 2024
96b1280
[WIP] Fix tauri compile issue
vlabo Oct 11, 2024
2958a0e
[WIP] Trigger release workflow
vlabo Oct 11, 2024
6b45c8a
[WIP] Fix earthly build
vlabo Oct 11, 2024
35cc0c3
[WIP] Fix windows release CI
vlabo Oct 11, 2024
993505b
[WIP] Fix CI artifact upload
vlabo Oct 11, 2024
5127cdb
[WIP] Fix CI build
vlabo Oct 11, 2024
7192d3b
[WIP] Fix windows CI build
vlabo Oct 11, 2024
3502eb2
[WIP] Fix windows CI
vlabo Oct 11, 2024
6be7330
[WIP] Fix windows installer CI
vlabo Oct 11, 2024
eb74b6c
[WIP] Fix path of the windows installers
vlabo Oct 11, 2024
d6669ff
Remove unpack suffixes when generating an index bundle
dhaavi Oct 16, 2024
68f5bf7
[github] Remove push from release workflow
vlabo Oct 18, 2024
d6812bb
[WIP] Remove updater index filename setting
vlabo Oct 18, 2024
68e3746
[WIP] Download real intel data while building
vlabo Oct 28, 2024
0f3f3c3
[WIP] Simplify update system
dhaavi Oct 31, 2024
7bc1c3b
Replace dataroot module with BinDir and DataDir on instance, adapt mo…
dhaavi Nov 6, 2024
1bd3b88
Merge concurrent changes
dhaavi Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/tauri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,22 @@ jobs:

- name: Build tauri project
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +tauri-ci

lint:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
with:
version: v0.8.0
- uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build tauri project
run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +tauri-lint
Comment on lines +54 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

+tauri-lint Target Missing in Earthfile

The +tauri-lint target referenced in .github/workflows/tauri.yml does not exist in your Earthfile. Please define the +tauri-lint target with the necessary linting commands to ensure the linting job executes correctly.

🔗 Analysis chain

Verify the +tauri-lint target in the Earthfile.

The use of a separate +tauri-lint target for the linting job is a good practice. However, please ensure that this target is properly defined in your Earthfile with the appropriate linting commands.

Run the following script to verify the +tauri-lint target:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the +tauri-lint target in the Earthfile

# Test: Search for the +tauri-lint target definition
rg --type-add 'earthfile:*.earth' --type earthfile '^\+tauri-lint:'

# If the above command doesn't find anything, check for any mention of tauri-lint
rg --type-add 'earthfile:*.earth' --type earthfile 'tauri-lint'

Length of output: 431


Script:

#!/bin/bash
# Description: Locate Earthfiles and verify the +tauri-lint target

# Find all Earthfiles (with and without .earth extension)
find . -type f \( -iname 'Earthfile' -o -iname '*.earth' \) > earthfiles_list.txt

# Check if any Earthfiles were found
if [ -s earthfiles_list.txt ]; then
  echo "Earthfiles found:"
  cat earthfiles_list.txt
  
  # Search for the +tauri-lint target within the found Earthfiles
  echo "Searching for '+tauri-lint' target in Earthfiles..."
  while IFS= read -r file; do
    echo "Checking in $file:"
    rg '^\+tauri-lint:' "$file" || echo "No '+tauri-lint' target found in $file."
    echo ""
  done < earthfiles_list.txt
else
  echo "No Earthfiles found in the repository."
fi

Length of output: 551

49 changes: 41 additions & 8 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,14 @@ tauri-build:
# Our tauri app has externalBins configured so tauri will try to embed them when it finished compiling
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
# See documentation for externalBins for more information on how tauri searches for the binaries.
COPY (+go-build/output --CMDS="portmaster-start portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
COPY (+go-build/output --CMDS="portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild

# Place them in the correct folder with the rust target tripple attached.
FOR bin IN $(ls /tmp/gobuild)
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
# snippet here:
RUN set -e ; \
dest="./binaries/${bin}-${target}" ; \
if [ -z "${bin##*.exe}" ]; then \
dest="./binaries/${bin%.*}-${target}.exe" ; \
fi ; \
dest="./binaries/${bin}" ; \
cp "/tmp/gobuild/${bin}" "${dest}" ;
END

Expand Down Expand Up @@ -506,8 +503,8 @@ tauri-build:
RUN echo output: $(ls -R "target/${target}/release")

# Binaries
SAVE ARTIFACT --if-exists --keep-ts "target/${target}/release/app" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/portmaster-app"
SAVE ARTIFACT --if-exists --keep-ts "target/${target}/release/app.exe" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/portmaster-app.exe"
SAVE ARTIFACT --if-exists --keep-ts "target/${target}/release/portmaster" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/portmaster-app"
SAVE ARTIFACT --if-exists --keep-ts "target/${target}/release/portmaster.exe" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/portmaster-app.exe"
SAVE ARTIFACT --if-exists --keep-ts "target/${target}/release/WebView2Loader.dll" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/WebView2Loader.dll"

# Installers
Expand Down Expand Up @@ -575,7 +572,7 @@ tauri-build-windows-bundle:
RUN echo "Version Suffix: $VERSION_SUFFIX"

RUN echo output: $(ls -R "target/${target}/release")
RUN mv "target/${target}/release/app.exe" "target/${target}/release/portmaster-app_${VERSION_SUFFIX}.exe"
RUN mv "target/${target}/release/portmaster.exe" "target/${target}/release/portmaster-app_${VERSION_SUFFIX}.exe"
RUN zip "target/${target}/release/portmaster-app_${VERSION_SUFFIX}.zip" "target/${target}/release/portmaster-app_${VERSION_SUFFIX}.exe" -j portmaster-app${VERSION_SUFFIX}.exe "target/${target}/release/WebView2Loader.dll" -j WebView2Loader.dll
SAVE ARTIFACT --if-exists "target/${target}/release/portmaster-app_${VERSION_SUFFIX}.zip" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/"

Expand Down Expand Up @@ -636,6 +633,42 @@ tauri-release:
BUILD +tauri-build --target="${arch}"
END

tauri-lint:
FROM +tauri-src

# Clippy (rust linter) will try to build the project before it runs the linter.
# Make sure we have evrything needed to build the project.
ARG target="x86_64-unknown-linux-gnu"

# if we want tauri to create the installer bundles we also need to provide all external binaries
# we need to do some magic here because tauri expects the binaries to include the rust target tripple.
# We already know that triple because it's a required argument. From that triple, we use +RUST_TO_GO_ARCH_STRING
# function from below to parse the triple and guess wich GOOS and GOARCH we need.
RUN mkdir /tmp/gobuild
RUN mkdir ./binaries

DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"

# Our tauri app has externalBins configured so tauri will try to embed them when it finished compiling
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
# See documentation for externalBins for more information on how tauri searches for the binaries.
COPY (+go-build/output --CMDS="portmaster-start portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild

# Place them in the correct folder with the rust target tripple attached.
FOR bin IN $(ls /tmp/gobuild)
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
# snippet here:
RUN set -e ; \
dest="./binaries/${bin}-${target}" ; \
if [ -z "${bin##*.exe}" ]; then \
dest="./binaries/${bin%.*}-${target}.exe" ; \
fi ; \
cp "/tmp/gobuild/${bin}" "${dest}" ;
END
DO rust+SET_CACHE_MOUNTS_ENV
RUN cargo clippy --all-targets --all-features -- -D warnings

kext-build:
FROM ${rust_builder_image}

Expand Down
22 changes: 11 additions & 11 deletions base/updater/export.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package updater

// Export exports the list of resources.
func (reg *ResourceRegistry) Export() map[string]*Resource {
reg.RLock()
defer reg.RUnlock()
// // Export exports the list of resources.
// func (reg *ResourceRegistry) Export() map[string]*Resource {
// reg.RLock()
// defer reg.RUnlock()

// copy the map
copiedResources := make(map[string]*Resource)
for key, val := range reg.resources {
copiedResources[key] = val.Export()
}
// // copy the map
// copiedResources := make(map[string]*Resource)
// for key, val := range reg.resources {
// copiedResources[key] = val.Export()
// }

return copiedResources
}
// return copiedResources
// }
Loading
Loading