This is an automated email from the ASF dual-hosted git repository. abesto pushed a commit to branch jenkinsfile-tweaks in repository https://gitbox.apache.org/repos/asf/incubator-zipkin-brave-karaf.git
commit b79823a3e7c72eb9bfb27a7e5d2a3c3fae879dc1 Author: Christian Schneider <[email protected]> AuthorDate: Thu Jul 6 11:58:53 2017 +0200 build-support --- build-support/go-offline.sh | 34 ++++++++++++ build-support/pom-no-crossmodule-dependencies.xsl | 26 +++++++++ build-support/publish-snapshot.sh | 23 ++++++++ build-support/publish-stable.sh | 21 ++++++++ build-support/trigger-publish.sh | 38 +++++++++++++ circle.yml | 65 +++++++++++++++++++++++ 6 files changed, 207 insertions(+) diff --git a/build-support/go-offline.sh b/build-support/go-offline.sh new file mode 100755 index 0000000..908a863 --- /dev/null +++ b/build-support/go-offline.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright 2016 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +# Due to https://issues.apache.org/jira/browse/MDEP-323 and cross-module dependencies, +# we can't easily run mvn dependency:go-offline. This is a workaround for that. +# It removes all dependencies on io.zipkin.java and ${project.groupId} using XSLT, +# then runs go-offline on the resulting POMs. + +set -xeuo pipefail + +rm -rf go-offline-builddir +mkdir -p go-offline-builddir +trap "rm -rf $(pwd)/go-offline-builddir" EXIT + +for f in $(find . -name 'pom.xml'); do + echo $f + mkdir -p $(dirname go-offline-builddir/$f) + xsltproc ./build-support/pom-no-crossmodule-dependencies.xsl $f > go-offline-builddir/$f +done + +cd go-offline-builddir +../mvnw dependency:go-offline diff --git a/build-support/pom-no-crossmodule-dependencies.xsl b/build-support/pom-no-crossmodule-dependencies.xsl new file mode 100644 index 0000000..1eab405 --- /dev/null +++ b/build-support/pom-no-crossmodule-dependencies.xsl @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2016 The OpenZipkin Authors + + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + in compliance with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software distributed under the License + is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the License for the specific language governing permissions and limitations under + the License. + +--> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pom="http://maven.apache.org/POM/4.0.0"> + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="pom:dependency[pom:groupId = 'io.zipkin.brave.karaf']" /> + <xsl:template match="pom:dependency[pom:groupId = '${project.groupId}']" /> +</xsl:stylesheet> diff --git a/build-support/publish-snapshot.sh b/build-support/publish-snapshot.sh new file mode 100755 index 0000000..169b870 --- /dev/null +++ b/build-support/publish-snapshot.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Copyright 2016-2017 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +set -euo pipefail +set -x + +if ./mvnw help:evaluate -N -Dexpression=project.version | grep -v '\[' | grep -q SNAPSHOT; then + ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests -pl deploy +else + echo "Not building release versions, those are built by the tag builder using the publish-stable.sh script" +fi diff --git a/build-support/publish-stable.sh b/build-support/publish-stable.sh new file mode 100755 index 0000000..e5724e3 --- /dev/null +++ b/build-support/publish-stable.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Copyright 2016 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +set -euo pipefail +set -x + +./mvnw -DskipTests install -nsu +./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests -pl deploy +./mvnw --batch-mode -s ./.settings.xml -nsu -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync diff --git a/build-support/trigger-publish.sh b/build-support/trigger-publish.sh new file mode 100755 index 0000000..04bcd80 --- /dev/null +++ b/build-support/trigger-publish.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# Copyright 2016 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +set -euo pipefail +set -x + +release_version() { + echo "${CIRCLE_TAG}" | sed 's/^release-//' +} + +safe_checkout_master() { + # We need to be on a branch for release:perform to be able to create commits, and we want that branch to be master. + # But we also want to make sure that we build and release exactly the tagged version, so we verify that the remote + # master is where our tag is. + git checkout -B master + git fetch origin master:origin/master + commit_local_master="$(git show --pretty='format:%H' master)" + commit_remote_master="$(git show --pretty='format:%H' origin/master)" + if [ "$commit_local_master" != "$commit_remote_master" ]; then + echo "Master on remote 'origin' has commits since the version under release, aborting" + exit 1 + fi +} + +safe_checkout_master +./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests" release:prepare diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..aa6c311 --- /dev/null +++ b/circle.yml @@ -0,0 +1,65 @@ +# +# Copyright 2016-2017 The OpenZipkin Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# + +machine: + java: + version: openjdk8 + services: + - mysql + environment: + MYSQL_USER: root + +dependencies: + override: + - sudo apt-get install xsltproc + - ./build-support/go-offline.sh + +test: + override: + - ./mvnw verify + post: + # parameters used during release + # allocate commits to CI, not the owner of the deploy key + - git config user.name "zipkinci" + - git config user.email "[email protected]" + # setup https authentication credentials, used by ./mvnw release:prepare + - git config credential.helper "store --file=.git/credentials" + - echo "https://$GH_TOKEN:@github.com" > .git/credentials + # copy test reports to CircleCI test reports directory + - mkdir -p $CIRCLE_TEST_REPORTS/junit/ + - find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; + +# Send notifications to Gitter +notify: + webhooks: + - url: https://webhooks.gitter.im/e/22adbb9973299092e6ae + +deployment: + trigger: + owner: openzipkin + tag: /release-\d+\.\d+\.\d+/ + commands: + - ./build-support/trigger-publish.sh + publish-stable: + owner: openzipkin + tag: /\d+\.\d+\.\d+/ + # triples the timeout to 30 minutes as maven central sync takes a lot longer than 10m + commands: + - ./build-support/publish-stable.sh: + timeout: 1800 + publish-snapshot: + owner: openzipkin + branch: master + commands: + - ./build-support/publish-snapshot.sh
