From a7734f29b04d77c567adec6f6dd818a66a02dcf7 Mon Sep 17 00:00:00 2001 From: Grigorii Chudnov Date: Thu, 2 Sep 2021 16:30:35 +0200 Subject: [PATCH 1/3] set to 0.9.2-SNAPSHOT (#189) * Setting version to 0.9.1 Signed-off-by: Grigorii Chudnov * Setting version to 0.9.2-SNAPSHOT Signed-off-by: Grigorii Chudnov --- version.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.sbt b/version.sbt index 05329e9..f972f6a 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version := "0.9.1-SNAPSHOT" +ThisBuild / version := "0.9.2-SNAPSHOT" From 2eb7e5d3f9246ac7c4626ae2238196c33b2d6722 Mon Sep 17 00:00:00 2001 From: Matthew de Detrich Date: Thu, 2 Sep 2021 16:31:00 +0200 Subject: [PATCH 2/3] Use official docker login plugin for ghcr login (#185) Signed-off-by: Matthew de Detrich --- .github/workflows/ci.yml | 10 ++++++---- build.sbt | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ba4df0..1686994 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,10 +51,12 @@ jobs: - name: Check that workflows are up to date run: sbt ++${{ matrix.scala }} githubWorkflowCheck - - name: Login to Docker - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: docker.pkg.github.com + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Launch Nakadi run: docker-compose up -d diff --git a/build.sbt b/build.sbt index 943005c..cb051e7 100644 --- a/build.sbt +++ b/build.sbt @@ -159,11 +159,13 @@ pomIncludeRepository := (_ => false) resolvers += Resolver.jcenterRepo ThisBuild / githubWorkflowBuild := Seq( - WorkflowStep.Run( - List("echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin"), - name = Some("Login to Docker"), - env = Map( - "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}" + WorkflowStep.Use( + UseRef.Public("docker", "login-action", "v1"), + name = Some("Login to GitHub Container Registry"), + params = Map( + "registry" -> "docker.pkg.github.com", + "username" -> "${{ github.actor }}", + "password" -> "${{ secrets.GITHUB_TOKEN }}" ) ), WorkflowStep.Run(List("docker-compose up -d"), name = Some("Launch Nakadi")), From f10ca5a8108058470ce9d0ab816f3f7c90bc22ad Mon Sep 17 00:00:00 2001 From: Chanh Nguyen Date: Mon, 22 Nov 2021 17:17:27 +0200 Subject: [PATCH 3/3] Extend metadata model for published_by (#193) * extend metadata model for published_by Signed-off-by: Chanh Nguyen --- src/main/scala/org/zalando/kanadi/api/Events.scala | 13 ++++++++----- .../org/zalando/kanadi/models/PublishedBy.scala | 13 +++++++++++++ .../scala/org/zalando/kanadi/api/JsonSpec.scala | 8 +++++--- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 src/main/scala/org/zalando/kanadi/models/PublishedBy.scala diff --git a/src/main/scala/org/zalando/kanadi/api/Events.scala b/src/main/scala/org/zalando/kanadi/api/Events.scala index 1080d18..9cbaa48 100644 --- a/src/main/scala/org/zalando/kanadi/api/Events.scala +++ b/src/main/scala/org/zalando/kanadi/api/Events.scala @@ -151,11 +151,12 @@ final case class Metadata(eid: EventId = EventId.random, flowId: Option[FlowId] = None, partition: Option[Partition] = None, partitionCompactionKey: Option[PartitionCompactionKey] = None, - spanCtx: Option[SpanCtx] = None) + spanCtx: Option[SpanCtx] = None, + publishedBy: Option[PublishedBy] = None) object Metadata { - implicit val metadataEncoder: Encoder[Metadata] = Encoder.forProduct9( + implicit val metadataEncoder: Encoder[Metadata] = Encoder.forProduct10( "eid", "occurred_at", "event_type", @@ -164,10 +165,11 @@ object Metadata { "flow_id", "partition", "partition_compaction_key", - "span_ctx" + "span_ctx", + "published_by" )(x => Metadata.unapply(x).get) - implicit val metadataDecoder: Decoder[Metadata] = Decoder.forProduct9( + implicit val metadataDecoder: Decoder[Metadata] = Decoder.forProduct10( "eid", "occurred_at", "event_type", @@ -176,7 +178,8 @@ object Metadata { "flow_id", "partition", "partition_compaction_key", - "span_ctx" + "span_ctx", + "published_by" )(Metadata.apply) } diff --git a/src/main/scala/org/zalando/kanadi/models/PublishedBy.scala b/src/main/scala/org/zalando/kanadi/models/PublishedBy.scala new file mode 100644 index 0000000..45f8c8e --- /dev/null +++ b/src/main/scala/org/zalando/kanadi/models/PublishedBy.scala @@ -0,0 +1,13 @@ +package org.zalando.kanadi.models + +import io.circe.syntax._ +import io.circe.{Decoder, Encoder} + +final case class PublishedBy(name: String) extends AnyVal + +object PublishedBy { + implicit val publishedByEncoder: Encoder[PublishedBy] = + Encoder.instance[PublishedBy](_.name.asJson) + implicit val publishedByDecoder: Decoder[PublishedBy] = + Decoder[String].map(PublishedBy.apply) +} diff --git a/src/test/scala/org/zalando/kanadi/api/JsonSpec.scala b/src/test/scala/org/zalando/kanadi/api/JsonSpec.scala index 86bda87..ea3e3cb 100644 --- a/src/test/scala/org/zalando/kanadi/api/JsonSpec.scala +++ b/src/test/scala/org/zalando/kanadi/api/JsonSpec.scala @@ -10,7 +10,7 @@ import org.specs2.specification.core.SpecStructure import io.circe._ import io.circe.parser._ import io.circe.syntax._ -import org.zalando.kanadi.models.{EventId, SpanCtx} +import org.zalando.kanadi.models.{EventId, SpanCtx, PublishedBy} import java.time.OffsetDateTime import io.circe.CursorOp.DownField @@ -28,7 +28,9 @@ class JsonSpec extends Specification { val uuid = UUID.randomUUID() val testEvent = SomeEvent("Bart", "Simpson", uuid) val now = OffsetDateTime.now() - val md = Metadata(eid = EventId(UUID.fromString("4ae5011e-eb01-11e5-8b4a-1c6f65464fc6")), occurredAt = now) + val md = Metadata(eid = EventId(UUID.fromString("4ae5011e-eb01-11e5-8b4a-1c6f65464fc6")), + occurredAt = now, + publishedBy = Some(PublishedBy("bart_simpson"))) val coreEventJson = s""" "first_name": "Bart", @@ -37,7 +39,7 @@ class JsonSpec extends Specification { """ val metadata = - s""""eid": "4ae5011e-eb01-11e5-8b4a-1c6f65464fc6", "occurred_at": ${now.asJson}""" + s""""eid": "4ae5011e-eb01-11e5-8b4a-1c6f65464fc6", "occurred_at": ${now.asJson}, "published_by": "bart_simpson"""" val businessEventJson = s"""{ "metadata": {$metadata},