-
-
Notifications
You must be signed in to change notification settings - Fork 49
Feature: Refactor CLI #68
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
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
1a5b183
add maven wrapper
infeo 52543c2
remove old code & prepare pom
infeo aecf18c
switch to JUL (for now)
infeo 92f3cb3
implement mvp
infeo ce7936c
update CI
infeo 067d73d
automatically wipe password once used
infeo f8e3e11
use correct maven property
infeo 60fc1b9
update maven wrapper
infeo efdbd9b
cleanup
infeo e935ab3
modularize app
infeo 83538f8
fix error in help message
infeo 702afb5
align password parameters
infeo 3a371e1
clean up pom
infeo 2ad10f2
add maven-exec-plugin
infeo 38d357e
Improve app behaviour:
infeo dfd562e
Revert "switch to JUL (for now)"
infeo 883359c
colorize console
infeo 2c6a42a
add option to set maxCleartextNameLimit
infeo 6f3ba44
instead of assembled jar, use maven shade plugin to create an uber-jar.
infeo 9e444ec
add verbose logging
infeo 654e620
fix ci
infeo c2c260f
clean up
infeo c3421ca
Update README
infeo 03fde0c
remove unsupported docker image
infeo 4a5f9c5
update gitignore
infeo 5efd135
adjust name of shaded jar (for CI integration)
infeo a561728
cleanup
infeo a9481f6
removed unused IPC for password input
infeo 897dda7
throw exception if password file is greater than 10KB
infeo fa0437b
fix password from file source and specify file format
infeo ee9d0b6
cleanup
infeo 0f9564d
more renaming
infeo e527dca
use picocli built in way to read from stdin
infeo 1e246c2
generalize logging to be also used in subcommands
infeo 080c17e
introduce "unlock" subcommand
infeo 19735db
remove TODO
infeo 338ddcc
switch from maven shade to jpackage
infeo e33b1f0
fis binary workflow
infeo 36a7c77
make MountSetup error resistant by using enum constants directly
infeo 63644de
fix build-binary workflow
infeo c1ea6f2
use a constant for masterkey file name
infeo 92e6db2
fix error in loggingMixin
infeo 087d358
read app version from system property
infeo bb4dbbd
adjust local build script
infeo 47cb717
add command to list available mounters
infeo 0b378b7
add shell script for unix builds
infeo 480b1a9
use shutdown hook instead of waiting for input
infeo 506b4ad
make build script more robust [ci skip]
infeo 2e5b271
remove unnecessary uses expression in module-info
infeo d59feca
use os dependent build scripts [ci skip]
infeo ef40c6b
Update README [ci skip]
infeo 18c74ab
Add section about possible cleanup tasks.
infeo da44681
use correct version number
infeo fc34254
improve error handling when loading masterkey
infeo 19409ab
handle correctly unexpected regular app shutdown.
infeo 2ab1e19
follow bash standards
infeo 99f38a7
fix wrong arch variable and use github built in macos 64 runner
infeo eb812cc
upload release artifacts to release page and add gpg signature
infeo 2060729
make local build scripts more robust
infeo ded3f90
correct build scripts
infeo 60e53ae
strip new line from end of password file
infeo c35d317
format pom
infeo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: Build java app image | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| sem-version: | ||
| description: 'Version' | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| env: | ||
| JAVA_DIST: 'zulu' | ||
| JAVA_VERSION: '22.0.2+9' | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| prepare: | ||
| name: Determines the versions strings for the binaries | ||
| runs-on: [ubuntu-latest] | ||
| outputs: | ||
| semVerStr: ${{ steps.determine-version.outputs.version }} | ||
| semVerNum: ${{steps.determine-number.outputs.number}} | ||
| steps: | ||
| - id: determine-version | ||
| shell: pwsh | ||
| run: | | ||
| if ( ${{github.event_name}} -eq 'release') { | ||
| echo "version=${{ github.event.release.tag_name}}" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| } else if (${{inputs.sem-version}}) { | ||
| echo "version=${{ inputs.sem-version}}" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| } | ||
| Write-Error "Version neither via input nor by tag specified. Aborting" | ||
| exit 1 | ||
| - id: determine-number | ||
| run: | | ||
| SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | ||
| echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| build-binary: | ||
| name: Build java app image | ||
| needs: [prepare] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| architecture: x64 | ||
| native-access-lib: 'org.cryptomator.jfuse.linux.amd64' | ||
| binary-dir-suffix: "" | ||
| - os: [self-hosted, Linux, ARM64] | ||
| architecture: aarch64 | ||
| native-access-lib: 'org.cryptomator.jfuse.linux.aarch64' | ||
| binary-dir-suffix: "" | ||
| - os: macos-latest-large | ||
| architecture: x64 | ||
| native-access-lib: 'org.cryptomator.jfuse.mac' | ||
| binary-dir-suffix: ".app" | ||
| - os: macos-latest | ||
| architecture: aarch64 | ||
| native-access-lib: 'org.cryptomator.jfuse.mac' | ||
| binary-dir-suffix: ".app" | ||
| - os: windows-latest | ||
| architecture: x64 | ||
| native-access-lib: 'org.cryptomator.jfuse.win' | ||
| binary-dir-suffix: "" | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Preparations fpr windows runner | ||
| if: startsWith(matrix.os, 'windows') | ||
| run: echo "JPACKAGE_OS_OPTS=--win-console" >> "$GITHUB_ENV" | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '22' | ||
| distribution: 'zulu' | ||
| - name: Set version | ||
| run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }} | ||
| - name: Run maven | ||
| run: mvn -B clean package -Pwin -DskipTests | ||
| - name: Patch target dir | ||
| run: | | ||
| cp LICENSE.txt target | ||
| cp target/cryptomator-*.jar target/mods | ||
| - name: Run jlink | ||
| shell: pwsh | ||
| run: > | ||
| & $env:JAVA_HOME\bin\jlink | ||
| --verbose | ||
| --output target\runtime | ||
| --module-path "${env:JAVA_HOME}\jmods" | ||
| --add-modules java.base,java.compiler,java.naming,java.xml ` | ||
| --strip-native-commands ` | ||
| --no-header-files ` | ||
| --no-man-pages ` | ||
| --strip-debug ` | ||
| --compress zip-6 | ||
| - name: Run jpackage | ||
| shell: pwsh | ||
| run: > | ||
| & $env:JAVA_HOME\bin\jpackage | ||
| --verbose | ||
| --type app-image | ||
| --runtime-image target/runtime | ||
| --input target/libs | ||
| --module-path target/mods | ||
| --module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli | ||
| --dest target | ||
| --name cryptomator-cli | ||
| --vendor "Skymatic GmbH" | ||
| --copyright "(C) 2016 - 2024 Skymatic GmbH" | ||
| --app-version "${{ needs.prepare.outputs.semVerNum }}" | ||
| --java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}" | ||
| --java-options "--enable-preview" | ||
| --java-options "--enable-native-access=${{ matrix.native-access-lib }}" | ||
| --java-options "-Xss5m" | ||
| --java-options "-Xmx256m" | ||
| --java-options '-Dfile.encoding="utf-8"' | ||
| ${JPACKAGE_OS_OPTS} | ||
infeo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| path: ./target/cryptomator-cli${{ matrix.binary-dir-suffix }} | ||
| if-no-files-found: error | ||
| - name: Zip binary for release | ||
| if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published' | ||
| shell: pwsh | ||
| run: Compress-Archive -Path .\target\cryptomator-cli${{ matrix.binary-dir-suffix }} -DestinationPath .\cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
| - name: Create detached GPG signature with key 615D449FE6E6A235 | ||
| run: | | ||
| echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import | ||
| echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
| env: | ||
| GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} | ||
| GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} | ||
| - name: Publish artefact on GitHub Releases | ||
| if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| fail_on_unmatched_files: true | ||
| token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} | ||
| files: | | ||
| cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
| cryptomator-cli-*.asc | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,66 +7,33 @@ jobs: | |
| build: | ||
| name: Build and Test | ||
| runs-on: ubuntu-latest | ||
| #This check is case insensitive | ||
| if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | ||
| outputs: | ||
| artifactVersion: ${{ steps.setversion.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: actions/setup-java@v1 | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| - uses: actions/cache@v1 | ||
| with: | ||
| path: ~/.m2/repository | ||
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-maven- | ||
| java-version: '22' | ||
| distribution: 'temurin' | ||
| - name: Ensure to use tagged version | ||
| run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| - name: Output project version | ||
| id: setversion | ||
| run: | | ||
| BUILD_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) | ||
| echo "::set-output name=version::${BUILD_VERSION}" | ||
| echo "version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT" | ||
| - name: Build and Test | ||
| run: mvn -B install | ||
| - name: Upload artifact cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
| uses: actions/upload-artifact@v2 | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
| path: target/cryptomator-cli-*.jar | ||
|
|
||
| release: | ||
| name: Draft a Release on GitHub Releases and uploads the build artifacts to it | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| steps: | ||
| - name: Download cryptomator-cli.jar | ||
| uses: actions/download-artifact@v1 | ||
| with: | ||
| name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
| path: . | ||
| - name: Create Release | ||
| id: create_release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ github.ref }} | ||
| release_name: ${{ github.ref }} | ||
| body: | | ||
| :construction: Work in Progress | ||
| draft: true | ||
| prerelease: false | ||
| - name: Upload cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar to GitHub Releases | ||
| uses: actions/[email protected] | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Create release | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
| asset_name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
| asset_content_type: application/jar | ||
| token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} | ||
| generate_release_notes: true | ||
| draft: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,7 @@ out/ | |
| .idea_modules/ | ||
| *.iws | ||
|
|
||
| *.iml | ||
| *.iml | ||
|
|
||
| #mvn shade plugin artifact | ||
| dependency-reduced-pom.xml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| wrapperVersion=3.3.2 | ||
| distributionType=only-script | ||
| distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.