Skip to content

Commit

Permalink
updates to latest build (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole authored Dec 26, 2020
1 parent f2aec72 commit ad33655
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 54 deletions.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Bug
about: If you’ve found a bug, spend the time to write a failing test. Bugs with tests get fixed and stay fixed. If you have a solution in mind, skip raising an issue and open a pull request instead.
labels: bug
---
## Describe the Bug
A clear and concise description of what the bug is. If you have a solution in mind, skip raising an issue and open a pull request instead.

Regardless, the best is to spend some time to write a failing test. Bugs with tests get fixed and stay fixed.

## Steps to Reproduce
Steps to reproduce the behavior:

## Expected Behaviour
Suggest what you think correct behaviour should be. Note, it may be solved differently depending on the problem.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://gitter.im/openzipkin/zipkin
about: Please ask questions about how to do something or to understand why something isn't working on our Gitter chat - we'll be happy to respond there in detail. This issue tracker is not for questions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature Request
about: Please first, look at existing issues to see if the feature has been requested before.
labels: enhancement
---
Please first, look at [existing issues](https://github.com/openzipkin-contrib/brave-opentracing/issues) to see if the feature has been requested before. If you don't find anything tell us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.

## Feature
Description of the feature

## Rationale
Why would this feature help others besides me?

## Example Scenario
What kind of use cases would benefit from this feature?

## Prior Art
* Links to prior art
* More links
4 changes: 2 additions & 2 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v2
with:
# Prevent use of implicit GitHub Actions read-only token GITHUB_TOKEN. We don't deploy on
# the tag N.M.L event, but we still need to deploy the maven-release-plugin master commit.
# the tag MAJOR.MINOR.PATCH event, but we still need to deploy the maven-release-plugin master commit.
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 1 # only need the base commit as license check isn't run
- name: Cache local Maven repository
Expand All @@ -35,6 +35,6 @@ jobs:
# - needs repo:status, public_repo
# - referenced in .settings.xml
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: | # GITHUB_REF will be refs/tags/release-N.M.L
run: | # GITHUB_REF will be refs/tags/release-MAJOR.MINOR.PATCH
build-bin/git/login_git &&
build-bin/maven/maven_release $(echo ${GITHUB_REF} | cut -d/ -f 3)
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: deploy
# See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
on:
push:
# Don't deploy tags as they conflict with [maven-release-plugin] prepare release N.M.L
# Don't deploy tags as they conflict with [maven-release-plugin] prepare release MAJOR.MINOR.PATCH
tags: ''
branches: master

Expand Down Expand Up @@ -41,6 +41,6 @@ jobs:
# SONATYPE_PASSWORD=<password to sonatype account token>
# - referenced in .settings.xml
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: | # GITHUB_REF will be refs/heads/master or refs/tags/N.M.L
run: | # GITHUB_REF will be refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
build-bin/configure_deploy &&
build-bin/deploy $(echo ${GITHUB_REF} | cut -d/ -f 3)
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
jobs:
test:
runs-on: ubuntu-20.04 # newest available distribution, aka focal
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand Down
13 changes: 6 additions & 7 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ This repo uses semantic versions. Please keep this in mind when choosing version

1. **Push a git tag**

The tag should be of the format `release-N.M.L`, ex `git tag release-1.18.1; git push origin release-1.18.1`.
The trigger format is `release-MAJOR.MINOR.PATCH`, ex `git tag release-1.18.1 && git push origin release-1.18.1`.

1. **Wait for CI**

The `release-N.M.L` tag triggers [`build-bin/maven/maven_release`](build-bin/maven/maven_release),
which creates commits, `N.M.L` tag, and increments the version (maven-release-plugin).
The `release-MAJOR.MINOR.PATCH` tag triggers [`build-bin/maven/maven_release`](build-bin/maven/maven_release),
which creates commits, `MAJOR.MINOR.PATCH` tag, and increments the version (maven-release-plugin).

The `N.M.L` tag triggers [`build-bin/deploy`](build-bin/deploy), which does the following:
The `MAJOR.MINOR.PATCH` tag triggers [`build-bin/deploy`](build-bin/deploy), which does the following:
* Publishes jars to https://oss.sonatype.org/content/repositories/releases [`build-bin/maven/maven_deploy`](build-bin/maven/maven_deploy)
* Later, the same jars synchronize to Maven Central
* Pushes images to Docker registries [`build-bin/docker_push`](build-bin/docker_push)

Notes:
* https://search.maven.org/ index will take longer than direct links like https://repo1.maven.org/maven2/io/zipkin

## Credentials

The release process uses various credentials. If you notice something failing due to unauthorized,
look at the notes in [.github/workflows/deploy.yml] and check the [org secrets](https://github.com/organizations/openzipkin-contrib/settings/secrets/actions)
look at the notes in [.github/workflows/deploy.yml] and check the [org secrets](https://github.com/organizations/openzipkin-contrib/settings/secrets/actions).

### Troubleshooting invalid credentials

Expand Down Expand Up @@ -78,7 +77,7 @@ export SONATYPE_USER=your_sonatype_account
export SONATYPE_PASSWORD=your_sonatype_password
release_version=xx-version-to-release-xx

# now from latest master, create the release. This creates and pushes the N.M.L tag
# now from latest master, create the release. This creates and pushes the MAJOR.MINOR.PATCH tag
./build-bin/maven/maven_release release-${release_version}

# once this works, deploy the release
Expand Down
21 changes: 18 additions & 3 deletions build-bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ complete in less than a minute (10 credit cost).
Here's a partial `.travis.yml` including only the aspects mentioned above.
```yaml
git:
depth: false # full git history for license check, and doc-only skipping
depth: false # TRAVIS_COMMIT_RANGE requires full commit history.
jobs:
include:
- stage: test
if: branch = master AND tag IS blank AND type IN (push, pull_request)
name: Run unit and integration tests
before_install: |
before_install: | # Prevent test build of a documentation-only change.
if [ -n "${TRAVIS_COMMIT_RANGE}" ] && ! git diff --name-only "${TRAVIS_COMMIT_RANGE}" -- | grep -qv '\.md$'; then
echo "Stopping job as changes only affect documentation (ex. README.md)"
travis_terminate 0
Expand All @@ -99,6 +99,21 @@ jobs:
script: ./build-bin/test
```

When Travis only runs tests (something else does deploy), there's no need to use stages:
```yaml
git:
depth: false # TRAVIS_COMMIT_RANGE requires full commit history.
if: branch = master AND tag IS blank AND type IN (push, pull_request)
before_install: | # Prevent test build of a documentation-only change.
if [ -n "${TRAVIS_COMMIT_RANGE}" ] && ! git diff --name-only "${TRAVIS_COMMIT_RANGE}" -- | grep -qv '\.md$'; then
echo "Stopping job as changes only affect documentation (ex. README.md)"
travis_terminate 0
fi
install: ./build-bin/configure_test
script: ./build-bin/test
```

## Deploy

Deploy builds and pushes artifacts to a remote repository for master and release commits on it. CI
Expand Down Expand Up @@ -141,7 +156,7 @@ jobs:
env:
GH_USER: ${{ secrets.GH_USER }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: | # GITHUB_REF will be refs/heads/master or refs/tags/N.M.L
run: | # GITHUB_REF will be refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
build-bin/configure_deploy &&
build-bin/deploy $(echo ${GITHUB_REF} | cut -d/ -f 3)
```
Expand Down
5 changes: 1 addition & 4 deletions build-bin/configure_deploy
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/sh

set -ue
#!/bin/sh -ue

# This script sets up anything needed for `./deploy`. Do not assume `configure_test` was called.
#
# See [README.md] for an explanation of this and how CI should use it.

build-bin/maven/maven_go_offline
build-bin/gpg/configure_gpg
5 changes: 1 addition & 4 deletions build-bin/configure_test
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/sh

set -ue
#!/bin/sh -ue

# This script sets up anything needed for `./test`. This should not login to anything, as that
# should be done in `configure_deploy`.
#
# See [README.md] for an explanation of this and how CI should use it.

build-bin/maven/maven_go_offline
5 changes: 1 addition & 4 deletions build-bin/deploy
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/sh

set -ue
#!/bin/sh -ue

# This script deploys a master or release version.
#
# See [README.md] for an explanation of this and how CI should use it.

build-bin/maven/maven_deploy
4 changes: 2 additions & 2 deletions build-bin/git/version_from_trigger_tag
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

set -ue

# This script echos a `N.M.L` version tag based on..
# This script echos a `MAJOR.MINOR.PATCH` version tag based on..
# * arg1: XXXXX- prefix
# * arg2: XXXXX-N.M.L git trigger tag
# * arg2: XXXXX-MAJOR.MINOR.PATCH git trigger tag
#
# The script exits 1 if the prefix doesn't match. On success, the tag is deleted if it exists.
#
Expand Down
4 changes: 1 addition & 3 deletions build-bin/gpg/configure_gpg
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

set -ue

# This script prepares for Sonatype deployment via `maven_deploy`
#
# This should be used instead of `configure_testcontainers` when a deployment will occur.
# This script prepares GPG, needed to sign jars for Sonatype deployment during `maven_deploy`

# ensure GPG commands work non-interactively
export GPG_TTY=$(tty)
Expand Down
2 changes: 2 additions & 0 deletions build-bin/maven/maven_deploy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

set -ue

export MAVEN_OPTS="$($(dirname "$0")/maven_opts)"

# This script deploys a SNAPSHOT or release version to Sonatype.
#
# Note: In CI, `configure_maven_deploy` must be called before invoking this.
Expand Down
11 changes: 9 additions & 2 deletions build-bin/maven/maven_go_offline
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
# the License.
#

# This is a go-offline that properly works with multi-module builds

set -ue

# Use a go-offline that properly works with multi-module builds
./mvnw -q --batch-mode -nsu -Prelease de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
export MAVEN_OPTS="$($(dirname "$0")/maven_opts)"
if [ -x ./mvnw ]; then alias mvn=${PWD}/mvnw; fi

(
if [ "${MAVEN_PROJECT_BASEDIR:-.}" != "." ]; then cd ${MAVEN_PROJECT_BASEDIR}; fi
mvn -q --batch-mode -nsu -Prelease de.qaware.maven:go-offline-maven-plugin:resolve-dependencies "$@"
)
41 changes: 41 additions & 0 deletions build-bin/maven/maven_opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
#
# Copyright 2016-2020 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.
#

# This script checks each variable value, so it isn't important to fail on unbound (set -u)
set -e

maven_project_basedir=${MAVEN_PROJECT_BASEDIR:-.}
pom="${maven_project_basedir}/pom.xml"

# fail if there's no pom
test -f "${pom}"

arch=$(uname -m)
case ${arch} in
arm64* )
arch=arm64
;;
aarch64* )
arch=arm64
;;
esac

maven_opts="${MAVEN_OPTS:-}"
if [ ${arch} = "arm64" ] && [ -f /etc/alpine-release ]; then
# Defensively avoid arm64+alpine problems with posix_spawn
maven_opts="${maven_opts} -Djdk.lang.Process.launchMechanism=vfork"
fi

echo ${maven_opts}
6 changes: 4 additions & 2 deletions build-bin/maven/maven_release
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@

set -ue

# This script creates a git `N.M.L` version tag which later will have `deploy` run against it.
# This script creates a git `MAJOR.MINOR.PATCH` version tag which later will have `deploy` run against it.
#
# In CI..
# * trigger pattern: tag =~ /^release-[0-9]+\.[0-9]+\.[0-9]+/
# * build-bin/git/login_git must be called before invoking this.

export MAVEN_OPTS="$($(dirname "$0")/maven_opts)"

trigger_tag=${1?trigger_tag is required. Ex release-1.2.3}
release_version=$(build-bin/git/version_from_trigger_tag release- ${trigger_tag})
release_branch=${2:-master}
Expand All @@ -38,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
4 changes: 1 addition & 3 deletions build-bin/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh

set -ue
#!/bin/sh -ue

# This script runs the tests of the project.
#
Expand Down
Loading

0 comments on commit ad33655

Please sign in to comment.