diff --git a/docker/pom.xml b/docker/pom.xml
index 51d67fc5c0..1cae6ee324 100644
--- a/docker/pom.xml
+++ b/docker/pom.xml
@@ -20,10 +20,24 @@
springcloud
-
- spring-cloud-contract-docker
- spring-cloud-contract-stub-runner-docker
-
+
+
+ skip
+
+ true
+
+
+
+ integration
+
+ false
+
+
+ spring-cloud-contract-docker
+ spring-cloud-contract-stub-runner-docker
+
+
+
diff --git a/docker/spring-cloud-contract-docker/project/build.gradle b/docker/spring-cloud-contract-docker/project/build.gradle
index e7ed26352c..e8b5aa99e2 100644
--- a/docker/spring-cloud-contract-docker/project/build.gradle
+++ b/docker/spring-cloud-contract-docker/project/build.gradle
@@ -21,11 +21,11 @@ version = getProp("PROJECT_VERSION") ?: '0.0.1-SNAPSHOT'
repositories {
mavenLocal()
mavenCentral()
- if (!"${verifierVersion}".contains("RELEASE")) {
- maven { url "http://repo.spring.io/snapshot" }
- maven { url "http://repo.spring.io/milestone" }
- maven { url "http://repo.spring.io/release" }
- }
+ if (!"${verifierVersion}".contains("RELEASE")) {
+ maven { url "http://repo.spring.io/snapshot" }
+ maven { url "http://repo.spring.io/milestone" }
+ maven { url "http://repo.spring.io/release" }
+ }
}
apply plugin: 'groovy'
@@ -57,11 +57,29 @@ test {
}
}
-// tests - contracts
contracts {
baseClassForTests = "contracts.RestBase"
testMode = "EXPLICIT"
- contractsDslDir = new File("/contracts")
+ if (getProp("EXTERNAL_CONTRACTS_ARTIFACT_ID")) {
+ logger.lifecycle("Will use an artifact with contracts [${getProp("EXTERNAL_CONTRACTS_GROUP_ID")}:${getProp("EXTERNAL_CONTRACTS_ARTIFACT_ID")}]")
+ // tests - contracts from an artifact
+ contractsPath = getProp("EXTERNAL_CONTRACTS_PATH") ?: ""
+ if (Boolean.parseBoolean(getProp("EXTERNAL_CONTRACTS_WORK_OFFLINE")) == false) {
+ contractsRepositoryUrl = getProp('EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL') ?:
+ getProp('REPO_WITH_BINARIES_URL') ?: 'http://localhost:8081/artifactory/libs-release-local'
+ }
+ contractDependency {
+ groupId = getProp("EXTERNAL_CONTRACTS_GROUP_ID") ?: "com.example"
+ artifactId = getProp("EXTERNAL_CONTRACTS_ARTIFACT_ID")
+ delegate.classifier = getProp("EXTERNAL_CONTRACTS_CLASSIFIER") ?: ""
+ delegate.version = getProp("EXTERNAL_CONTRACTS_VERSION") ?: "+"
+ }
+ contractsWorkOffline = Boolean.parseBoolean(getProp("EXTERNAL_CONTRACTS_WORK_OFFLINE")) ?: false
+ } else {
+ logger.lifecycle("Will use contracts from the mounted [/contracts] folder")
+ // tests - contracts in this repo
+ contractsDslDir = new File("/contracts")
+ }
}
task wrapper(type: Wrapper) {
diff --git a/docs/src/main/asciidoc/verifier_setup.adoc b/docs/src/main/asciidoc/verifier_setup.adoc
index da06dc72d6..65fff105d4 100644
--- a/docs/src/main/asciidoc/verifier_setup.adoc
+++ b/docs/src/main/asciidoc/verifier_setup.adoc
@@ -931,7 +931,7 @@ It's enough for you to mount your contracts, pass the environment variables
The Docker image requires some environment variables to point to
your running application, to the Artifact manager instance etc.
-- `PROJECT_GROUP` - your project's group id. Defaults to `com.example`.
+- `PROJECT_GROUP` - your project's group id. Defaults to `com.example`
- `PROJECT_VERSION` - your project's version. Defaults to `0.0.1-SNAPSHOT`
- `PROJECT_NAME` - artifact id. Defaults to `example`
- `REPO_WITH_BINARIES_URL` - URL of your Artifact Manager. Defaults to `http://localhost:8081/artifactory/libs-release-local`
@@ -940,6 +940,24 @@ which is the default URL of https://jfrog.com/artifactory/[Artifactory] running
- `REPO_WITH_BINARIES_PASSWORD` - (optional) password when the Artifact Manager is secured
- `PUBLISH_ARTIFACTS` - if set to `true` then will publish artifact to binary storage. Defaults to `true`.
+These environment variables are used when contracts lay in an external repository. To enable
+this feature you must set the `EXTERNAL_CONTRACTS_ARTIFACT_ID` environment variable.
+
+- `EXTERNAL_CONTRACTS_GROUP_ID` - group id of the project with contracts. Defaults to `com.example`
+- `EXTERNAL_CONTRACTS_ARTIFACT_ID`- artifact id of the project with contracts.
+- `EXTERNAL_CONTRACTS_CLASSIFIER`- classifier of the project with contracts. Empty by default
+- `EXTERNAL_CONTRACTS_VERSION` - version of the project with contracts. Defaults to `+`, equivalent to picking the latest
+- `EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL` - URL of your Artifact Manager. Defaults to value of `REPO_WITH_BINARIES_URL` env var.
+If that's not set, defaults to `http://localhost:8081/artifactory/libs-release-local`
+which is the default URL of https://jfrog.com/artifactory/[Artifactory] running locally
+- `EXTERNAL_CONTRACTS_PATH` - path to contracts for the given project, inside the project with contracts.
+Defaults to slash separated `EXTERNAL_CONTRACTS_GROUP_ID` concatenated with `/` and `EXTERNAL_CONTRACTS_ARTIFACT_ID`. E.g.
+for group id `foo.bar` and artifact id `baz`, would result in `foo/bar/baz` contracts path.
+- `EXTERNAL_CONTRACTS_WORK_OFFLINE` - if set to `true` then will retrieve artifact with contracts
+from the container's `.m2`. Mount your local `.m2` as a volume available at the container's `/root/.m2` path.
+You must not set both `EXTERNAL_CONTRACTS_WORK_OFFLINE` and `EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL`.
+
+
These environment variables are used when tests are executed:
- `APPLICATION_BASE_URL` - url against which tests should be executed.