From bac1bb2e7ab07d4f397b7e7c1a654cd8908541a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9amus=20=C3=93=20Ceanainn?= Date: Wed, 13 Apr 2022 17:44:37 +0100 Subject: [PATCH] Fix Docker publishing (#91) * Delete unused Travis CI configuration file * Update changelog * Remove git versioning * Fix publishing to Docker via CDP --- .travis.yml | 15 ---- CHANGELOG.md | 48 ++++++++++- README.md | 4 +- auth-example/docker-compose.yml | 2 +- basic-example/docker-compose.yml | 6 +- build.sbt | 8 +- delivery.yaml | 139 ++++++++++++++++++++++++++++++- project/plugins.sbt | 1 - 8 files changed, 187 insertions(+), 36 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7a70ce6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: scala -scala: - - 2.11.8 -jdk: - - openjdk8 -sudo: false -before_cache: - # Cleanup the cached directories to avoid unnecessary cache updates - - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete - - find $HOME/.sbt -name "*.lock" -print -delete -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt - diff --git a/CHANGELOG.md b/CHANGELOG.md index 05b1cee..2d6a8df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,55 @@ +# v1.3.0 + +- Added support for filtering CloudWatch metrics. +- Added support for configuring AdminClient in KafkaSettings. +- Added support for specifying root log level via Java options. + +# v1.2.0 + +- Added support for Kafka 2.2.0. +- Improved DataDog metric name format (reducing redundancy with metric tags). + +# v1.1.0 + +- Added improved application health checks. + +# v1.0.7 + +- Added support for Kafka 2.0.0. + +# v1.0.6 + +- Added support for Kafka 1.1.0. +- Added support for connecting to Kafka brokers using authentication. + +# v1.0.3 + +- Moved team name (ownership) to 'Machina' in Docker / Pierone. Images are now published to `registry-write.opensource.zalan.do/machina` instead of `registry-write.opensource.zalan.do/dougal`. + +# v1.0.2 + +- Added support for reporting aggregated consumer lag in exported metrics. + +# v1.0.1 + +- Added support for publishing metrics to Datadog. + +# v1.0.0 + +- Added support for Kafka 1.0.0. + # v0.3.0 - - Added support for exporting lag metrics to AWS CloudWatch +- Added support for exporting lag metrics to AWS CloudWatch. # v0.2.1 - - Fixed logging issues +- Fixed logging issues. # v0.2.0 - - Support added for Kafka 0.10.2.0 +- Support added for Kafka 0.10.2.0. # v0.1.0 - - Initial release for Kafka 0.10.0.1 +- Initial release for Kafka 0.10.0.1. \ No newline at end of file diff --git a/README.md b/README.md index 19ceca3..5fd0ae5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Remora [![Build Status](https://travis-ci.org/zalando-incubator/remora.svg?branch=master)](https://travis-ci.org/zalando-incubator/remora) +# Remora ![Grafana Graph](https://raw.githubusercontent.com/imduffy15/remora-fetcher/master/img/grafana.png) @@ -505,7 +505,7 @@ This way, a docker container running Remora will be able to communicate with a D ### Build -Create docker image locally. The image will be built to `remora:` and `latest` +Create docker image locally. The image will be built to `remora:0.1.0-SNAPSHOT` by default. ```bash $ sbt docker:publishLocal diff --git a/auth-example/docker-compose.yml b/auth-example/docker-compose.yml index 3c02f89..6b96733 100644 --- a/auth-example/docker-compose.yml +++ b/auth-example/docker-compose.yml @@ -24,7 +24,7 @@ services: - '9092:9092' remora: - image: registry.opensource.zalan.do/machina/remora + image: registry.opensource.zalan.do/machina/remora:1.3.0 depends_on: - kafka hostname: remora diff --git a/basic-example/docker-compose.yml b/basic-example/docker-compose.yml index 87631fc..c39e467 100644 --- a/basic-example/docker-compose.yml +++ b/basic-example/docker-compose.yml @@ -22,9 +22,9 @@ services: remora: # Built locally - image: remora -# latest from repo -# image: registry.opensource.zalan.do/machina/remora + image: remora:0.1.0-SNAPSHOT + # From repo + #image: registry.opensource.zalan.do/machina/remora:1.3.0 depends_on: - kafka environment: diff --git a/build.sbt b/build.sbt index a039194..f5e3386 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ lazy val commonSettings = Seq( lazy val dockerSettings = Seq( daemonUser := "root", - dockerUpdateLatest := true, + dockerUpdateLatest := false, dockerBaseImage := "registry.opensource.zalan.do/library/openjdk-8:latest", dockerExposedPorts := Seq(9000), dockerExposedVolumes := Seq("/opt/docker/logs"), @@ -14,16 +14,10 @@ lazy val dockerSettings = Seq( maintainer := "team-buffalo@zalando.ie" ) -lazy val gitSettings = Seq( - git.useGitDescribe := true -) - lazy val root = (project in file(".")) .settings(commonSettings) .settings(dockerSettings) - .settings(gitSettings) .enablePlugins( - GitVersioning, JavaServerAppPackaging ) diff --git a/delivery.yaml b/delivery.yaml index 09848de..78b62f9 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -1,9 +1,142 @@ version: "2017-09-20" + +dependencies: + - id: base-image + type: docker + ref: registry.opensource.zalan.do/library/openjdk-8 + pipeline: - - id: build + - id: compile-test type: script - overlay: ci/scala + when: + event: push + branch: master + vm_config: + type: linux + image: cdp-runtime/jdk8-sbt + size: large + commands: + - desc: Compile and test application + cmd: | + sbt compile test + + - id: release-patch-version + type: script + when: + event: push + branch: master + triggered_by_dependency: null + requires_human_approval: true + vm_config: + type: linux + image: cdp-runtime/jdk8-sbt + size: large + commands: + - desc: Build and push docker image + cmd: | + echo "Determining next version to publish:" + current_release=$(git describe --tags origin/master) + if [[ $(cut -d '-' -f1 <<< $current_release) =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + version="$(cut -d '-' -f1 <<< $current_release)" + echo "Previous release: $version" + buildVersion="$(cut -d '.' -f3 <<< $version)" + minorVersion="$(cut -d '.' -f2 <<< $version)" + majorVersion="$(cut -d '.' -f1 <<< $version)" + version="$majorVersion.$minorVersion.$(($buildVersion + 1))" + else + echo "Issue with current tag: $current_release" + return -1 + fi + sbt "set version in ThisBuild := \"$(cut -c2- <<< $version)\"" docker:publish -Ddocker.repo=registry-write.opensource.zalan.do/machina + echo "Published a new release version: $version" + echo "Tagging new version: $version" + git gh-tag $version + + - id: release-minor-version + type: script + when: + event: push + branch: master + triggered_by_dependency: null + requires_human_approval: true + vm_config: + type: linux + image: cdp-runtime/jdk8-sbt + size: large + commands: + - desc: Build and push docker image + cmd: | + echo "Determining next version to publish:" + current_release=$(git describe --tags origin/master) + if [[ $(cut -d '-' -f1 <<< $current_release) =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + version="$(cut -d '-' -f1 <<< $current_release)" + echo "Previous release: $version" + minorVersion="$(cut -d '.' -f2 <<< $version)" + majorVersion="$(cut -d '.' -f1 <<< $version)" + version="$majorVersion.$(($minorVersion + 1)).0" + else + echo "Issue with current tag: $current_release" + return -1 + fi + sbt "set version in ThisBuild := \"$(cut -c2- <<< $version)\"" docker:publish -Ddocker.repo=registry-write.opensource.zalan.do/machina + echo "Published a new release version: $version" + echo "Tagging new version: $version" + git gh-tag $version + + - id: release-major-version + type: script + when: + event: push + branch: master + triggered_by_dependency: null + requires_human_approval: true + vm_config: + type: linux + image: cdp-runtime/jdk8-sbt + size: large + commands: + - desc: Build and push docker image + cmd: | + echo "Determining next version to publish:" + current_release=$(git describe --tags origin/master) + if [[ $(cut -d '-' -f1 <<< $current_release) =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + version="$(cut -d '-' -f1 <<< $current_release)" + echo "Previous release: $version" + buildVersion="$(cut -d '.' -f3 <<< $version)" + minorVersion="$(cut -d '.' -f2 <<< $version)" + majorVersion="$(cut -d '.' -f1 <<< ${version//v})" + version="v$((majorVersion + 1)).0.0" + else + echo "Issue with current tag: $current_release" + return -1 + fi + sbt "set version in ThisBuild := \"$(cut -c2- <<< $version)\"" docker:publish -Ddocker.repo=registry-write.opensource.zalan.do/machina + echo "Published a new release version: $version" + echo "Tagging new version: $version" + git gh-tag $version + + - id: release-updated-base-image + type: script + when: + event: push + branch: master + triggered_by_dependency: base-image + vm_config: + type: linux + image: cdp-runtime/jdk8-sbt + size: large commands: - desc: Build and push docker image cmd: | - sbt compile test docker:publish -Ddocker.repo=registry-write.opensource.zalan.do/machina + echo "Determining next version to publish:" + current_release=$(git describe --tags origin/master) + if [[ $(cut -d '-' -f1 <<< $current_release) =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + version="$(cut -d '-' -f1 <<< $current_release)" + echo "Previous release: $version" + version="$version-$(date +'%Y%m%d')" + else + echo "Issue with current tag: $current_release" + return -1 + fi + sbt "set version in ThisBuild := \"$(cut -c2- <<< $version)\"" docker:publish -Ddocker.repo=registry-write.opensource.zalan.do/machina + echo "Published an updated release version: $version" diff --git a/project/plugins.sbt b/project/plugins.sbt index ab05bf6..8e473de 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,4 @@ resolvers += Resolver.url("sbt-plugins", url("https://dl.bintray.com/zalando/sbt-plugins/"))(Resolver.ivyStylePatterns) addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.6")