Skip to content

Commit d66ffea

Browse files
committed
Merge branch 'release/r9'
2 parents e2d6178 + 2e1ad8b commit d66ffea

File tree

100 files changed

+3256
-13569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3256
-13569
lines changed

.travis.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ scala:
44
jdk:
55
- oraclejdk8
66
script:
7-
- cd 2-repositories/scala-repo-server
7+
- cd 2-repositories/iglu-server
88
- ./scripts/create-test-user.bash
99
- sbt test
1010
- cd ../..
@@ -29,6 +29,12 @@ deploy:
2929
on:
3030
condition: '"$(.travis/is_igluctl_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
3131
tags: true
32+
- provider: script
33+
skip_cleanup: true
34+
script: ./.travis/deploy_iglu_server.sh $TRAVIS_TAG
35+
on:
36+
condition: '"$(.travis/is_iglu_server_release_tag.sh $TRAVIS_TAG)" == "" && $? == 0'
37+
tags: true
3238
env:
3339
global:
3440
- secure: D5Egj4tqCXpL7H4x/BsPs9tOVX7Q20ooaB5e7+KDBk9PdLFFLHGMJP6+lRjmLNnX89ngWSNmPyu9L5qJ8D4Bmuy+s2bMN8iM/bryJrGvAMUjLXnVEaENn4hd7Xn6zA0JoTvyk8jEiLlTsZakpz8j8N6g9mscZXsMoXtRWFOnE0s=

