diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ab62ae0..dc1c7fb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,27 +8,26 @@ on: - '**' - '!main' - jobs: build: name: "Build" runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v3 -# - name: Calculate release version -# run: | -# echo "release_version=1.$(date +'%g%m%d%H%M').$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV -# - name: Set version -# run: | -# sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts src/main/kotlin/id/walt/Values.kt -# - run: | -# git tag v${{ env.release_version }} -# git push --tags + - name: Calculate release version + run: | + echo "release_version=1.$(date +'%g%m%d%H%M').$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV + - name: Set version + run: | + sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts src/main/kotlin/id/walt/Values.kt + - run: | + git tag v${{ env.release_version }} + git push --tags - name: Setup java uses: actions/setup-java@v2.1.0 with: distribution: 'adopt-hotspot' - java-version: '16' + java-version: '17' - name: Setup cache uses: actions/cache@v2 with: @@ -46,20 +45,28 @@ jobs: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} with: - arguments: build --no-daemon -# arguments: build publish --no-daemon -# - name: Docker Build and Push SNAPSHOT -# uses: philpotisk/github-action-docker-build-push@master -# env: -# DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} -# DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} -# DOCKER_FILE: Dockerfile -# CONTAINER_TAG: waltid/ssikit:latest -# - name: Prepare CD K8S -# run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-dev.yaml > k8s/deployment-dev_mod.yaml -# - name: Continuous deployment K8S -# uses: actions-hub/kubectl@master -# env: -# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} -# with: -# args: apply -n dev -f k8s/deployment-dev_mod.yaml + arguments: build publish --no-daemon + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{secrets.DOCKER_USERNAME}} + password: ${{secrets.DOCKER_PASSWORD}} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: waltid/ssikit:${{ env.release_version }} + + - name: Prepare CD K8S + run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" k8s/deployment-dev.yaml > k8s/deployment-dev_mod.yaml + - name: Continuous deployment K8S + uses: actions-hub/kubectl@master + env: + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} + with: + args: apply -n dev -f k8s/deployment-dev_mod.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b957bf42..430dd086 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,13 +38,20 @@ jobs: MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} with: arguments: build publish --no-daemon - - name: Docker build and push - uses: philpotisk/github-action-docker-build-push@master - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} - DOCKER_FILE: Dockerfile - CONTAINER_TAG: waltid/ssikit:latest + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{secrets.DOCKER_USERNAME}} + password: ${{secrets.DOCKER_PASSWORD}} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + tags: waltid/ssikit:latest - name: Changelog uses: ardalanamini/auto-changelog@v3 id: changelog diff --git a/config/fsStore.conf b/config/fsStore.conf index ccbc15f3..43bffc0d 100644 --- a/config/fsStore.conf +++ b/config/fsStore.conf @@ -1 +1,2 @@ dataRoot: "./data" +maxKeySize = 111 diff --git a/src/main/kotlin/id/walt/services/hkvstore/FileSystemHKVStore.kt b/src/main/kotlin/id/walt/services/hkvstore/FileSystemHKVStore.kt index f8498a28..b84b5251 100644 --- a/src/main/kotlin/id/walt/services/hkvstore/FileSystemHKVStore.kt +++ b/src/main/kotlin/id/walt/services/hkvstore/FileSystemHKVStore.kt @@ -11,7 +11,8 @@ import java.util.* import kotlin.io.path.* data class FilesystemStoreConfig( - val dataRoot: String + val dataRoot: String, + val maxKeySize: Int = 111 ) : ServiceConfiguration { val dataDirectory: Path = Path.of(dataRoot) } @@ -53,7 +54,7 @@ class FileSystemHKVStore(configPath: String) : HKVStoreService() { ?: throw IllegalArgumentException("No HKVS mapping found for hash: $hashMapping") private fun hashIfNeeded(path: Path): File { - if (path.name.length > MAX_KEY_SIZE) { + if (path.name.length > configuration.maxKeySize) { val hashedFileNameBytes = DigestUtils.sha3_512(path.nameWithoutExtension) val hashedFileName = Base32().encodeToString(hashedFileNameBytes).replace("=", "").replace("+", "") @@ -92,7 +93,7 @@ class FileSystemHKVStore(configPath: String) : HKVStoreService() { when (recursive) { false -> pathFileList?.filter { it.isFile }?.map { var mapping = it.toPath() - if (mapping.name.length > MAX_KEY_SIZE) { + if (mapping.name.length > configuration.maxKeySize) { mapping = mapping.parent.resolve(retrieveHashMapping(mapping.name)) } @@ -101,7 +102,7 @@ class FileSystemHKVStore(configPath: String) : HKVStoreService() { true -> pathFileList?.flatMap { var mapping = it.toPath() - if (mapping.name.length > MAX_KEY_SIZE) { + if (mapping.name.length > configuration.maxKeySize) { mapping = mapping.parent.resolve(retrieveHashMapping(mapping.name)) } @@ -123,7 +124,6 @@ class FileSystemHKVStore(configPath: String) : HKVStoreService() { private fun dataDirCombinePath(key: Path) = configuration.dataDirectory.combineSafe(key) companion object { - private const val MAX_KEY_SIZE = 111 private const val hashMappingDesc = "FileSystemHKVStore hash mappings properties" } } diff --git a/src/test/kotlin/id/walt/ecosystems/CheqdTest.kt b/src/test/kotlin/id/walt/ecosystems/CheqdTest.kt index f25a2969..6a7f6f12 100644 --- a/src/test/kotlin/id/walt/ecosystems/CheqdTest.kt +++ b/src/test/kotlin/id/walt/ecosystems/CheqdTest.kt @@ -36,6 +36,11 @@ class CheqdTest : StringSpec({ println("Deleted: $did") } + /*"Import did:cheqd" { + println("Importing: $did") + DidService.importDidAndKeys(did!!) + }*/ + "Test did:cheqd verification" { val verificationResult = Auditor.getService().verify(vc!!, listOf(SignaturePolicy()))