From 2d74a8738240a98b092618ba7be6f0e54bed3cd3 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Mon, 14 Sep 2020 13:53:19 +0300 Subject: [PATCH 1/4] Dependencies updated --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b1e8afb..ff73227 100644 --- a/build.gradle +++ b/build.gradle @@ -31,11 +31,10 @@ publishing { } dependencies { + api 'org.apache.logging.log4j:log4j-core:2.13.0' + api 'log4j:log4j:1.2.17' implementation 'com.epam.reportportal:client-java:5.0.6' implementation 'com.epam.reportportal:commons-model:5.0.0' - implementation 'log4j:log4j:1.2.17' - implementation 'org.apache.logging.log4j:log4j-api:2.13.0' - implementation 'org.apache.logging.log4j:log4j-core:2.13.0' } wrapper { From 93006578af9941b1b9f5176bdca3b4d3b1549288 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 27 Apr 2021 15:15:04 +0300 Subject: [PATCH 2/4] Bintray references remove --- README.md | 4 +--- build.gradle | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b2fe93d..ed384f2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # log4j-integration - -[![Download](https://api.bintray.com/packages/epam/reportportal/logger-java-log4j/images/download.svg) ](https://bintray.com/epam/reportportal/logger-java-log4j/_latestVersion) - +[![Maven Central](https://img.shields.io/maven-central/v/com.epam.reportportal/logger-java-log4j.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.epam.reportportal%22%20AND%20a:%22logger-java-log4j%22) [![Join Slack chat!](https://reportportal-slack-auto.herokuapp.com/badge.svg)](https://reportportal-slack-auto.herokuapp.com) [![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal) [![UserVoice](https://img.shields.io/badge/uservoice-vote%20ideas-orange.svg?style=flat)](https://rpp.uservoice.com/forums/247117-report-portal) diff --git a/build.gradle b/build.gradle index ff73227..5616650 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,8 @@ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 repositories { - jcenter() - releaseMode ? maven { url "http://dl.bintray.com/epam/reportportal" } : maven { url "https://jitpack.io" } + mavenLocal() + mavenCentral() } project.ext.githubUserName = project.hasProperty('githubUserName') ? githubUserName : "" @@ -33,7 +33,7 @@ publishing { dependencies { api 'org.apache.logging.log4j:log4j-core:2.13.0' api 'log4j:log4j:1.2.17' - implementation 'com.epam.reportportal:client-java:5.0.6' + implementation 'com.epam.reportportal:client-java:5.0.21' implementation 'com.epam.reportportal:commons-model:5.0.0' } From 9763c01901d8484da24dc1875d9edcaed9a438b6 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 23 Sep 2021 13:48:53 +0300 Subject: [PATCH 3/4] Client version update --- CHANGELOG.md | 2 + build.gradle | 50 ++++++++----------- gradle.properties | 6 ++- .../log4j/appender/ReportPortalAppender.java | 4 +- .../appender/ReportPortalLog4j2Appender.java | 6 +-- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 285f1c3..153bed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Changed +- Client version updated on [5.1.0-RC-12](https://github.com/reportportal/client-java/releases/tag/5.1.0-RC-12) ## [5.0.3] ### Changed diff --git a/build.gradle b/build.gradle index 5616650..e11e80c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,46 +1,36 @@ -apply plugin: 'java-library' - -project.ext.releaseMode = project.hasProperty('releaseMode') +/* + * Copyright 2020 EPAM Systems + * + * 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. + */ -def branch = releaseMode ? '5.0.0' : 'develop' -apply from: "https://raw.githubusercontent.com/reportportal/gradle-scripts/$branch/release-commons.gradle" -apply from: "https://raw.githubusercontent.com/reportportal/gradle-scripts/$branch/build-quality.gradle" +apply plugin: 'java-library' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +apply from: "${project.scripts_url}/${project.scripts_branch}/build-quality.gradle" +apply from: "${project.scripts_url}/${project.scripts_branch}/release-commons.gradle" +apply from: "${project.scripts_url}/${project.scripts_branch}/signing.gradle" repositories { - mavenLocal() mavenCentral() } -project.ext.githubUserName = project.hasProperty('githubUserName') ? githubUserName : "" -project.ext.githubToken = project.hasProperty('githubToken') ? githubToken : "" - -publishing { - repositories { - maven { - name = "Log4j GitHub Packages" - url = uri("https://maven.pkg.github.com/reportportal/logger-java-log4j") - credentials { - username = githubUserName - password = githubToken - } - } - } -} - dependencies { api 'org.apache.logging.log4j:log4j-core:2.13.0' api 'log4j:log4j:1.2.17' - implementation 'com.epam.reportportal:client-java:5.0.21' + implementation 'com.epam.reportportal:client-java:5.1.0-RC-12' implementation 'com.epam.reportportal:commons-model:5.0.0' } wrapper { gradleVersion = '5.4.1' } - -def releaseDependencies = [bintrayUpload, publish] -releaseDependencies.addAll(afterReleaseBuild.getDependsOn()) -afterReleaseBuild.setDependsOn(releaseDependencies) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1ead3be..745cc16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,4 @@ -version=5.0.4-SNAPSHOT -description=EPAM Report portal. Log4j Intergration \ No newline at end of file +version=5.1.0-RC-1-SNAPSHOT +description=EPAM Report portal. Log4j Intergration +scripts_url=https://raw.githubusercontent.com/reportportal/gradle-scripts +scripts_branch=develop diff --git a/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalAppender.java b/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalAppender.java index 776b65c..8b0c20d 100644 --- a/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalAppender.java +++ b/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalAppender.java @@ -17,11 +17,11 @@ import com.epam.reportportal.message.ReportPortalMessage; import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.log4j.AppenderSkeleton; import org.apache.log4j.Layout; import org.apache.log4j.PatternLayout; import org.apache.log4j.spi.LoggingEvent; -import rp.com.google.common.base.Throwables; import java.io.File; import java.io.IOException; @@ -61,7 +61,7 @@ protected void append(final LoggingEvent event) { */ StringBuilder throwable = new StringBuilder(); if (null != event.getThrowableInformation() && null != event.getThrowableInformation().getThrowable()) { - throwable.append(Throwables.getStackTraceAsString(event.getThrowableInformation().getThrowable())); + throwable.append(ExceptionUtils.getStackTrace(event.getThrowableInformation().getThrowable())); } // ReportPortalMessage is reported diff --git a/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalLog4j2Appender.java b/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalLog4j2Appender.java index ba01d9d..53ff877 100644 --- a/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalLog4j2Appender.java +++ b/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalLog4j2Appender.java @@ -29,17 +29,17 @@ import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.message.ObjectMessage; -import rp.com.google.common.base.Charsets; import java.io.File; import java.io.IOException; import java.io.Serializable; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.UUID; import static com.epam.reportportal.service.ReportPortal.emitLog; import static com.epam.reportportal.utils.MimeTypeDetector.detect; -import static rp.com.google.common.io.Files.asByteSource; +import static com.google.common.io.Files.asByteSource; /** * Log4j2 appender for report portal @@ -114,7 +114,7 @@ public void append(final LogEvent logEvent) { message = rpMessage.getMessage(); byteSource = rpMessage.getData(); } else { - message = new String(getLayout().toByteArray(event), Charsets.UTF_8); + message = new String(getLayout().toByteArray(event), StandardCharsets.UTF_8); } if (null != byteSource) { From 24a8991b9502ba8150f6549cb55a4feca533e490 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 23 Sep 2021 13:49:11 +0300 Subject: [PATCH 4/4] Pipelines update --- .github/workflows/ci.yml | 37 +++++++---- .github/workflows/promote.yml | 117 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 38 ++++++----- 3 files changed, 162 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/promote.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1c62dc..037727a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,25 +16,34 @@ name: CI Build on: push: branches: - - '*' - - '!master' - - '!v4-hotfix' + - '*' + - '!master' + - '!v4-hotfix' + paths-ignore: + - README.md + - README_TEMPLATE.md + - gradle.properties + - CHANGELOG.md + pull_request: branches: - - master - - v4-hotfix + - master + - v4-hotfix jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build + - uses: actions/checkout@v2 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 0000000..9f124a5 --- /dev/null +++ b/.github/workflows/promote.yml @@ -0,0 +1,117 @@ +# Copyright 2021 EPAM Systems +# 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. + +name: Promote + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + +env: + REPOSITORY_URL: 'https://maven.pkg.github.com' + UPSTREAM_REPOSITORY_URL: 'https://oss.sonatype.org' + PACKAGE_SUFFIXES: '-javadoc.jar,-javadoc.jar.asc,-sources.jar,-sources.jar.asc,.jar,.jar.asc,.pom,.pom.asc' + PACKAGE: 'com.epam.reportportal' + + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Get variables + run: | + echo "ARTIFACT=`echo ${{ github.repository }} | cut -d/ -f2- | awk '{print tolower($0)}'`" >> $GITHUB_ENV + echo "PACKAGE_PATH=`echo ${{ env.PACKAGE }} | sed 's/\./\//g'`" >> $GITHUB_ENV + + - name: Upload package + run: | + IFS=',' read -a files <<< '${{ env.PACKAGE_SUFFIXES }}' + for f in ${files[@]}; do + export URL="${{ env.REPOSITORY_URL }}/${{ github.repository }}/${PACKAGE_PATH}/${ARTIFACT}/${{ github.event.inputs.version }}/${ARTIFACT}-${{ github.event.inputs.version }}${f}" + echo "Downloading artifact: ${URL}" + curl -f -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} -s -O -L "${URL}" + done + files=($(ls)) + echo 'Files downloaded:' + echo "${files[@]}" + + echo 'Bundle generation' + export BUNDLE_FILE="bundle.jar" + jar -cvf ${BUNDLE_FILE} "${files[@]}" + + echo 'Bundle upload' + curl -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --request POST '${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/bundle_upload' \ + --form "file=@${BUNDLE_FILE}" >response.json + + response_type=`jq type response.json || echo ''` + if [ -z "$response_type" ]; then + echo 'ERROR: Response is not JSON!' 1>&2 + cat response.json 1>&2 + exit 1 + fi + + repo=`jq -r '.repositoryUris[0]' response.json` + if [ -z "$repo" ]; then + echo 'Unable to upload bundle' 1>&2 + cat response.json 1>&2 + exit 1 + fi + + echo "NEXUS_REPOSITORY=${repo}" >> $GITHUB_ENV + + - name: Get repository variables + run: | + echo "NEXUS_REPOSITORY_NAME=`echo ${NEXUS_REPOSITORY} | sed -E 's/(.+)\/([^\/]+)$/\2/'`" >> $GITHUB_ENV + + - name: Promote package + env: + ATTEMPTS: 60 + SLEEP_TIME: 10 + run: | + verified=false + for i in `seq 0 ${ATTEMPTS}`; do + sleep $SLEEP_TIME + curl -f -s -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --header 'Accept: application/json' \ + ${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/repository/${NEXUS_REPOSITORY_NAME} >result.json + + is_closed=`jq -r '.type' result.json` + is_transitioning=`jq -r '.transitioning' result.json` + echo "Current repository status: $is_closed; transitioning: $is_transitioning" + + if [[ "$is_closed" == "closed" && "$is_transitioning" == "false" ]]; then + verified=true + break + fi + done + if $verified; then + echo "A bundle was verified, releasing" + curl -f -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --header 'Content-Type: application/json' \ + --data-raw "{\"data\":{\"stagedRepositoryIds\":[\"${NEXUS_REPOSITORY_NAME}\"], \"description\":\"Releasing ${{ github.event.inputs.version }}\"}}" \ + --request POST ${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/bulk/promote + else + echo 'Verification failed, please check the bundle' 1>&2 + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 355fc7a..a6cb9d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,7 @@ on: branches: - master - v4-hotfix + paths-ignore: - '.github/**' - README.md @@ -27,9 +28,10 @@ on: env: VERSION_FILE: gradle.properties - GH_USER_NAME: github.actor + VERSION_EXTRACT_PATTERN: '(?<=version=).+' CHANGE_LOG_FILE: CHANGELOG.md CHANGE_LOG_TMP_FILE: CHANGELOG_updated.md + REPOSITORY_URL: 'https://maven.pkg.github.com/' jobs: release: @@ -39,11 +41,11 @@ jobs: uses: actions/checkout@v2 - name: Generate versions - uses: HardNorth/github-version-generate@v1.0.1 + uses: HardNorth/github-version-generate@v1.1.0 with: version-source: file - version-file: gradle.properties - version-file-extraction-pattern: '(?<=version=).+' + version-file: ${{ env.VERSION_FILE }} + version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }} - name: Set up JDK 1.8 uses: actions/setup-java@v1 @@ -54,7 +56,7 @@ jobs: run: chmod +x gradlew - name: Setup git credentials - uses: oleksiyrudenko/gha-git-credentials@v1 + uses: oleksiyrudenko/gha-git-credentials@v2 with: name: 'reportportal.io' email: 'support@reportportal.io' @@ -63,16 +65,13 @@ jobs: - name: Release with Gradle id: release run: | - ./gradlew release -PreleaseMode -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{env.RELEASE_VERSION}} \ - -Prelease.newVersion=${{env.NEXT_VERSION}} -PbintrayUser=${{secrets.BINTRAY_USER}} -PbintrayApiKey=${{secrets.BINTRAY_API_KEY}} \ - -PgithubUserName=${{env.GH_USER_NAME}} -PgithubToken=${{secrets.GITHUB_TOKEN}} - - - name: Read changelog Entry - id: readChangelogEntry - uses: mindsers/changelog-reader-action@v1.2.0 - with: - version: 'Unreleased' - path: ./${{ env.CHANGE_LOG_FILE }} + ./gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ env.RELEASE_VERSION }} \ + -Prelease.newVersion=${{ env.NEXT_VERSION }} -PpublishRepo=${{ env.REPOSITORY_URL }}${{ github.repository }} \ + -PgithubUserName=${{ github.actor }} -PgithubToken=${{ secrets.GITHUB_TOKEN }} \ + -PgpgPassphrase=${{ secrets.GPG_PASSPHRASE }} -PgpgPrivateKey="$(cat <<'EOF' + ${{ secrets.GPG_PRIVATE_KEY }} + EOF + )" - name: Update CHANGELOG.md id: changelogUpdate @@ -88,11 +87,18 @@ jobs: git commit -m "Changelog update" git push + - name: Read changelog Entry + id: readChangelogEntry + uses: mindsers/changelog-reader-action@v1.3.1 + with: + version: ${{ env.RELEASE_VERSION }} + path: ./${{ env.CHANGE_LOG_FILE }} + - name: Create Release id: createRelease uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.RELEASE_VERSION }} release_name: Release ${{ env.RELEASE_VERSION }}