.travis/deploy_iglu_server.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
tag=$1
4+
5+
project="iglu-server/"
6+
project_len=${#project}
7+
8+
cicd=${tag:0:${project_len}}
9+
release=${tag:${project_len}}
10+
11+
if [ "${cicd}" == "${project}" ]; then
12+
if [ "${release}" == "" ]; then
13+
echo "WARNING! No release specified! Ignoring."
14+
exit 2
15+
fi
16+
else
17+
echo "This can't be deployed - there's no ${project} tag! (Is the travis condition set?)"
18+
exit 1
19+
fi
20+
21+
cd "${TRAVIS_BUILD_DIR}"
22+
23+
export TRAVIS_BUILD_RELEASE_TAG="${release}"
24+
release-manager \
25+
--config "./.travis/release_iglu_server.yml" \
26+
--check-version \
27+
--make-version \
28+
--make-artifact \
29+
--upload-artifact

.travis/is_iglu_server_release_tag.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
tag=$1
4+
cicd=${tag:0:12}
5+
release=${tag:12}
6+
7+
if [ "${cicd}" == "iglu-server/" ]; then
8+
if [ "${release}" == "" ]; then
9+
echo "Warning! No release specified! Ignoring."
10+
exit 2
11+
fi
12+
exit 0
13+
else
14+
exit 1
15+
fi

.travis/release_iglu_server.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Required: local settings
2+
local:
3+
root_dir : <%= ENV['TRAVIS_BUILD_DIR'] %>
4+
5+
# Required: deployment targets
6+
targets:
7+
- type : "bintray"
8+
user : <%= ENV['BINTRAY_SNOWPLOW_GENERIC_USER'] %>
9+
password : <%= ENV['BINTRAY_SNOWPLOW_GENERIC_API_KEY'] %>
10+
11+
# Required: packages to be deployed
12+
packages:
13+
- repo : "snowplow-generic"
14+
name : "iglu-server"
15+
user_org : "snowplow"
16+
publish : true
17+
override : false
18+
continue_on_conflict : false
19+
version : <%= FUNC['sbt_version(2-repositories/iglu-server/)'] %>
20+
build_version : <%= ENV['TRAVIS_BUILD_RELEASE_TAG'] %>
21+
build_commands:
22+
- cd 2-repositories/iglu-server && sbt assembly && cd ../..
23+
24+
# Required: Artifact
25+
artifacts:
26+
- prefix : "iglu_server_"
27+
suffix : ""
28+
type : "zip"
29+
30+
# The binaries to put in the zip
31+
binary_paths:
32+
- 2-repositories/iglu-server/target/scala-2.11/iglu-server-{{ packages.0.build_version }}.jar

0-common/igluctl/project/BuildSettings.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object BuildSettings {
2828
lazy val basicSettings = Seq[Setting[_]](
2929
name := "igluctl",
3030
organization := "com.snowplowanalytics",
31-
version := "0.4.0",
31+
version := "0.4.1",
3232
description := "Iglu Command Line Interface",
3333
scalaVersion := "2.12.4",
3434
scalacOptions := Seq(

0-common/igluctl/project/Dependencies.scala

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ object Dependencies {
1818
// Java
1919
val jsonValidator = "2.2.6"
2020
val awsJava = "1.11.250"
21+
// JAXB APIs aren't resolved by default as of Java 9
22+
// https://docs.oracle.com/javase/9/migrate/#GUID-F640FA9D-FB66-4D85-AD2B-D931174C09A3
23+
val javaxXmlBind = "2.3.0"
24+
val jaxbCore = "2.3.0"
25+
val jaxbImpl = "2.3.0"
26+
val activation = "1.1.1"
2127
// Scala
2228
val schemaddl = "0.7.0"
2329
val scopt = "3.5.0"
@@ -33,6 +39,11 @@ object Dependencies {
3339
// Java
3440
val jsonValidator = "com.github.fge" % "json-schema-validator" % V.jsonValidator
3541
val awsJava = "com.amazonaws" % "aws-java-sdk-s3" % V.awsJava
42+
// JAXB APIs
43+
val javaxXmlBind = "javax.xml.bind" % "jaxb-api" % V.javaxXmlBind
44+
val jaxbCore = "com.sun.xml.bind" % "jaxb-core" % V.jaxbCore
45+
val jaxbImpl = "com.sun.xml.bind" % "jaxb-impl" % V.jaxbImpl
46+
val activation = "javax.activation" % "activation" % V.activation
3647
// Scala
3748
val schemaddl = "com.snowplowanalytics" %% "schema-ddl" % V.schemaddl
3849
val scopt = "com.github.scopt" %% "scopt" % V.scopt

0-common/igluctl/project/IgluctlBuild.scala

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ object IgluctlBuild extends Build {
3434
// Java
3535
Libraries.jsonValidator,
3636
Libraries.awsJava,
37+
// JAXB APIs
38+
Libraries.javaxXmlBind,
39+
Libraries.jaxbCore,
40+
Libraries.jaxbImpl,
41+
Libraries.activation,
3742
// Scala
3843
Libraries.schemaddl,
3944
Libraries.scopt,

0-common/igluctl/src/main/scala/com.snowplowanalytics.iglu/ctl/GenerateCommand.scala

+6-8
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ case class GenerateCommand(
171171
if (input.isFile) {
172172
val schemaVerWarning = schemas.head.self.version match {
173173
case SchemaVer.Full(1, 0, 0) => List.empty[String]
174-
case _ => List(s"Warning: File [${input.getAbsolutePath}] contains a schema whose version is NOT 1-0-0")
174+
case _ => List(s"Warning: File [${input.getAbsolutePath}] contains a schema " +
175+
s"whose version is NOT 1-0-0. Migrations can be inconsistent.")
175176
}
176177
Warnings(schemaVerWarning)
177178
} else {
@@ -185,14 +186,14 @@ case class GenerateCommand(
185186
(name, schemaMaps) <- schemaMapsGroupByName.toList
186187
if !schemaMaps.exists(sm => sm.version == SchemaVer.Full(1, 0, 0)) && !force
187188
} yield s"Error: Directory [${input.getAbsolutePath}] contains schemas of [$vendor/$name] without version 1-0-0." +
188-
" Use --force to switch off schema version check."
189+
" Migrations can be inconsistent." + " Use --force to switch off schema version check."
189190
val schemaVerGapErrors: List[String] =
190191
for {
191192
(name, schemaMaps) <- schemaMapsGroupByName.toList
192193
sortedSchemaMaps = schemaMaps.sortWith(_.version.asString < _.version.asString)
193194
if sortedSchemaMaps.head.version == SchemaVer.Full(1, 0, 0) && existMissingSchemaVersion(sortedSchemaMaps) && !force
194195
} yield s"Error: Directory [${input.getAbsolutePath}] contains schemas of [$vendor/$name] which has gaps between schema versions." +
195-
" Use --force to switch off schema version check."
196+
" Migrations can be inconsistent." + " Use --force to switch off schema version check."
196197

197198
firstVersionNotFoundErrors ::: schemaVerGapErrors
198199
}
@@ -356,6 +357,8 @@ case class GenerateCommand(
356357
println(missingSchemaVerErrors.mkString("\n"))
357358
sys.exit(1)
358359
} else {
360+
result.warnings.foreach(printMessage)
361+
359362
result.ddls
360363
.map(_.setBasePath("sql"))
361364
.map(_.setBasePath(output.getAbsolutePath))
@@ -370,12 +373,7 @@ case class GenerateCommand(
370373
.map(_.setBasePath("sql"))
371374
.map(_.setBasePath(output.getAbsolutePath))
372375
.map(_.write(force)).foreach(printMessage)
373-
374-
result.warnings.foreach(printMessage)
375-
376-
if (result.warnings.exists(_.contains("Error"))) sys.exit(1)
377376
}
378-
379377
}
380378
}
381379

0-common/igluctl/src/main/scala/com.snowplowanalytics.iglu/ctl/LintCommand.scala

+15-9
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,24 @@ case class LintCommand(inputDir: File, skipWarnings: Boolean, linters: List[Lint
6060
val stubCommand = GenerateCommand(stubFile, stubFile)
6161
val (_, schemas) = splitValidations(validatedJsons.map(_.extractSelfDescribingSchema))
6262
val schemaVerValidation: Result = stubCommand.validateSchemaVersions(schemas)
63-
// strip GenerateCommand related parts off & prepare LintCommand failure messages
64-
val lintSchemaVerMessages: List[String] = schemaVerValidation match {
65-
case Warnings(lst) => lst.map(w => "FAILURE" + w.stripPrefix("Warning"))
66-
case Errors(lst) => lst.map(e => "FAILURE" + e.stripPrefix("Error").stripSuffix(" Use --force to switch off schema version check."))
67-
case VersionSuccess(_) => List.empty[String]
68-
}
69-
lintSchemaVerMessages.foreach(println)
7063

7164
val reports = jsons.map { file =>
7265
val report = file.map(check)
7366
flattenReport(report)
7467
}
75-
reports.foldLeft(Total(0, 0, lintSchemaVerMessages.size))((acc, cur) => acc.add(cur)).exit()
68+
69+
// strip GenerateCommand related parts off & prepare LintCommand messages & create a Total per schema version check
70+
schemaVerValidation match {
71+
case Warnings(lst) =>
72+
lst.map(w => "WARNING" + w.stripPrefix("Warning")).foreach(println)
73+
reports.foldLeft(Total(0, 0, 0, lst.size))((acc, cur) => acc.add(cur)).exit()
74+
case Errors(lst) =>
75+
lst.map(e => "FAILURE" +
76+
e.stripPrefix("Error").stripSuffix(" Use --force to switch off schema version check.")).foreach(println)
77+
reports.foldLeft(Total(0, 0, lst.size, 0))((acc, cur) => acc.add(cur)).exit()
78+
case VersionSuccess(_) =>
79+
reports.foldLeft(Total(0, 0, 0, 0))((acc, cur) => acc.add(cur)).exit()
80+
}
7681
}
7782

7883
/**
@@ -111,14 +116,15 @@ object LintCommand {
111116
* @param successes number of successfully validated schemas
112117
* @param failedSchemas number of schemas with errors
113118
*/
114-
case class Total(successes: Int, failedSchemas: Int, totalFailures: Int) {
119+
case class Total(successes: Int, failedSchemas: Int, totalFailures: Int, totalWarnings: Int) {
115120
/**
116121
* Exit from app with error status if invalid schemas were found
117122
*/
118123
def exit(): Unit = {
119124
println(s"TOTAL: $successes Schemas were successfully validated")
120125
println(s"TOTAL: $failedSchemas invalid Schemas were encountered")
121126
println(s"TOTAL: $totalFailures errors were encountered")
127+
println(s"TOTAL: $totalWarnings warnings were encountered")
122128

123129
if (failedSchemas + totalFailures > 0) sys.exit(1)
124130
else sys.exit(0)

0-common/igluctl/src/test/scala/com/snowplowanalytics/iglu/ctl/GenerateCommandSpec.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ class GenerateCommandSpec extends Specification { def is = s2"""
681681

682682
schemaVerMessages must beEqualTo(List(
683683
s"Error: Directory [${stubFile.getAbsolutePath}] contains schemas of [com.example-agency/cast] which has gaps between schema versions." +
684-
" Use --force to switch off schema version check."
684+
" Migrations can be inconsistent." + " Use --force to switch off schema version check."
685685
))
686686
}
687687

@@ -752,7 +752,7 @@ class GenerateCommandSpec extends Specification { def is = s2"""
752752

753753
schemaVerMessages must beEqualTo(List(
754754
s"Error: Directory [${stubFile.getAbsolutePath}] contains schemas of [com.example-agency/cast] without version 1-0-0." +
755-
s" Use --force to switch off schema version check."
755+
" Migrations can be inconsistent." + " Use --force to switch off schema version check."
756756
))
757757
}
758758

2-repositories/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We currently have two Iglu "repo" technologies available for deploying your Iglu
1010
|:-------------------------|:-------------|:-----------------------------------------------------------|:-----------------|
1111
| [JVM-embedded repo][r1] | Embedded | An Iglu repository embedded in a Java or Scala application | Production-ready |
1212
| [Static repo][r2] | Remote | An Iglu repository server structured as a static website | Production-ready |
13-
| [Scala repo server][r3] | Remote | A RESTful Iglu repository server written in Scala | Beta |
13+
| [Iglu Server][r3] | Remote | A RESTful Iglu repository server written in Scala | Production-ready |
1414

1515
<a name="iglu-central" />
1616

@@ -30,7 +30,7 @@ We do not git-submodule Iglu Central into the main Iglu repository because it is
3030

3131
[r1]: ./jvm-embedded-repo
3232
[r2]: ./static-repo
33-
[r3]: ./scala-repo-server
33+
[r3]: ./iglu-server
3434

3535
[iglucentral-website]: http://iglucentral.com/
3636
[iglucentral-repo]: https://github.com/snowplow/iglu-central

2-repositories/scala-repo-server/README.md renamed to 2-repositories/iglu-server/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Scala repo server
1+
# Iglu Server
22

3-
A Scala-based repository server for Iglu, allowing users to publish, test and serve schemas via an easy-to-use RESTful interface.
3+
Iglu Server is a RESTful schema registry, allowing users to publish, test and serve schemas via an easy-to-use RESTful interface.
44

55
## Find out more
66

@@ -10,7 +10,7 @@ A Scala-based repository server for Iglu, allowing users to publish, test and se
1010

1111
## Copyright and license
1212

13-
Scala Repo Server is copyright 2014-2017 Snowplow Analytics Ltd.
13+
Iglu Server is copyright 2014-2018 Snowplow Analytics Ltd.
1414

1515
Licensed under the **[Apache License, Version 2.0][license]** (the "License");
1616
you may not use this software except in compliance with the License.

2-repositories/iglu-server/build.sbt

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved.
3+
*
4+
* This program is licensed to you under the Apache License Version 2.0, and
5+
* you may not use this file except in compliance with the Apache License
6+
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
7+
* http://www.apache.org/licenses/LICENSE-2.0.
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the Apache License Version 2.0 is distributed on an "AS
11+
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
* implied. See the Apache License Version 2.0 for the specific language
13+
* governing permissions and limitations there under.
14+
*/
15+
16+
import Dependencies._
17+
import BuildSettings._
18+
19+
//Configure prompt to show current project
20+
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
21+
22+
// Define our project with basic information and library dependencies
23+
lazy val project = Project("iglu-server", file("."))
24+
.settings(buildSettings: _*)
25+
.settings(
26+
libraryDependencies ++= Seq(
27+
// Scala
28+
Libraries.scopt,
29+
Libraries.akkaActor,
30+
Libraries.akkaSlf4j,
31+
Libraries.joda,
32+
Libraries.jodaTime,
33+
Libraries.json4s,
34+
Libraries.json4sScalaz,
35+
Libraries.jsonValidator,
36+
Libraries.slf4j,
37+
Libraries.slick,
38+
Libraries.slickpg,
39+
Libraries.slickpgJoda,
40+
Libraries.akkaHttp,
41+
Libraries.swaggerAkkaHttp,
42+
// Scala (test only)
43+
Libraries.akkaTestKit,
44+
Libraries.specs2,
45+
Libraries.akkaHttpTestKit
46+
)
47+
)

0 commit comments

Comments
 (0)