Skip to content

Commit

Permalink
Fixes on-demand build in docker (#184)
Browse files Browse the repository at this point in the history
When there was no prior build, this would have not worked

```bash
build-bin/docker/docker_build openzipkin/zipkin-gcp:test
```
  • Loading branch information
adriancole authored Nov 26, 2020
1 parent d7178c9 commit ec6795d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
17 changes: 15 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
# Install script runs within Docker
!build-bin/maven/maven_build
!build-bin/maven/maven_build_or_unjar
!build-bin/maven/maven_opts
!build-bin/maven/maven_unjar

# Allow on-demand "mvn package"
!**/src/main/**
# Allow on-demand "mvn package". <modules> referenced in pom.xml must be added even if not built
!aws-junit/src/main/**
!collector/kinesis/src/main/**
!collector/sqs/src/main/**
!brave/instrumentation-aws-java-sdk-core/src/main/**
!brave/instrumentation-aws-java-sdk-v2-core/src/main/**
!brave/instrumentation-aws-java-sdk-sqs/src/main/**
!brave/propagation-aws/src/main/**
!module/src/main/**
!reporter/reporter-xray-udp/src/main/**
!reporter/sender-awssdk-sqs/src/main/**
!reporter/sender-kinesis/src/main/**
!reporter/sender-sqs/src/main/**
!storage/xray-udp/src/main/**
!**/pom.xml

# Allow re-use of built artifacts when using "mvn package"
Expand Down
2 changes: 1 addition & 1 deletion build-bin/maven/maven_build
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ set -ue
export MAVEN_OPTS="$($(dirname "$0")/maven_opts)"

(if [ "${MAVEN_PROJECT_BASEDIR:-.}" != "." ]; then cd ${MAVEN_PROJECT_BASEDIR}; fi && \
mvn -T1C -q --batch-mode -DskipTests package)
mvn -T1C -q --batch-mode -DskipTests package "$@")
5 changes: 3 additions & 2 deletions build-bin/maven/maven_build_or_unjar
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ args="${group_id} ${artifact_id} ${version} ${classifier}"
# Fail on unset variables, but don't quit on rc!=0, so we can log what happened
set -u +e

$(dirname "$0")/maven_unjar $args
unjar_out=$($(dirname "$0")/maven_unjar $args 2>&1)
unjar_rc=$?

if [ "${unjar_rc}" = "0" ] || [ -z "${pom:-}" ]; then
Expand All @@ -51,12 +51,13 @@ case ${version} in
*-SNAPSHOT )
;;
* )
>&2 echo ${unjar_out}
exit ${unjar_rc}
;;
esac

set -ue

echo "*** Building snapshot from source..."
$(dirname "$0")/maven_build
$(dirname "$0")/maven_build -pl :${artifact_id} --am
$(dirname "$0")/maven_unjar $args
2 changes: 1 addition & 1 deletion build-bin/maven/maven_release
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ if [ "$commit_local_release_branch" != "$commit_remote_release_branch" ]; then
fi

# Prepare and push release commits and the version tag (N.N.N), which triggers deployment.
./mvnw --batch-mode -nsu -DreleaseVersion=${release_version} -Darguments=-DskipTests release:prepare
./mvnw --batch-mode -nsu -DreleaseVersion=${release_version} -Denforcer.fail=false -Darguments="-DskipTests -Denforcer.fail=false" release:prepare
5 changes: 3 additions & 2 deletions build-bin/maven/maven_unjar
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set -eu
# the artifact you are looking for.
#
# Ex.
# !./module/target/zipkin-module-xray-*-module.jar
# !./module/target/zipkin-module-*-module.jar

group_id=${1?group_id is required}
artifact_id=${2?artifact_id is required}
Expand Down Expand Up @@ -60,7 +60,8 @@ elif [ -n "${MAVEN_PROJECT_BASEDIR:-}" ]; then
fi

if ! test -f ${artifact_id}.jar && [ ${is_release} = "true" ]; then
mvn_get="mvn -q --batch-mode org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get \
mvn_get="mvn -q --batch-mode -Denforcer.fail=false \
org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get \
-Dtransitive=false -DgroupId=${group_id} -DartifactId=${artifact_id} -Dversion=${version}"

if [ -n "${classifier}" ]; then
Expand Down

0 comments on commit ec6795d

Please sign in to comment.