Commit f8e15a18 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix deployment

- Adds gitlab-ci.yml
- Rename helm chart folder
- Update bintray repository path
parent 5cde0cba
...@@ -33,7 +33,7 @@ ext { ...@@ -33,7 +33,7 @@ ext {
dependencies { dependencies {
implementation 'org.memobase:memobase-service-utilities:1.4.0' implementation 'org.memobase:memobase-service-utilities:1.4.0'
implementation 'org.memobase:fedora-client:0.1.2' implementation 'org.memobase:fedora-client:0.3.0'
// Logging Framework // Logging Framework
implementation "org.apache.logging.log4j:log4j-api:${log4jV}" implementation "org.apache.logging.log4j:log4j-api:${log4jV}"
......
variables:
DOCKER_TLS_CERTDIR: ""
stages:
- test
- publish
test:
stage: test
image: gradle:6.3-jdk8
tags:
- mbr
script:
- gradle --no-daemon --no-scan --no-build-cache test --fail-fast --tests "org.memobase.Tests"
.build-image:
stage: publish
image: docker:stable
services:
- docker:dind
script:
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" "$REGISTRY"
- docker build --pull -t "$IMAGE_TAG" -f "$DOCKERFILE" .
- docker push "$IMAGE_TAG"
- docker logout
build-tagged-image:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
only:
- tags
build-latest-image:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
only:
- master
build-feature-branch-image:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD"
REGISTRY_USER: "$CI_REGISTRY_USER"
REGISTRY: "$CI_REGISTRY"
DOCKERFILE: "Dockerfile"
except:
- master
- tags
test-chart:
stage: test
image: dtzar/helm-kubectl:3.2.0
tags:
- mbr
script:
- helm lint helm-charts/
publish-chart:
stage: publish
image: dtzar/helm-kubectl:3.2.0
tags:
- mbr
script:
- export HELM_EXPERIMENTAL_OCI=1
- helm registry login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- ./insert_chart_versions.sh
- helm chart save helm-charts/ "$CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_TAG-chart"
- helm chart push "$CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_TAG-chart"
- helm registry logout "$CI_REGISTRY"
only:
- tags
\ No newline at end of file
#!/usr/bin/env bash #!/usr/bin/env bash
echo Creating release: $1 echo Creating release: $1
sed -i "s/version: 0.0.0/version: $CI_COMMIT_TAG/g" ./chart/Chart.yaml sed -i "s/version: 0.0.0/version: $CI_COMMIT_TAG/g" ./helm-charts/Chart.yaml
sed -i "s/appVersion: 0.0.0/appVersion: $CI_COMMIT_TAG/g" ./chart/Chart.yaml sed -i "s/appVersion: 0.0.0/appVersion: $CI_COMMIT_TAG/g" ./helm-charts/Chart.yaml
sed -i "s/tag: \"latest\"/tag: $CI_COMMIT_TAG/g" ./chart/values.yaml sed -i "s/tag: \"latest\"/tag: $CI_COMMIT_TAG/g" ./helm-charts/values.yaml
\ No newline at end of file \ No newline at end of file
...@@ -33,6 +33,7 @@ import org.apache.kafka.streams.Topology ...@@ -33,6 +33,7 @@ import org.apache.kafka.streams.Topology
import org.apache.kafka.streams.kstream.Predicate import org.apache.kafka.streams.kstream.Predicate
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import org.memobase.fedora.FedoraClientImpl import org.memobase.fedora.FedoraClientImpl
import org.memobase.fedora.RdfResponseTypes
import org.memobase.model.EventMessage import org.memobase.model.EventMessage
import org.memobase.rdf.* import org.memobase.rdf.*
import org.memobase.settings.SettingsLoader import org.memobase.settings.SettingsLoader
...@@ -98,7 +99,7 @@ class KafkaTopology( ...@@ -98,7 +99,7 @@ class KafkaTopology(
} }
private fun requestPrimaryResource(message: EventMessage): Pair<EventMessage, String> { private fun requestPrimaryResource(message: EventMessage): Pair<EventMessage, String> {
return Pair(message, fedora.fetchRdfResourceIntoString(URI.create(message.objectPath), "text/plain")) return Pair(message, fedora.fetchRdfResourceIntoString(URI.create(message.objectPath), RdfResponseTypes.NTRIPLES))
} }
private fun parseModel(input: Pair<EventMessage, String>): Pair<EventMessage, Model> { private fun parseModel(input: Pair<EventMessage, String>): Pair<EventMessage, Model> {
...@@ -142,7 +143,7 @@ class KafkaTopology( ...@@ -142,7 +143,7 @@ class KafkaTopology(
subject.listProperties(property).forEach { subject.listProperties(property).forEach {
if (it.`object`.isResource) { if (it.`object`.isResource) {
val uri = it.`object`.asResource().uri val uri = it.`object`.asResource().uri
val data = fedora.fetchRdfResourceIntoString(URI(uri), "text/plain") val data = fedora.fetchRdfResourceIntoString(URI(uri), RdfResponseTypes.NTRIPLES)
RDFDataMgr.read(model, data.byteInputStream(StandardCharsets.UTF_8), Lang.NT) RDFDataMgr.read(model, data.byteInputStream(StandardCharsets.UTF_8), Lang.NT)
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment