Skip to content

Commit

Permalink
NH-86008: update pipeline configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Oct 3, 2024
1 parent 5acfce1 commit a498bc4
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 229 deletions.
193 changes: 0 additions & 193 deletions .circleci/config.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .circleci/images/Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions .circleci/m2/settings.xml → .github/m2/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<servers>
<server>
<id>github-write</id>
<username>lt-global-circleci</username>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
<server>
<id>github-read</id>
<username>lt-global-circleci</username>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
Expand Down
45 changes: 22 additions & 23 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
# This workflow does the following things:
# 1. build and test the core Joboe libs (core, metrics and dependencies)
# 1. build and test the core Joboe libs (core, metrics, config, logging and sampling)
# 2. publish the jars to Github Packages (which can be used by the NightHawk agent at https://github.com/appoptics/opentelemetry-java-instrumentation-custom-distro)
# 3. make a **draft** release on Github and upload the jars as artifacts (you may need to publish the release manually after it)

# The workflow needs to be triggered manually. (go to the Actions tab in the repo page, choose the workflow and click `Run Workflow`)
# The draft release will be named based on the `revision` property in the pom file. For example, if the pom revision is 7.0.4, the release
# will be named as "v7.0.4"
name: Build and Publish Core libs with Maven
name: Release

on:
workflow_dispatch:

permissions:
packages: write
contents: write
id-token: write

jobs:
publish:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
- name: Set up JDK 8 for Maven running on JDK9+
id: setup-jdk-8
uses: actions/setup-java@v1
with:
java-version: 8.0.112
- name: Set up JDK 11 for building the Joboe core libs
uses: actions/setup-java@v2
- uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: 8.0.302
distribution: 'temurin'

- name: Set version env to pom version
run: |
echo "POM_VERSION=v$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Publish package
run: mvn -Dmaven.resolver.transport=wagon --batch-mode deploy
env:
JAVA_1_8_HOME: "${{ steps.setup-jdk-8.outputs.path }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release and upload artifacts
run: gh release create ${{ env.POM_VERSION }} --title "${{ env.POM_VERSION }}" --notes "for the OpenTelemetry custom distro" --target ${{ github.ref_name }} --draft core/target/core-*.jar dependencies/target/dependencies-*.jar metrics/target/metrics-*.jar
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
NEW_VERSION=${VERSION%%-SNAPSHOT}
mvn versions:set -DnewVersion=$NEW_VERSION
mvn -s .github/m2/settings.xml -Dmaven.resolver.transport=wagon --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90 changes: 90 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Push

on:
push:

permissions:
packages: write
contents: write
id-token: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8.0.302
distribution: 'temurin'

- name: Run maven verify
run: |
mvn -s .github/m2/settings.xml clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v4
if: always()
with:
path: core/target/coverage-report
name: coverage report

- uses: actions/upload-artifact@v4
if: always()
with:
path: core/target/surefire-reports
name: unit test report

- name: Check shading(core)
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
code=0
for path in $(jar tf "core/target/core-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
do
PACKAGE=$(echo "$path" | awk -F/ '{print $2}')
if [ -n "$PACKAGE" ]; then
echo "Package ($path) is not shaded"
code=1
fi
done
exit $code
- name: Check shading(metric)
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
code=0
for path in $(jar tf "metrics/target/metrics-$VERSION.jar" | grep -E -v '^((com/solarwinds|META))')
do
PACKAGE=$(echo "$path" | awk -F/ '{print $2}')
if [ -n "$PACKAGE" ]; then
echo "Package ($path) is not shaded"
code=1
fi
done
exit $code
deploy_snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8.0.302
distribution: 'temurin'

- name: Deploy snapshot
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
BRANCH=$(echo -n "${GITHUB_REF_NAME}" | sed -e 's/[^0-9a-zA-Z\._\-]/./g' | tr '[:upper:]' '[:lower:]')
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
NEW_VERSION=${VERSION%%-SNAPSHOT}-$BRANCH-$GIT_HASH-SNAPSHOT
mvn versions:set -DnewVersion=$NEW_VERSION
mvn -s .github/m2/settings.xml -T 8 deploy -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<repository>
<id>github-write</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/solarwinds-cloud/maven-releases</url>
<url>https://maven.pkg.github.com/solarwinds/joboe</url>
</repository>
</distributionManagement>
<dependencyManagement>
Expand Down

0 comments on commit a498bc4

Please sign in to comment.