Skip to content

Commit

Permalink
Merge pull request #257 from solarwinds/cc/CUST-110209
Browse files Browse the repository at this point in the history
CUST-110209: do SDK maven snapshot release
  • Loading branch information
cleverchuk authored Aug 21, 2024
2 parents 777b420 + f48ee59 commit 26f3974
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 6 deletions.
76 changes: 75 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ env:
SWO_EMAIL: ${{ secrets.SWO_EMAIL }}
SWO_PWORD: ${{ secrets.SWO_PWORD }}
STAGE_BUCKET: ${{ secrets.STAGE_BUCKET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}

jobs:
s3-stage-upload: # this job uploads the jar to stage s3
needs:
- maven_snapshot_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -178,10 +185,16 @@ jobs:
- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin

- name: Set agent version env
run: |
./gradlew build -x test
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g').$GIT_HASH" >> $GITHUB_ENV
- name: Execute smoke tests
run: |
cd smoke-tests
./gradlew test -s
./gradlew test
- uses: actions/upload-artifact@v4
if: always()
Expand Down Expand Up @@ -309,13 +322,43 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Set agent version env
run: |
./gradlew build -x test
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g').$GIT_HASH" >> $GITHUB_ENV
- name: Run application
working-directory: smoke-tests
run: |
./gradlew :netty-test:run
env:
SW_APM_SERVICE_KEY: ${{ secrets.SW_APM_SERVICE_KEY }}:smoke-test-linux

smoke-test-no-agent:
runs-on: ubuntu-latest
needs:
- s3-stage-upload
steps:
- uses: actions/checkout@v4

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

- name: Set agent version env
run: |
./gradlew build -x test
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g').$GIT_HASH" >> $GITHUB_ENV
- name: Run application
working-directory: smoke-tests
run: |
./gradlew :netty-test-no-agent:run
smoke-test-windows:
runs-on: windows-latest
needs:
Expand Down Expand Up @@ -354,6 +397,12 @@ jobs:
- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin

- name: Set agent version env
run: |
./gradlew build -x test
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g').$GIT_HASH" >> $GITHUB_ENV
- name: Build smoke-test
run: |
cd smoke-tests
Expand Down Expand Up @@ -420,3 +469,28 @@ jobs:
- name: Docker logout
if: always()
run: docker logout

maven_snapshot_release:
runs-on: ubuntu-latest
env:
SNAPSHOT_BUILD: true
steps:
- uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Set agent version env
run: |
./gradlew build -x test
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g').$GIT_HASH" >> $GITHUB_ENV
- name: Publish
run: ./gradlew publish
52 changes: 52 additions & 0 deletions smoke-tests/netty-test-no-agent/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import java.net.URI

/*
* © SolarWinds Worldwide, LLC. All rights reserved.
*
* 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.
*/

plugins {
java
application
}

group = "com.solarwinds"
version = "unspecified"

repositories {
mavenCentral()
maven {
url = URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_TOKEN")
}
}
}

val sdkVersion = System.getenv("AGENT_VERSION")?.also { println("Using SDK version: $it") } ?: "2.6.0"
dependencies {
implementation("io.netty:netty-common:4.1.94.Final")
implementation("io.github.appoptics:solarwinds-otel-sdk:$sdkVersion-SNAPSHOT")
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}

tasks.test {
useJUnitPlatform()
}

application {
mainClass.set("com.solarwinds.netty.NettyApp")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* © SolarWinds Worldwide, LLC. All rights reserved.
*
* 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.
*/

package com.solarwinds.netty;

import io.netty.util.NetUtil;
import com.solarwinds.api.ext.SolarwindsAgent;

import java.util.concurrent.TimeUnit;

public class NettyApp {
public static void main(String[] args){
SolarwindsAgent.setTransactionName("hello world!");
System.out.printf("Number of interfaces: %d%n",NetUtil.NETWORK_INTERFACES.size());
try {
TimeUnit.MINUTES.sleep(1);
} catch (InterruptedException ignore) {

}
System.out.printf("Shutting down%n");
}
}
12 changes: 11 additions & 1 deletion smoke-tests/netty-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.net.URI

/*
* © SolarWinds Worldwide, LLC. All rights reserved.
*
Expand Down Expand Up @@ -25,10 +27,19 @@ version = "unspecified"

repositories {
mavenCentral()
maven {
url = URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_TOKEN")
}
}
}

val sdkVersion = System.getenv("AGENT_VERSION")?.also { println("Using SDK version: $it") } ?: "2.6.0"
dependencies {
implementation("io.netty:netty-common:4.1.94.Final")
implementation("io.github.appoptics:solarwinds-otel-sdk:$sdkVersion-SNAPSHOT")
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
Expand All @@ -38,7 +49,6 @@ tasks.test {
}

val swoAgentPath = project.buildDir.toString() + "/swo/solarwinds-apm-agent.jar"

fun getAgentPath(downloadPath: String) = if (System.getenv("AGENT_PATH") == null) downloadPath
else System.getenv("AGENT_PATH")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
package com.solarwinds.netty;

import io.netty.util.NetUtil;
import com.solarwinds.api.ext.SolarwindsAgent;

import java.util.concurrent.TimeUnit;

public class NettyApp {
public static void main(String[] args){
SolarwindsAgent.setTransactionName("hello world!");
System.out.printf("Number of interfaces: %d%n",NetUtil.NETWORK_INTERFACES.size());
try {
TimeUnit.MINUTES.sleep(1);
Expand Down
1 change: 1 addition & 0 deletions smoke-tests/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ rootProject.name = 'smoke-tests'

include 'netty-test'
include 'spring-boot-webmvc'
include 'netty-test-no-agent'

10 changes: 9 additions & 1 deletion smoke-tests/spring-boot-webmvc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,18 @@ version = "0.0.1-SNAPSHOT"

repositories {
mavenCentral()
maven {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_TOKEN")
}
}
}

def sdkVersion = System.getenv("AGENT_VERSION") ?: "2.6.0"
dependencies {
implementation("io.github.appoptics:solarwinds-otel-sdk:2.2.0")
implementation("io.github.appoptics:solarwinds-otel-sdk:$sdkVersion-SNAPSHOT")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
implementation("org.springframework.boot:spring-boot-starter-actuator")

Expand Down
12 changes: 9 additions & 3 deletions solarwinds-otel-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,27 @@ publishing {
name = 'Apache License, Version 2.0'
}
}

groupId = 'io.github.appoptics'
artifactId = "${archivesBaseName}"
version = "${versions.agent}"
def sdkVersion = System.getenv("AGENT_VERSION") ?: "2.6.0"
version = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? "$sdkVersion-SNAPSHOT" : "${versions.agent}"

from components.java
artifact sourcesJar
artifact javadocJar
}
}
publishToMavenLocal
}

repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

url = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_TOKEN")
Expand All @@ -115,7 +122,6 @@ signing {
sign publishing.publications.mavenJava
}


test {
useJUnitPlatform()
testLogging {
Expand Down

0 comments on commit 26f3974

Please sign in to comment.