-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add new process for patch releases --------- Signed-off-by: Raphael Silva <rapphil@gmail.com> Co-authored-by: bryan-aguilar <46550959+bryan-aguilar@users.noreply.github.com> Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
- Loading branch information
1 parent
d013b0f
commit f8562f2
Showing
6 changed files
with
269 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: "Patch dependencies" | ||
description: | | ||
Patches direct dependencies of this project leveraging maven local to publish the results. | ||
This workflow supports patching opentelemetry-java and opentelemetry-java-instrumentation repositories by executing | ||
the `patch.sh` script that will try to patch those repositories and after that will optionally test and then publish | ||
the artifacts to maven local. | ||
To add a patch you have to add a file in the `.github/patches/` directory with the name of the repository that must | ||
be patched. | ||
This action assumes that java was set correctly. | ||
inputs: | ||
run_tests: | ||
default: "false" | ||
required: false | ||
description: "If the workflow should run tests of the dependencies. Anything different than false will evaluate to true" | ||
branch: | ||
required: true | ||
description: "The branch where this patches are being applied e.g.: release/v1.21.x" | ||
gpg_private_key: | ||
description: "The gpg key used to sign the artifacts" | ||
required: true | ||
gpg_password: | ||
description: "The gpg key password" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: check patches | ||
run: | | ||
if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java.patch ]]; then | ||
echo 'patch_otel_java=true' >> $GITHUB_ENV | ||
fi | ||
if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java-instrumentation.patch ]]; then | ||
echo 'patch_otel_java_instrumentation=true' >> $GITHUB_ENV | ||
fi | ||
if [[ -f .github/patches/${{ inputs.branch }}/opentelemetry-java-contrib.patch ]]; then | ||
echo 'patch_otel_java_contrib=true' >> $GITHUB_ENV | ||
fi | ||
shell: bash | ||
|
||
- name: Clone and patch repositories | ||
run: .github/scripts/patch.sh "${{ inputs.branch }}" | ||
if: ${{ env.patch_otel_java == 'true' || | ||
env.patch_otel_java_instrumentation == 'true' || | ||
env.patch_otel_java_contrib == 'true' }} | ||
shell: bash | ||
|
||
- name: Build opentelemetry-java with tests | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java == 'true' && inputs.run_tests != 'false' }} | ||
with: | ||
arguments: build publishToMavenLocal | ||
build-root-directory: opentelemetry-java | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} | ||
|
||
- name: Build opentelemetry-java | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java == 'true' && inputs.run_tests == 'false' }} | ||
with: | ||
arguments: publishToMavenLocal | ||
build-root-directory: opentelemetry-java | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} | ||
|
||
- name: Build opentelemetry-java-contrib with tests | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java_contrib == 'true' && inputs.run_tests != 'false' }} | ||
with: | ||
arguments: build publishToMavenLocal | ||
build-root-directory: opentelemetry-java-contrib | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} | ||
|
||
- name: Build opentelemetry-java-contrib | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java_contrib == 'true' && inputs.run_tests == 'false' }} | ||
with: | ||
arguments: publishToMavenLocal | ||
build-root-directory: opentelemetry-java-contrib | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} | ||
|
||
- name: Build opentelemetry-java-instrumentation with tests | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests != 'false' }} | ||
with: | ||
arguments: check -x spotlessCheck publishToMavenLocal | ||
build-root-directory: opentelemetry-java-instrumentation | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} | ||
|
||
- name: Build opentelemetry java instrumentation | ||
uses: gradle/gradle-build-action@v2 | ||
if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests == 'false' }} | ||
with: | ||
arguments: publishToMavenLocal | ||
build-root-directory: opentelemetry-java-instrumentation | ||
env: | ||
GPG_PRIVATE_KEY: ${{ inputs.gpg_private_key }} | ||
GPG_PASSWORD: ${{ inputs.gpg_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# Enable debug mode, fail on any command that fail in this script and fail on unset variables | ||
set -x -e -u | ||
|
||
# This parameter will help find the patches to be applied | ||
BRANCH=$1 | ||
|
||
# .github/patches/$BRANCH/versions.sh should define all the versions of the dependencies that we are going to patch | ||
# This is used so that we can properly clone the upstream repositories. | ||
# This file should define the following variables: | ||
# OTEL_JAVA_VERSION. Tag of the opentelemetry-java repository to use. E.g.: JAVA_OTEL_JAVA_VERSION=v1.21.0 | ||
# OTEL_JAVA_INSTRUMENTATION_VERSION. Tag of the opentelemetry-java-instrumentation repository to use, e.g.: OTEL_JAVA_INSTRUMENTATION_VERSION=v1.21.0 | ||
# OTEL_JAVA_CONTRIB_VERSION. Tag of the opentelemetry-java-contrib repository. E.g.: OTEL_JAVA_CONTRIB_VERSION=v1.21.0 | ||
# This script will fail if a variable that is supposed to exist is referenced. | ||
|
||
if [[ ! -f .github/patches/${BRANCH}/versions ]]; then | ||
echo "No versions file found. Skipping patching" | ||
exit 0 | ||
fi | ||
|
||
source .github/patches/${BRANCH}/versions | ||
|
||
git config --global user.email "adot-patch-workflow@github.com" | ||
git config --global user.name "ADOT Patch workflow" | ||
|
||
|
||
OTEL_JAVA_PATCH=".github/patches/${BRANCH}/opentelemetry-java.patch" | ||
if [[ -f "$OTEL_JAVA_PATCH" ]]; then | ||
git clone https://github.com/open-telemetry/opentelemetry-java.git | ||
cd opentelemetry-java | ||
git checkout ${OTEL_JAVA_VERSION} -b tag-${OTEL_JAVA_VERSION} | ||
patch -p1 < ../${OTEL_JAVA_PATCH} | ||
git commit -a -m "ADOT Patch release" | ||
cd - | ||
else | ||
echo "Skiping patching opentelemetry-java" | ||
fi | ||
|
||
|
||
OTEL_JAVA_CONTRIB_PATCH=".github/patches/${BRANCH}/opentelemetry-java-contrib.patch" | ||
if [[ -f "$OTEL_JAVA_CONTRIB_PATCH" ]]; then | ||
git clone https://github.com/open-telemetry/opentelemetry-java-contrib.git | ||
cd opentelemetry-java-contrib | ||
git checkout ${OTEL_JAVA_CONTRIB_VERSION} -b tag-${OTEL_JAVA_CONTRIB_VERSION} | ||
patch -p1 < "../${OTEL_JAVA_CONTRIB_PATCH}" | ||
git commit -a -m "ADOT Patch release" | ||
cd - | ||
else | ||
echo "Skipping patching opentelemetry-java-contrib" | ||
fi | ||
|
||
|
||
OTEL_JAVA_INSTRUMENTATION_PATCH=".github/patches/${BRANCH}/opentelemetry-java-instrumentation.patch" | ||
if [[ -f "$OTEL_JAVA_INSTRUMENTATION_PATCH" ]]; then | ||
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git | ||
cd opentelemetry-java-instrumentation | ||
git checkout ${OTEL_JAVA_INSTRUMENTATION_VERSION} -b tag-${OTEL_JAVA_INSTRUMENTATION_VERSION} | ||
patch -p1 < "../${OTEL_JAVA_INSTRUMENTATION_PATCH}" | ||
git commit -a -m "ADOT Patch release" | ||
cd - | ||
else | ||
echo "Skipping patching opentelemetry-java-instrumentation" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters