about summary refs log tree commit diff
path: root/src/rest-api
diff options
context:
space:
mode:
Diffstat (limited to 'src/rest-api')
-rw-r--r--src/rest-api/cmd/BUILD.bazel16
-rw-r--r--src/rest-api/handler/BUILD.bazel2
-rw-r--r--src/rest-api/handler/handler.go2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/rest-api/cmd/BUILD.bazel b/src/rest-api/cmd/BUILD.bazel
index 10554e8..4ecded7 100644
--- a/src/rest-api/cmd/BUILD.bazel
+++ b/src/rest-api/cmd/BUILD.bazel
@@ -1,4 +1,6 @@
+load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
+load("@rules_helm//helm:defs.bzl", "helm_chart")
 load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push", "oci_tarball")
 load("@rules_pkg//:pkg.bzl", "pkg_tar")
 
@@ -9,8 +11,8 @@ go_library(
     visibility = ["//visibility:private"],
     deps = [
         "//src/rest-api/handler",
-        "//vendor/github.com/segmentio/kafka-go",
-        "//vendor/github.com/segmentio/kafka-go/sasl/plain",
+        "@com_github_segmentio_kafka_go//:kafka-go",
+        "@com_github_segmentio_kafka_go//sasl/plain",
     ],
 )
 
@@ -47,8 +49,18 @@ oci_tarball(
     repo_tags = [],
 )
 
+expand_template(
+    name = "stamped",
+    out = "_stamped.tags.txt",
+    stamp = 1,
+    stamp_substitutions = {"tag": "rest-api-{{STABLE_GIT_SHA}}"},
+    template = ["tag"],
+)
+
 oci_push(
     name = "push",
     image = ":image",
+    remote_tags = ":stamped",
     repository = "docker.io/baitinq/fs-tracer",
+    visibility = ["//visibility:public"],
 )
diff --git a/src/rest-api/handler/BUILD.bazel b/src/rest-api/handler/BUILD.bazel
index 13e9a5d..89adc69 100644
--- a/src/rest-api/handler/BUILD.bazel
+++ b/src/rest-api/handler/BUILD.bazel
@@ -5,5 +5,5 @@ go_library(
     srcs = ["handler.go"],
     importpath = "github.com/Baitinq/fs-tracer-backend/src/rest-api/handler",
     visibility = ["//visibility:public"],
-    deps = ["//vendor/github.com/segmentio/kafka-go"],
+    deps = ["@com_github_segmentio_kafka_go//:kafka-go"],
 )
diff --git a/src/rest-api/handler/handler.go b/src/rest-api/handler/handler.go
index 3fdd3f8..3454486 100644
--- a/src/rest-api/handler/handler.go
+++ b/src/rest-api/handler/handler.go
@@ -33,7 +33,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	defer cancel()
 
 	err = h.kafka_writer.WriteMessages(ctx, kafka.Message{
-		Key:   []byte("key-A"), //TODO: This routes to a partition. We should probably route by agent UUID
+		Key:   []byte("key"), //TODO:This routes to a partition. We should probably route by agent UUID TODO: wont this negate having multiple topics
 		Value: []byte(body),
 	})
 	if err != nil {