From 0d245288af6453f2b91df0894c9118d316e36444 Mon Sep 17 00:00:00 2001 From: Marc Wodahl Date: Tue, 2 Jul 2024 18:36:08 -0600 Subject: [PATCH 1/7] Use subscription topic .env var if present --- pom.xml | 3 +++ .../jpo/sdw/depositor/DepositorProperties.java | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 2f3eb89..83d68ac 100644 --- a/pom.xml +++ b/pom.xml @@ -108,6 +108,9 @@ ${loader.path} ${project.build.directory} + + testSubscriptionTopic + diff --git a/src/main/java/jpo/sdw/depositor/DepositorProperties.java b/src/main/java/jpo/sdw/depositor/DepositorProperties.java index 7350c55..5e9d060 100644 --- a/src/main/java/jpo/sdw/depositor/DepositorProperties.java +++ b/src/main/java/jpo/sdw/depositor/DepositorProperties.java @@ -2,8 +2,6 @@ import java.util.regex.Pattern; -import jakarta.annotation.PostConstruct; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -12,6 +10,8 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; +import jakarta.annotation.PostConstruct; + @ConfigurationProperties("sdw") @PropertySource("classpath:application.properties") public class DepositorProperties implements EnvironmentAware { @@ -66,9 +66,14 @@ void initialize() { } if (getSubscriptionTopics() == null || getSubscriptionTopics().length == 0) { - String topics = String.join(",", DEFAULT_SUBSCRIPTION_TOPICS); - logger.info("No Kafka subscription topics specified in configuration, defaulting to {}", topics); - subscriptionTopics = DEFAULT_SUBSCRIPTION_TOPICS; + // get environment variable SDW_SUBSCRIPTION_TOPIC + String topics = System.getenv("SDW_SUBSCRIPTION_TOPIC"); + subscriptionTopics = topics.split(","); + if (topics == null || topics.isEmpty()) { + topics = String.join(",", DEFAULT_SUBSCRIPTION_TOPICS); + logger.info("No Kafka subscription topics specified in configuration, defaulting to {}", topics); + subscriptionTopics = DEFAULT_SUBSCRIPTION_TOPICS; + } } if (getApiKey() == null || getApiKey().isEmpty()) { From a8ea78d4b49b0531b0d63500399d945ad39273d4 Mon Sep 17 00:00:00 2001 From: Marc Wodahl Date: Tue, 16 Jul 2024 13:49:27 -0600 Subject: [PATCH 2/7] Update topics.split to be after null check --- src/main/java/jpo/sdw/depositor/DepositorProperties.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/jpo/sdw/depositor/DepositorProperties.java b/src/main/java/jpo/sdw/depositor/DepositorProperties.java index 5e9d060..f657948 100644 --- a/src/main/java/jpo/sdw/depositor/DepositorProperties.java +++ b/src/main/java/jpo/sdw/depositor/DepositorProperties.java @@ -68,11 +68,12 @@ void initialize() { if (getSubscriptionTopics() == null || getSubscriptionTopics().length == 0) { // get environment variable SDW_SUBSCRIPTION_TOPIC String topics = System.getenv("SDW_SUBSCRIPTION_TOPIC"); - subscriptionTopics = topics.split(","); if (topics == null || topics.isEmpty()) { topics = String.join(",", DEFAULT_SUBSCRIPTION_TOPICS); logger.info("No Kafka subscription topics specified in configuration, defaulting to {}", topics); subscriptionTopics = DEFAULT_SUBSCRIPTION_TOPICS; + } else { + subscriptionTopics = topics.split(","); } } From 442302ce283180c8c0215026033976e44e518f4e Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:31:02 -0600 Subject: [PATCH 3/7] testing artifact-publish GitHub action --- .github/workflows/artifact-publish.yml | 33 ++++++++++++++ README.md | 60 +++++++++++++++++++++++++- pom.xml | 8 ++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/artifact-publish.yml diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml new file mode 100644 index 0000000..ab88bcc --- /dev/null +++ b/.github/workflows/artifact-publish.yml @@ -0,0 +1,33 @@ +name: Publish Java Package + +on: + # push: + # tags: + # - 'jpo-security-svcs-*' + pull_request: + types: [opened, reopened, synchronize] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'adopt' + + - name: Remove snapshot from version + run: mvn versions:set -DremoveSnapshot + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages + run: mvn --batch-mode -Dgithub_organization=${{ github.repository_owner }} deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 3903eeb..4ef7886 100644 --- a/README.md +++ b/README.md @@ -113,4 +113,62 @@ Rather than using a local kafka instance, this project can utilize an instance o There is a provided docker-compose file (docker-compose-confluent-cloud.yml) that passes the above environment variables into the container that gets created. Further, this file doesn't spin up a local kafka instance since it is not required. ### Note -This has only been tested with Confluent Cloud but technically all SASL authenticated Kafka brokers can be reached using this method. \ No newline at end of file +This has only been tested with Confluent Cloud but technically all SASL authenticated Kafka brokers can be reached using this method. + +## GitHub Artifact Usage + +To use this library in another application, add the GitHub package URLs to the `repositories` section in `pom.xml` of the consumer application or in your local `~/.m2/settings.xml` file. Here is an example implementation of using the GitHub artifact in a consumer application: + +```xml + + + + github + + + + + github + + + central + https://repo1.maven.org/maven2 + + + github + https://maven.pkg.github.com/usdot-jpo-ode/jpo-security-svcs + + + + + + + + github + ${env.PACKAGE_READ_USERNAME} + ${env.PACKAGE_READ_TOKEN} + + + + +``` + +And add the following line to the `dependencies` element in `build.gradle` + +```xml + + + usdot.jpo.ode + jpo-security-svcs + 1.0.0 + + +``` + +Finally, set the environment variables: + +* PACKAGE_READ_USERNAME - User name with read access to the repositories containing the packages. +* PACKAGE_READ_TOKEN - Personal access token with `read:packages` scope. diff --git a/pom.xml b/pom.xml index 83d68ac..d40203e 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ reuseReports ${project.basedir}/target/site/jacoco/jacoco.xml java + usdot-jpo-ode @@ -142,4 +143,11 @@ + + + github + GitHub Packages + https://maven.pkg.github.com/${github_organization}/jpo-security-svcs + + \ No newline at end of file From 41f6ce6bdded23b26dd1954b2e651a3227ec418b Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:38:48 -0600 Subject: [PATCH 4/7] fixing repository name --- .github/workflows/artifact-publish.yml | 2 +- README.md | 4 ++-- pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index ab88bcc..9dbf8cf 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -3,7 +3,7 @@ name: Publish Java Package on: # push: # tags: - # - 'jpo-security-svcs-*' + # - 'jpo-sdw-depositor-*' pull_request: types: [opened, reopened, synchronize] diff --git a/README.md b/README.md index 4ef7886..028c53d 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ To use this library in another application, add the GitHub package URLs to the ` github - https://maven.pkg.github.com/usdot-jpo-ode/jpo-security-svcs + https://maven.pkg.github.com/usdot-jpo-ode/jpo-sdw-depositor @@ -162,7 +162,7 @@ And add the following line to the `dependencies` element in `build.gradle` usdot.jpo.ode - jpo-security-svcs + jpo-sdw-depositor 1.0.0 diff --git a/pom.xml b/pom.xml index d40203e..c21378f 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,7 @@ github GitHub Packages - https://maven.pkg.github.com/${github_organization}/jpo-security-svcs + https://maven.pkg.github.com/${github_organization}/jpo-sdw-depositor \ No newline at end of file From f57453e76167085db2a832105552a7ae2021804d Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:42:33 -0600 Subject: [PATCH 5/7] update trigger to be on tag creation --- .github/workflows/artifact-publish.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index 9dbf8cf..d88af02 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,11 +1,9 @@ name: Publish Java Package on: - # push: - # tags: - # - 'jpo-sdw-depositor-*' - pull_request: - types: [opened, reopened, synchronize] + push: + tags: + - 'jpo-sdw-depositor-*' jobs: build: From daded24b23e140e821599da7c39de97adcd3a8d6 Mon Sep 17 00:00:00 2001 From: dmccoystephenson Date: Fri, 6 Sep 2024 08:13:38 -0600 Subject: [PATCH 6/7] Changed version to 1.8.0-SNAPSHOT --- Dockerfile | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 65c6338..edc73cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ RUN mvn clean package -DskipTests FROM eclipse-temurin:21-jre-alpine WORKDIR /home -COPY --from=builder /home/target/jpo-sdw-depositor-1.7.0-SNAPSHOT.jar /home +COPY --from=builder /home/target/jpo-sdw-depositor-1.8.0-SNAPSHOT.jar /home ENTRYPOINT ["java", \ "-jar", \ - "/home/jpo-sdw-depositor-1.7.0-SNAPSHOT.jar"] + "/home/jpo-sdw-depositor-1.8.0-SNAPSHOT.jar"] diff --git a/pom.xml b/pom.xml index c21378f..87c0e2b 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ usdot.jpo.ode jpo-sdw-depositor - 1.7.0-SNAPSHOT + 1.8.0-SNAPSHOT jar jpo-sdw-depositor From 50d4d9561b900c8127ea69f49eb1e786c489b756 Mon Sep 17 00:00:00 2001 From: dmccoystephenson Date: Fri, 6 Sep 2024 08:28:46 -0600 Subject: [PATCH 7/7] Added release notes for version 1.8.0 --- docs/Release_notes.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/Release_notes.md b/docs/Release_notes.md index be6c04f..53566b7 100644 --- a/docs/Release_notes.md +++ b/docs/Release_notes.md @@ -1,6 +1,16 @@ jpo-sdw-depositor Release Notes ---------------------------- +Version 1.8.0, released September 2024 +---------------------------------------- +### **Summary** +The changes for the jpo-sdw-depositor 1.8.0 release include a fix for the SDW_SUBSCRIPTION_TOPIC environment variable not getting used instead of the default if provided, as well as the addition of a GitHub action to publish Java artifacts to GitHub's hosted Maven Central. + +Enhancements in this release: +- CDOT PR 24: Fixed SDW_SUBSCRIPTION_TOPIC environment variable not getting used instead of default if provided +- CDOT PR 25: Added a GiHub action to opublish java artifacts to GitHub's hosted Maven Central + + Version 1.7.0, released June 2024 ---------------------------------------- ### **Summary**