Skip to content

Commit

Permalink
ci-fix (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb authored Jun 1, 2023
2 parents 1d39563 + 2833544 commit 764edcf
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 40 deletions.
63 changes: 35 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
21 changes: 14 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/fsStore.conf
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dataRoot: "./data"
maxKeySize = 111
10 changes: 5 additions & 5 deletions src/main/kotlin/id/walt/services/hkvstore/FileSystemHKVStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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("+", "")

Expand Down Expand Up @@ -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))
}

Expand All @@ -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))
}

Expand All @@ -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"
}
}
5 changes: 5 additions & 0 deletions src/test/kotlin/id/walt/ecosystems/CheqdTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

Expand Down

0 comments on commit 764edcf

Please sign in to comment.