From 39a0b6264d93edb4e368b65215c507adf753dc4e Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Thu, 8 Jul 2021 14:02:07 +0200 Subject: [PATCH 1/5] Remove CCI and add release GHA release workflow Signed-off-by: Pavol Loffay --- .circleci/config.yml | 134 --------------------------------- .github/workflows/release.yaml | 128 +++++++++++++++++++++---------- README.md | 2 - RELEASE.md | 22 ++---- build.gradle.kts | 2 +- 5 files changed, 96 insertions(+), 192 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 19369ea2f..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,134 +0,0 @@ -version: 2.1 - -executors: - gradle_docker: - docker: - - image: cimg/openjdk:11.0 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - -commands: - setup_build_environment: - description: "Checkout, update submodules, restore the cache, and setup docker" - steps: - - checkout - - run: - name: Generate cache key - command: find . -type f -name "*.gradle*" -o -name "gradle-wrapper*" -exec shasum {} + | sort > /tmp/checksum.txt && cat /tmp/checksum.txt - - run: make init-submodules - - restore_cache: - keys: - - v1-dependencies-{{ checksum "/tmp/checksum.txt" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - docker_login: - description: "Login to dockerhub with readonly credentials" - steps: - - run: - name: Dockerhub login - command: echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin - populate_and_save_cache: - description: "Downloads all gradle dependencies and uploads cache for later use" - steps: - - run: ./gradlew downloadDependencies - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "/tmp/checksum.txt" }} - -jobs: - build: - docker: - - image: cimg/openjdk:11.0 - working_directory: ~/repo - environment: - # Customize the JVM maximum heap limit - JVM_OPTS: -Xmx1g - TERM: dumb - steps: - - setup_build_environment - - populate_and_save_cache - - run: make build - - muzzle: - docker: - - image: cimg/openjdk:11.0 - working_directory: ~/repo - environment: - # Customize the JVM maximum heap limit - JVM_OPTS: -Xmx1g - TERM: dumb - steps: - - setup_build_environment - - run: make muzzle - - release-maven-publish: - executor: gradle_docker - steps: - - setup_build_environment - - setup_remote_docker: - version: 19.03.13 - - docker_login - - run: echo "Releasing version" && ./gradlew printVersion - - run: - name: Publish to Maven Central - command: | - export ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d) - ./gradlew publish - - run: ./gradlew closeAndReleaseRepository - - run: DOCKER_TAG=${CIRCLE_TAG} make docker docker-push - - run: - name: "Copy artifacts to workspace" - command: | - mkdir artifacts - cp javaagent/build/libs/*-all.jar artifacts/hypertrace-agent-all.jar - - persist_to_workspace: - root: . - paths: - - artifacts - - release-github-publish: - docker: - - image: cibuilds/github:0.13 - steps: - - attach_workspace: - at: . - - run: - name: "Publish Release on GitHub" - command: | - ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -n "Release ${CIRCLE_TAG}" -b "..." --soft ${CIRCLE_TAG} ./artifacts/ - -workflows: - version: 2 - build-and-publish: - jobs: - - build: - filters: - tags: - only: /.*/ - - muzzle: - filters: - tags: - only: /.*/ - - release-maven-publish: - context: - - hypertrace-publishing - - maven-central-publish - requires: - - build - - muzzle - filters: - branches: - ignore: /.*/ - tags: - only: /^[0-9]+\.[0-9]+\.[0-9]+/ - - release-github-publish: - context: hypertrace-publishing - requires: - - release-maven-publish - filters: - branches: - ignore: /.*/ - tags: - only: /^[0-9]+\.[0-9]+\.[0-9]+/ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 610d6c3e4..02b66830c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,11 +1,73 @@ name: release on: create: - tags: - - ^[0-9]+\.[0-9]+\.[0-9]+ + tags: ['^[0-9]+\.[0-9]+\.[0-9]+'] jobs: +# test: +# runs-on: ubuntu-20.04 +# steps: +# # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation +# - name: Check out code +# uses: actions/checkout@v2.3.4 +# with: +# fetch-depth: 0 +# submodules: true +# +# - name: create checksum file +# uses: hypertrace/github-actions/checksum@main +# +# - name: Cache packages +# id: cache-packages +# uses: actions/cache@v2 +# with: +# path: ~/.gradle +# key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} +# restore-keys: | +# gradle-packages-${{ runner.os }}-${{ github.job }} +# gradle-packages-${{ runner.os }} +# +# - name: build +# run: make build +# env: +# JVM_OPTS: -Xmx1g +# TERM: dumb +# +# smoke-test: +# runs-on: ubuntu-20.04 +# strategy: +# matrix: +# suite: [ "glassfish", "jetty", "liberty", "tomcat", "tomee", "wildfly", "other" ] +# fail-fast: true +# steps: +# # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation +# - name: Check out code +# uses: actions/checkout@v2.3.4 +# with: +# fetch-depth: 0 +# submodules: true +# +# - name: create checksum file +# uses: hypertrace/github-actions/checksum@main +# +# - name: Cache packages +# id: cache-packages +# uses: actions/cache@v2 +# with: +# path: ~/.gradle +# key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} +# restore-keys: | +# gradle-packages-${{ runner.os }}-${{ github.job }} +# gradle-packages-${{ runner.os }} +# +# - name: smoke-test +# run: make smoke-test SMOKE_TEST_SUITE=${{ matrix.suite }} +# env: +# JVM_OPTS: -Xmx1g +# TERM: dumb + release: +# needs: [ test, smoke-test ] runs-on: ubuntu-20.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation @@ -28,41 +90,31 @@ jobs: gradle-packages-${{ runner.os }}-${{ github.job }} gradle-packages-${{ runner.os }} -# - name: build -# run: make build -# env: -# JVM_OPTS: -Xmx1g -# TERM: dumb + - name: Release jars + run: | + echo "Releasing version:" && ./gradlew printVersion clean + ./gradlew -PsigningKey=$(echo $SIGNING_KEY | base64 -d) publish + ./gradlew closeAndReleaseRepository + env: + JVM_OPTS: -Xmx1g + TERM: dumb + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }} + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }} + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} + SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} -# - name: Set signing key -# run: echo "ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d)" >> $GITHUB_ENV -# env: -# SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} -# -# - name: Print signing key -# run: echo $ORG_GRADLE_PROJECT_signingKey + - name: Release docker image + run: | + echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin + DOCKER_TAG=${GITHUB_REF##*/} make docker docker-push + env: + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }} + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }} -# - name: publish to maven -# run: ./gradlew publish closeAndReleaseRepository -# env: -# JVM_OPTS: -Xmx1g -# TERM: dumb -# ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }} -# ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }} -# ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }} -# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} -# SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} -# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }} -# -# - name: Set release version env -# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV -# -# - name: List build artifacts -# run: ls ./javaagent/build/libs -# -# - name: Create github release -# uses: fnkr/github-action-ghr@v1 -# if: startsWith(github.ref, 'refs/tags/') -# env: -# GHR_PATH: ./javaagent/build/libs -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload jars to release page + run: | + export TAG=${GITHUB_REF##*/} + gh release create ${TAG} --title "Release ${TAG}" javaagent/build/libs/*-all.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 9ea1017ab..a6362009b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![CircleCI](https://circleci.com/gh/hypertrace/javaagent.svg?style=svg&circle-token=b562d40d95cc5906f445004c4a96b666250d260b)](https://circleci.com/gh/hypertrace/javaagent) - # Hypertrace OpenTelemetry Java agent Hypertrace distribution of [OpenTelemetry Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation). diff --git a/RELEASE.md b/RELEASE.md index 47f87be95..6d2c31cae 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -17,23 +17,11 @@ the last tag version with `-SNAPSHOT` is used. ## Release CI job -The release CI job performs the following actions: -1. creates git tag for the next version -2. publishes artifacts to remove github repository with the new version -3. pushes the new git tag to the origin repository +The release CI job performs following actions: +1. runs unit and smoke tests +2. publishes java artifacts to maven repository +3. publishes docker image +4. creates GitHub release and uploads java agent to assets Run `./gradlew publishToMavenLocal` and `ls ~/.m2/repository/org/hypertrace/agent` to find out which artifacts are being published. - -## Configuration - -* Add SSH key - * Generate SSH key `ssh-keygen -t rsa -b 4096 -m PEM -C ` without passphrase - * Add private key to CircleCI project settings with `github.com` domain: https://app.circleci.com/settings/project/github/hypertrace/javaagent/ssh - * Add public key to Github project deploy keys and check "allow write access" https://github.com/hypertrace/javaagent/settings/keys - * Add fingerprint from CircleCI project settings to `./circleci/config.yml` -* Configure CI to release on `release-` tag or merge to the main branch. -* Configure CI to have access to bintray. E.g. add `hypertrace-publishing` context to the publish job. -* Configure gradle - * Add `org.hypertrace.version-settings` [Hypertrace version plugin](https://github.com/hypertrace/hypertrace-gradle-version-settings-plugin) - * Add `org.hypertrace.publish-plugin` [Hypertrace publish plugin](https://github.com/hypertrace/hypertrace-gradle-publish-plugin) diff --git a/build.gradle.kts b/build.gradle.kts index 84fbc5f0c..09f5c907e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.hypertrace.gradle.publishing.License.APACHE_2_0; plugins { `java-library` id("com.diffplug.spotless") version "5.2.0" apply false - id("org.hypertrace.publish-maven-central-plugin") version "1.0.2" apply false + id("org.hypertrace.publish-maven-central-plugin") version "1.0.4" apply false id("org.hypertrace.ci-utils-plugin") version "0.3.0" id("org.gradle.test-retry") version "1.2.0" apply false } From 5da98ef9644d67f016378055e3b2b80f2b4b6323 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Mon, 12 Jul 2021 18:09:14 +0200 Subject: [PATCH 2/5] Fix Signed-off-by: Pavol Loffay --- .github/workflows/release.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 02b66830c..1c7c4405e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -93,8 +93,7 @@ jobs: - name: Release jars run: | echo "Releasing version:" && ./gradlew printVersion clean - ./gradlew -PsigningKey=$(echo $SIGNING_KEY | base64 -d) publish - ./gradlew closeAndReleaseRepository + ./gradlew -PsigningKey=$(echo $SIGNING_KEY | base64 -d) publishToMavenLocal env: JVM_OPTS: -Xmx1g TERM: dumb From 85db2970ae813725872312c98751f9da776d2a36 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Mon, 12 Jul 2021 18:25:17 +0200 Subject: [PATCH 3/5] Fix Signed-off-by: Pavol Loffay --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1c7c4405e..43229422d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -93,7 +93,7 @@ jobs: - name: Release jars run: | echo "Releasing version:" && ./gradlew printVersion clean - ./gradlew -PsigningKey=$(echo $SIGNING_KEY | base64 -d) publishToMavenLocal + ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d) ./gradlew publishToMavenLocal env: JVM_OPTS: -Xmx1g TERM: dumb From c32567b565e4d61eb323c446672f497b20a3b7b3 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Mon, 12 Jul 2021 18:37:14 +0200 Subject: [PATCH 4/5] Fix Signed-off-by: Pavol Loffay --- .github/workflows/release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 43229422d..932186f57 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -93,7 +93,8 @@ jobs: - name: Release jars run: | echo "Releasing version:" && ./gradlew printVersion clean - ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d) ./gradlew publishToMavenLocal + ORG_GRADLE_PROJECT_signingKey=$(echo $SIGNING_KEY | base64 -d) ./gradlew publish + ./gradlew closeAndReleaseRepository env: JVM_OPTS: -Xmx1g TERM: dumb From ae9410c6aa8cea5001b67c74f2ead58f0e417603 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Mon, 12 Jul 2021 19:06:54 +0200 Subject: [PATCH 5/5] enable others Signed-off-by: Pavol Loffay --- .github/workflows/release.yaml | 124 ++++++++++++++++----------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 932186f57..552ebcabc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,70 +4,70 @@ on: tags: ['^[0-9]+\.[0-9]+\.[0-9]+'] jobs: -# test: -# runs-on: ubuntu-20.04 -# steps: -# # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation -# - name: Check out code -# uses: actions/checkout@v2.3.4 -# with: -# fetch-depth: 0 -# submodules: true -# -# - name: create checksum file -# uses: hypertrace/github-actions/checksum@main -# -# - name: Cache packages -# id: cache-packages -# uses: actions/cache@v2 -# with: -# path: ~/.gradle -# key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} -# restore-keys: | -# gradle-packages-${{ runner.os }}-${{ github.job }} -# gradle-packages-${{ runner.os }} -# -# - name: build -# run: make build -# env: -# JVM_OPTS: -Xmx1g -# TERM: dumb -# -# smoke-test: -# runs-on: ubuntu-20.04 -# strategy: -# matrix: -# suite: [ "glassfish", "jetty", "liberty", "tomcat", "tomee", "wildfly", "other" ] -# fail-fast: true -# steps: -# # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation -# - name: Check out code -# uses: actions/checkout@v2.3.4 -# with: -# fetch-depth: 0 -# submodules: true -# -# - name: create checksum file -# uses: hypertrace/github-actions/checksum@main -# -# - name: Cache packages -# id: cache-packages -# uses: actions/cache@v2 -# with: -# path: ~/.gradle -# key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} -# restore-keys: | -# gradle-packages-${{ runner.os }}-${{ github.job }} -# gradle-packages-${{ runner.os }} -# -# - name: smoke-test -# run: make smoke-test SMOKE_TEST_SUITE=${{ matrix.suite }} -# env: -# JVM_OPTS: -Xmx1g -# TERM: dumb + test: + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + submodules: true + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: build + run: make build + env: + JVM_OPTS: -Xmx1g + TERM: dumb + + smoke-test: + runs-on: ubuntu-20.04 + strategy: + matrix: + suite: [ "glassfish", "jetty", "liberty", "tomcat", "tomee", "wildfly", "other" ] + fail-fast: true + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + submodules: true + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle + key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} + restore-keys: | + gradle-packages-${{ runner.os }}-${{ github.job }} + gradle-packages-${{ runner.os }} + + - name: smoke-test + run: make smoke-test SMOKE_TEST_SUITE=${{ matrix.suite }} + env: + JVM_OPTS: -Xmx1g + TERM: dumb release: -# needs: [ test, smoke-test ] + needs: [ test, smoke-test ] runs-on: ubuntu-20.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation