diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e5ffe09663..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,247 +0,0 @@ -# Java Gradle CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details -# -version: 2.1 - -# ############################################################### -# Commands -commands: - attach_repo: - steps: - - attach_workspace: - at: ~/inspectit - build_and_test_agent: - steps: - - run: cd repo && ./gradlew assemble --max-workers=2 --no-daemon - - run: cd repo && ./gradlew test --max-workers=2 --no-daemon - - run: cd repo && ./gradlew systemTest --max-workers=2 --no-daemon - - store_test_results: - path: ~/inspectit/repo/inspectit-ocelot-agent/build/test-results - - store_test_results: - path: ~/inspectit/repo/inspectit-ocelot-core/build/test-results - - store_test_results: - path: ~/inspectit/repo/inspectit-ocelot-config/build/test-results - - store_test_results: - path: ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/test-results - - store_artifacts: - path: /home/circleci/inspectit/repo/heapdump.bin - -# ############################################################### -# Jobs -jobs: - # Job for checking out the source code to build and test - checkout: - docker: - - image: circleci/openjdk:8-jdk - working_directory: ~/inspectit - steps: - - checkout: - path: ~/inspectit/repo - - persist_to_workspace: - root: ~/inspectit - paths: - - repo - - # Building the release artifacts (agent and demo) - build_release_artifacts: - docker: - - image: circleci/openjdk:8-jdk - working_directory: ~/inspectit - steps: - - attach_repo - - run: cd repo && ./gradlew assemble bootJarWithFrontend :inspectit-ocelot-core:cyclonedxBom :inspectit-ocelot-configurationserver:cyclonedxBom -PbuildVersion=${CIRCLE_TAG} - - run: mkdir artifacts - - run: cp ~/inspectit/repo/inspectit-ocelot-agent/build/inspectit-ocelot-agent-${CIRCLE_TAG}.jar ~/inspectit/artifacts - - run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/libs/inspectit-ocelot-configurationserver-${CIRCLE_TAG}.jar ~/inspectit/artifacts - - run: mkdir boms - - run: cp ~/inspectit/repo/inspectit-ocelot-core/build/reports/bom.json ~/inspectit/boms/inspectit-ocelot-agent-bom.json - - run: cp ~/inspectit/repo/inspectit-ocelot-core/build/reports/bom.xml ~/inspectit/boms/inspectit-ocelot-agent-bom.xml - - run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/reports/bom.json ~/inspectit/boms/inspectit-ocelot-configurationserver-bom.json - - run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/reports/bom.xml ~/inspectit/boms/inspectit-ocelot-configurationserver-bom.xml - - run: zip -r ~/inspectit/artifacts/software-bill-of-materials.zip boms - - run: - name: Calculate checksums of release artifacts - working_directory: ~/inspectit/artifacts - command: for f in *; do sha256sum "$f" >> inspectit-ocelot-sha256-checksums.txt; done - - persist_to_workspace: - root: ~/inspectit - paths: - - artifacts - - # Generates the changelog body sued for the Github release - generate_changelog: - docker: - - image: circleci/ruby:3.0 - working_directory: ~/inspectit - steps: - - attach_repo - - run: - command: | - sudo apt-get install jq - gem install bundler - gem install rspec - gem install github_changelog_generator - cd repo - chmod +x ./resources/github-release-script.sh - ./resources/github-release-script.sh - mkdir ~/inspectit/changelog - cp release_body.md ~/inspectit/changelog - - persist_to_workspace: - root: ~/inspectit - paths: - - changelog - - # Publish the release artifacts to Github and updates the release - publish_github_release: - docker: - - image: cibuilds/github:0.12 - working_directory: ~/inspectit - steps: - - attach_repo - - run: - name: "Publish Release on GitHub" - command: | - VERSION=${CIRCLE_TAG} - BODY=$(cat ~/inspectit/changelog/release_body.md) - ghr -t ${GITHUB_TOKEN} -u inspectIT -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "Version ${CIRCLE_TAG}" -b "${BODY}" ${VERSION} ~/inspectit/artifacts/ - - # Publish docker images - publish_docker_images: - docker: - - image: circleci/openjdk:8-jdk - working_directory: ~/inspectit - steps: - - attach_repo - - setup_remote_docker: - version: 20.10.12 - - run: cd repo && ./gradlew dockerTag -PbuildVersion=${CIRCLE_TAG} - - run: | - docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD - docker push inspectit/inspectit-ocelot-agent:${CIRCLE_TAG} - docker push inspectit/inspectit-ocelot-agent:latest - docker push inspectit/inspectit-ocelot-configurationserver:${CIRCLE_TAG} - docker push inspectit/inspectit-ocelot-configurationserver:latest - - # Deploy pre-release documentation - deploy-master-documentation: - docker: - - image: cimg/node:15.0.1 - working_directory: ~/inspectit - steps: - - attach_repo - - run: - name: Deploying to GitHub Pages - no_output_timeout: 20m - working_directory: ~/inspectit/repo/inspectit-ocelot-documentation/website - command: | - git config --global user.email "NTTechnicalUser@users.noreply.github.com" - git config --global user.name "NTTechnicalUser" - echo "machine github.com login NTTechnicalUser password $GITHUB_TOKEN" > ~/.netrc - npm install && GIT_USER=NTTechnicalUser CUSTOM_COMMIT_MESSAGE="[skip ci] Updated master documentation." npm run publish-gh-pages - - # Deploy pre-release documentation - deploy-release-documentation: - docker: - - image: cimg/node:15.0.1 - working_directory: ~/inspectit - steps: - - run: - name: Avoid hosts unknown for github - command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - - add_ssh_keys: - fingerprints: - - "9e:4e:80:f7:6b:34:39:48:88:02:f6:ff:40:c3:30:4c" - - run: - name: GitHub Login - command: | - git config --global user.email "NTTechnicalUser@users.noreply.github.com" - git config --global user.name "NTTechnicalUser" - git config --global push.default simple - echo "machine github.com login NTTechnicalUser password $GITHUB_TOKEN" > ~/.netrc - - run: - name: Checkout latest master branch for documentation - working_directory: ~/inspectit - command: | - git clone git@github.com:inspectIT/inspectit-ocelot.git . - - run: - name: Replace variables - working_directory: ~/inspectit/inspectit-ocelot-documentation/docs - command: | - find . -type f -print0 | xargs -0 sed -i 's/{inspectit-ocelot-version}/'"${CIRCLE_TAG}"'/g' - OPEN_CENSUS_VERSION=$(cat ../../gradle.properties | grep -oP '(?<=openCensusVersion=).*') - find . -type f -print0 | xargs -0 sed -i 's/{opencensus-version}/'"${OPEN_CENSUS_VERSION}"'/g' - - run: - name: Create new documentation version - working_directory: ~/inspectit/inspectit-ocelot-documentation/website - command: | - npm install - npm run version ${CIRCLE_TAG} - git add versions.json versioned_docs versioned_sidebars - git commit -m "[skip ci] Publish documentation v${CIRCLE_TAG}" - git push - - run: - name: Deploying to GitHub Pages - no_output_timeout: 20m - working_directory: ~/inspectit/inspectit-ocelot-documentation/website - command: | - GIT_USER=NTTechnicalUser CUSTOM_COMMIT_MESSAGE="[skip ci] Publish documentation v${CIRCLE_TAG}" npm run publish-gh-pages - -# ############################################### -# The defined workflows -workflows: - version: 2 - - # Workflow for deploying master documentation - deploy_documentation: - jobs: - - checkout - - deploy-master-documentation: - requires: - - checkout - filters: - branches: - only: master - - # Workflow for building and deploying releases based on tagged commits - # Note: you have to manually approve the workflow on CircleCI - release: - jobs: - - requesting-release-build: - type: approval - filters: &filter_release - branches: - ignore: /.*/ - tags: - only: /\d+\.\d+(\..+)?/ - - checkout: - filters: - <<: *filter_release - requires: - - requesting-release-build - - deploy-release-documentation: - filters: - <<: *filter_release - requires: - - checkout - - build_release_artifacts: - filters: - <<: *filter_release - requires: - - checkout - - generate_changelog: - filters: - <<: *filter_release - requires: - - checkout - - publish_github_release: - filters: - <<: *filter_release - requires: - - build_release_artifacts - - generate_changelog - - publish_docker_images: - filters: - <<: *filter_release - requires: - - publish_github_release diff --git a/.github/workflows/agent_test.yml b/.github/workflows/agent_test.yml index 169b96ec14..4b8249a662 100644 --- a/.github/workflows/agent_test.yml +++ b/.github/workflows/agent_test.yml @@ -14,6 +14,7 @@ on: - '**.txt' - '.github/**' - '.circleci/**' + workflow_call: jobs: pr-check: diff --git a/.github/workflows/changelog-release-config.json b/.github/workflows/changelog-release-config.json new file mode 100644 index 0000000000..27284ef4c0 --- /dev/null +++ b/.github/workflows/changelog-release-config.json @@ -0,0 +1,30 @@ +{ + "categories": [ + { + "title": "## ๐Ÿ›  Breaking Changes", + "labels": ["breaking-change"] + }, + { + "title": "## ๐Ÿš€ Implemented Enhancements", + "labels": ["feature", "enhancement"] + }, + { + "title": "## ๐Ÿ› Bugfixes", + "labels": ["fix", "bug"] + }, + { + "title": "## ๐Ÿงช Tests", + "labels": ["test"] + }, + { + "title": "## Other Changes", + "labels": ["*"] + } + ], + "sort": "ASC", + "template": "${{CHANGELOG}}", + "pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", + "empty_template": "- no changes", + "max_pull_requests": 1000, + "max_back_track_time_days": 1000 +} \ No newline at end of file diff --git a/.github/workflows/configdocsgenerator_test.yml b/.github/workflows/configdocsgenerator_test.yml index ef37e2c6f4..3ac03895e0 100644 --- a/.github/workflows/configdocsgenerator_test.yml +++ b/.github/workflows/configdocsgenerator_test.yml @@ -8,6 +8,8 @@ on: paths: - '.github/workflows/configdocsgenerator_test.yml' - 'components/inspectit-ocelot-configdocsgenerator/**' + workflow_call: + jobs: test: name: Test @@ -21,4 +23,4 @@ jobs: run: chmod +x gradlew - name: test run: ../../gradlew test - working-directory: ${{env.working-directory}} \ No newline at end of file + working-directory: ${{env.working-directory}} diff --git a/.github/workflows/configuration_ui_test.yml b/.github/workflows/configuration_ui_test.yml index 4bf7ae281d..a1cb7e28f0 100644 --- a/.github/workflows/configuration_ui_test.yml +++ b/.github/workflows/configuration_ui_test.yml @@ -7,6 +7,8 @@ on: pull_request: paths: - 'components/inspectit-ocelot-configurationserver-ui/**' + workflow_call: + jobs: test: @@ -33,4 +35,4 @@ jobs: - name: Run Prettier working-directory: ${{env.working-directory}} - run: yarn format \ No newline at end of file + run: yarn format diff --git a/.github/workflows/configurationserver_test.yml b/.github/workflows/configurationserver_test.yml index 597cb68657..4f8cf99998 100644 --- a/.github/workflows/configurationserver_test.yml +++ b/.github/workflows/configurationserver_test.yml @@ -9,6 +9,8 @@ on: - '.github/workflows/configurationserver_test.yml' - 'components/inspectit-ocelot-configurationserver/**' - '!components/inspectit-ocelot-configurationserver/README.md' + workflow_call: + jobs: test: name: Assemble & Test diff --git a/.github/workflows/deploy_master_docs.yml b/.github/workflows/deploy_master_docs.yml new file mode 100644 index 0000000000..1077b290c7 --- /dev/null +++ b/.github/workflows/deploy_master_docs.yml @@ -0,0 +1,38 @@ +name: Deploy Master Documentation + +on: + push: + branches: + - master + paths: + - inspectit-ocelot-documentation/** + +jobs: + + deploy_master_documentation: + name: "Publish Master Documentation" + runs-on: ubuntu-latest + defaults: + run: + working-directory: inspectit-ocelot-documentation/website + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + cache-dependency-path: 'inspectit-ocelot-documentation/website/yarn.lock' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Build website + run: yarn build + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./inspectit-ocelot-documentation/website/build/inspectit-ocelot + user_name: NTTechnicalUser + user_email: NTTechnicalUser@users.noreply.github.com + commit_message: "Updated master documentation" diff --git a/.github/workflows/docs_deployment_test.yml b/.github/workflows/docs_deployment_test.yml new file mode 100644 index 0000000000..b534e0dd21 --- /dev/null +++ b/.github/workflows/docs_deployment_test.yml @@ -0,0 +1,25 @@ +name: Test Documentation Deployment + +on: + pull_request: + branches: + - master + +jobs: + test-deploy: + name: Test deployment + runs-on: ubuntu-latest + defaults: + run: + working-directory: inspectit-ocelot-documentation/website + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + cache-dependency-path: 'inspectit-ocelot-documentation/website/yarn.lock' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test build website + run: yarn build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..fbf5afc04b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,127 @@ +name: Build and Release + +on: + push: + tags: + - "[0-9]*.[0-9]*.[0-9]**" + +jobs: + + agent_test: + uses: ./.github/workflows/agent_test.yml + + configdocsgenerator_test: + uses: ./.github/workflows/configdocsgenerator_test.yml + + configurationserver_test: + uses: ./.github/workflows/configurationserver_test.yml + + configuration_ui_test: + uses: ./.github/workflows/configuration_ui_test.yml + + build_and_release: + name: 'Build and Release' + runs-on: ubuntu-latest + environment: release + needs: [configdocsgenerator_test, configurationserver_test, configuration_ui_test] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build artifacts + run: | + ./gradlew assemble bootJarWithFrontend :inspectit-ocelot-core:cyclonedxBom :inspectit-ocelot-configurationserver:cyclonedxBom -PbuildVersion=${{ github.ref_name }} + mkdir artifacts + cp ./inspectit-ocelot-agent/build/inspectit-ocelot-agent-${{ github.ref_name }}.jar ./artifacts + cp ./components/inspectit-ocelot-configurationserver/build/libs/inspectit-ocelot-configurationserver-${{ github.ref_name }}.jar ./artifacts + mkdir boms + cp ./inspectit-ocelot-core/build/reports/bom.json ./boms/inspectit-ocelot-agent-bom.json + cp ./inspectit-ocelot-core/build/reports/bom.xml ./boms/inspectit-ocelot-agent-bom.xml + cp ./components/inspectit-ocelot-configurationserver/build/reports/bom.json ./boms/inspectit-ocelot-configurationserver-bom.json + cp ./components/inspectit-ocelot-configurationserver/build/reports/bom.xml ./boms/inspectit-ocelot-configurationserver-bom.xml + zip -r ./artifacts/software-bill-of-materials.zip ./boms + - name: Calculate checksums of release artifacts + working-directory: ./artifacts + run: for f in *; do sha256sum "$f" >> inspectit-ocelot-sha256-checksums.txt; done + - name: Build Changelog + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v3.5.0 + with: + # Config for the Changelog, reference: https://github.com/marketplace/actions/release-changelog-builder + configuration: ".github/workflows/changelog-release-config.json" + - name: Create Release + uses: softprops/action-gh-release@v0.1.14 + with: + tag_name: ${{ github.event.inputs.boomerang-version }} + files: artifacts/* + generate_release_notes: true + token: ${{ github.token }} + name: Version ${{ github.ref_name }} + body: | + "You can also find the corresponding documentation online under the following link: [inspectIT Ocelot Documentation](http://docs.inspectit.rocks)" + ${{ steps.build_changelog.outputs.changelog }} + + build_and_publish_docker_images: + name: "Build and Push Docker Images" + runs-on: ubuntu-latest + needs: build_and_release + environment: release + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build Docker Images + run: ./gradlew dockerTag -PbuildVersion=${{ github.ref_name }} + - name: Push Docker Images + run: | + docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} + docker push inspectit/inspectit-ocelot-agent:${{ github.ref_name }} + docker push inspectit/inspectit-ocelot-agent:latest + docker push inspectit/inspectit-ocelot-configurationserver:${{ github.ref_name }} + docker push inspectit/inspectit-ocelot-configurationserver:latest + + build_documentation: + name: "Build and Publish Release Documentation" + runs-on: ubuntu-latest + defaults: + run: + working-directory: inspectit-ocelot-documentation/website + needs: build_and_release + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + cache-dependency-path: 'inspectit-ocelot-documentation/website/yarn.lock' + - name: Replace Variables in Docs + working-directory: ./inspectit-ocelot-documentation/docs + run: | + find . -type f -print0 | xargs -0 sed -i 's/{inspectit-ocelot-version}/'"${{ github.ref_name }}"'/g' + OPEN_CENSUS_VERSION=$(cat ../../gradle.properties | grep -oP '(?<=openCensusVersion=).*') + find . -type f -print0 | xargs -0 sed -i 's/{opencensus-version}/'"${OPEN_CENSUS_VERSION}"'/g' + - name: Create new Documentation Version + run: | + npm install + npm run version ${{ github.ref_name }} + git add versions.json versioned_docs versioned_sidebars + git config --global user.name 'NTTechnicalUser' + git config --global user.email 'NTTechnicalUser@users.noreply.github.com' + git commit -m "Publish documentation for release ${{ github.ref_name }}" + git push -f origin HEAD:master + - name: Install Build Dependencies + run: yarn install --frozen-lockfile + - name: Build Website + run: yarn build + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./inspectit-ocelot-documentation/website/build/inspectit-ocelot + user_name: NTTechnicalUser + user_email: NTTechnicalUser@users.noreply.github.com + commit_message: Publish documentation for release ${{ github.ref_name }} diff --git a/components/inspectit-ocelot-configurationserver/build.gradle b/components/inspectit-ocelot-configurationserver/build.gradle index cabbf8e259..29c77663d8 100644 --- a/components/inspectit-ocelot-configurationserver/build.gradle +++ b/components/inspectit-ocelot-configurationserver/build.gradle @@ -1,7 +1,7 @@ plugins { id("com.github.node-gradle.node") version "2.2.1" id "com.moowork.node" version "1.3.1" - id 'com.palantir.docker' version "0.21.0" + id 'com.palantir.docker' version "0.34.0" id 'org.springframework.boot' version "${springBootVersion}" id "org.cyclonedx.bom" version "1.7.2" // Add the plugin in the existing plugins block @@ -172,8 +172,9 @@ task copyServerJar(type: Copy) { docker { name "inspectit/inspectit-ocelot-configurationserver" - tags "${version}" + dependsOn copyServerJar + + tag 'versioned', "hub.docker.com/${name}:${version}" dockerfile file('docker/Dockerfile') files 'docker/entrypoint.sh', "$buildDir/docker-jar/inspectit-ocelot-configurationserver.jar" } -docker.dependsOn copyServerJar diff --git a/components/inspectit-ocelot-configurationserver/docker/Dockerfile b/components/inspectit-ocelot-configurationserver/docker/Dockerfile index b33ed9942f..b9632097fe 100644 --- a/components/inspectit-ocelot-configurationserver/docker/Dockerfile +++ b/components/inspectit-ocelot-configurationserver/docker/Dockerfile @@ -1,4 +1,4 @@ FROM openjdk:11-jre-slim -COPY inspectit-ocelot-configurationserver.jar / -COPY entrypoint.sh / + +ADD ./ / ENTRYPOINT ["sh", "/entrypoint.sh"] \ No newline at end of file diff --git a/inspectit-ocelot-agent/build.gradle b/inspectit-ocelot-agent/build.gradle index ca81e4e46b..f20f47e123 100644 --- a/inspectit-ocelot-agent/build.gradle +++ b/inspectit-ocelot-agent/build.gradle @@ -1,7 +1,7 @@ plugins { id "me.champeau.gradle.jmh" version "0.5.3" id 'maven-publish' - id 'com.palantir.docker' version "0.21.0" + id 'com.palantir.docker' version "0.34.0" } evaluationDependsOn(':inspectit-ocelot-bootstrap') @@ -56,7 +56,7 @@ docker { dependsOn copyAgent name "inspectit/inspectit-ocelot-agent" - tags "${version}" + tag 'versioned', "hub.docker.com/${name}:${version}" dockerfile file('docker/Dockerfile') files 'docker/entrypoint.sh', "$buildDir/inspectit-ocelot-agent.jar" } @@ -327,4 +327,4 @@ jmh { timeOnIteration = '3s' fork = 1 } -tasks.jmh.dependsOn jar \ No newline at end of file +tasks.jmh.dependsOn jar diff --git a/inspectit-ocelot-agent/docker/Dockerfile b/inspectit-ocelot-agent/docker/Dockerfile index 68f82b6690..1b00c0eea2 100644 --- a/inspectit-ocelot-agent/docker/Dockerfile +++ b/inspectit-ocelot-agent/docker/Dockerfile @@ -1,8 +1,7 @@ FROM busybox -COPY inspectit-ocelot-agent.jar / +ADD ./ / RUN ln /inspectit-ocelot-agent.jar /javaagent.jar &&\ chmod -R go+r /javaagent.jar -COPY entrypoint.sh / ENTRYPOINT ["sh", "/entrypoint.sh"] \ No newline at end of file