From ebb1f7169cd63f39de17ae8e1b576f9b779e24c1 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 12:36:32 +0530 Subject: [PATCH 1/5] removes cci --- .github/CODEOWNERS | 3 ++ .github/PULL_REQUEST_TEMPLATE.md | 25 +++++++++++++ .github/merge-publish.yml | 42 ++++++++++++++++++++++ .github/pr-build.yml | 57 ++++++++++++++++++++++++++++++ .github/publish.yml | 60 ++++++++++++++++++++++++++++++++ docker/build.gradle.kts | 4 +-- 6 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/merge-publish.yml create mode 100644 .github/pr-build.yml create mode 100644 .github/publish.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3d41425..69d8499 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,3 +2,6 @@ # global * @buchi-busireddy @aaron-steinfeld @tim-mwangi @ravisingal @laxmanchekka + +# GH action +.github/ @aaron-steinfeld @jbahire @kotharironak @buchi-busireddy \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a8e827b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +## Description +Please include a summary of the change, motivation and context. + + + + +### Testing +Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally. + +### Checklist: +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] Any dependent changes have been merged and published in downstream modules + +### Documentation +Make sure that you have documented corresponding changes in this repository or [hypertrace docs repo](https://github.com/hypertrace/hypertrace-docs-website) if required. + + diff --git a/.github/merge-publish.yml b/.github/merge-publish.yml new file mode 100644 index 0000000..f4b5e83 --- /dev/null +++ b/.github/merge-publish.yml @@ -0,0 +1,42 @@ +name: merge-publish +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + merge-publish: + 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 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: 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: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_READ_USER }} + password: ${{ secrets.DOCKERHUB_READ_TOKEN }} + + - name: push docker image + uses: hypertrace/github-actions/gradle@main + with: + args: dockerPushImages + env: + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }} + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }} diff --git a/.github/pr-build.yml b/.github/pr-build.yml new file mode 100644 index 0000000..0cc0c93 --- /dev/null +++ b/.github/pr-build.yml @@ -0,0 +1,57 @@ +name: build and validate +on: + push: + branches: + - main + pull_request_target: + branches: + - main + +jobs: + build: + 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: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: 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: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_READ_USER }} + password: ${{ secrets.DOCKERHUB_READ_TOKEN }} + + - name: Build with Gradle + uses: hypertrace/github-actions/gradle@main + with: + args: build dockerBuildImages + + validate-helm-charts: + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v2.3.4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + + - name: validate charts + uses: hypertrace/github-actions/validate-charts@main + diff --git a/.github/publish.yml b/.github/publish.yml new file mode 100644 index 0000000..4941d12 --- /dev/null +++ b/.github/publish.yml @@ -0,0 +1,60 @@ +name: Publish artifacts +on: +# Will only run when release is published. + release: + types: + - created + workflow_dispatch: + +jobs: + publish-artifacts: + 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 + + - name: create checksum file + uses: hypertrace/github-actions/checksum@main + + - name: 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: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_READ_USER }} + password: ${{ secrets.DOCKERHUB_READ_TOKEN }} + + - name: publish docker image + uses: hypertrace/github-actions/gradle@main + with: + args: dockerPushImages + env: + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }} + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }} + + publish-helm-charts: + needs: publish-artifacts + runs-on: ubuntu-20.04 + steps: + # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation + - name: Checkout Repository + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + + - name: package and release charts + uses: hypertrace/github-actions/helm-gcs-publish@main + with: + helm-gcs-credentials: ${{ secrets.HELM_GCS_CREDENTIALS }} + helm-gcs-repository: ${{ secrets.HELM_GCS_REPOSITORY }} + diff --git a/docker/build.gradle.kts b/docker/build.gradle.kts index eab636b..dc17b15 100644 --- a/docker/build.gradle.kts +++ b/docker/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("org.hypertrace.docker-plugin") version "0.7.1" - id("org.hypertrace.docker-publish-plugin") version "0.7.1" + id("org.hypertrace.docker-plugin") version "0.8.1" + id("org.hypertrace.docker-publish-plugin") version "0.8.1" } hypertraceDocker { From f2e632cd73c991940b2bc19de3144192d0a889ca Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 12:37:22 +0530 Subject: [PATCH 2/5] adds gha --- .circleci/config.yml | 137 ------------------------------------------- 1 file changed, 137 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ab57319..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,137 +0,0 @@ -version: 2.1 - -executors: - gradle_docker: - docker: - # This image isn't used to build Java project, rather to invoke Docker with Gradle. - # The version of Docker on cimg/openjdk tends to be slightly behind cimg/base. - - image: cimg/openjdk:14.0.2 - helm: - docker: - - image: hypertrace/helm-gcs-packager:0.3.0 - -commands: - gradle: - description: 'Run the provided gradle command' - parameters: - args: - type: string - when: - default: "on_success" - type: enum - enum: ["on_fail", "on_success", "always"] - steps: - - run: - name: << parameters.args >> - command: ./gradlew << parameters.args >> --info --max-workers=2 -Dorg.gradle.jvmargs=-Xmx2g -Dorg.gradle.console=plain - when: << parameters.when >> - setup_build_environment: - description: 'Checkout, restore the cache, and setup docker' - steps: - - checkout - - restore_cache: - keys: # Use gradle version for cache, so it doesn't download every time - - v1-dependencies-{{ checksum "./gradle/wrapper/gradle-wrapper.properties" }} - # The remote docker version is independent from what's installed in the gradle_docker image and defaults to Docker 17. - # Use the latest value from https://circleci.com/docs/2.0/building-docker-images/#docker-version - - setup_remote_docker: - version: 19.03.12 - save_populated_cache: - description: "Save the gradle binary to the cache so it doesn't have to redownload" - steps: - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "./gradle/wrapper/gradle-wrapper.properties" }} - -jobs: - build: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerBuildImages - - save_populated_cache - merge-publish: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerPushImages - release-publish: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerPushImages - validate-charts: - executor: helm - steps: - - checkout - - run: - name: Helm Charts Lint and Template Render - command: | - helm lint --strict ./helm/ - helm template ./helm/ - release-charts: - executor: helm - steps: - - checkout - - run: - name: Add release tag - command: | - git config --global user.email "${CIRCLE_USERNAME}@hypertrace.org" - git config --global user.name "$CIRCLE_USERNAME" - git tag -am "Released by $CIRCLE_USERNAME" $(git describe --abbrev=0 --tags | sed 's/^release-//') - - run: - name: Remove trigger tag - command: git tag -d release-$(git describe --abbrev=0) - - run: - name: Package and Publish Helm Charts - # Read the "name:" from Chart.yaml. The chart version is - - command: | - CHART_VERSION=$(git describe --abbrev=0) - CHART_NAME=$(awk '/^name:/ {print $2}' ./helm/Chart.yaml) - export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/helm-gcs-key.json - echo ${HELM_GCS_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS} - helm repo add helm-gcs ${HELM_GCS_REPOSITORY} - helm package --version ${CHART_VERSION} --app-version ${CHART_VERSION} ./helm/ - helm gcs push ${CHART_NAME}-${CHART_VERSION}.tgz helm-gcs --public --retry - - add_ssh_keys: - fingerprints: - - '95:da:b2:1c:45:1b:b1:a9:c6:20:be:b2:e5:95:6e:a6' - - run: - name: Update remote tags - command: git push origin refs/tags/$(git describe --abbrev=0) :refs/tags/release-$(git describe --abbrev=0) - -workflows: - version: 2 - build-and-publish: - jobs: - - build - - validate-charts - - merge-publish: - context: hypertrace-publishing - requires: - - build - - validate-charts - filters: - branches: - only: - - main - - release-publish: - context: hypertrace-publishing - filters: - branches: - ignore: /.*/ - tags: - only: /^release-.*/ - - release-charts: - context: hypertrace-publishing - requires: - - release-publish - filters: - branches: - ignore: /.*/ - tags: - only: /^release-.*/ From f7dd880fcc0225d4e52666dadc1ab3c1b7c70dd4 Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 12:48:20 +0530 Subject: [PATCH 3/5] removes cci --- .circleci/config.yml | 156 ------------------------------------------- 1 file changed, 156 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ff5ec97..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,156 +0,0 @@ -version: 2.1 - -executors: - gradle_docker: - docker: - # This image isn't used to build Java project, rather to invoke Docker with Gradle. - # The version of Docker on cimg/openjdk tends to be slightly behind cimg/base. - - image: cimg/openjdk:14.0.2 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - helm: - docker: - - image: hypertrace/helm-gcs-packager:0.3.0 - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - -commands: - gradle: - description: 'Run the provided gradle command' - parameters: - args: - type: string - when: - default: "on_success" - type: enum - enum: ["on_fail", "on_success", "always"] - steps: - - run: - name: << parameters.args >> - command: ./gradlew << parameters.args >> --info --max-workers=2 -Dorg.gradle.jvmargs=-Xmx2g -Dorg.gradle.console=plain - when: << parameters.when >> - setup_build_environment: - description: 'Checkout, restore the cache, and setup docker' - steps: - - checkout - - restore_cache: - keys: # Use gradle version for cache, so it doesn't download every time - - v1-dependencies-{{ checksum "./gradle/wrapper/gradle-wrapper.properties" }} - # The remote docker version is independent from what's installed in the gradle_docker image and defaults to Docker 17. - # Use the latest value from https://circleci.com/docs/2.0/building-docker-images/#docker-version - - setup_remote_docker: - version: 19.03.12 - - run: - name: Dockerhub login - command: echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin - save_populated_cache: - description: "Save the gradle binary to the cache so it doesn't have to redownload" - steps: - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "./gradle/wrapper/gradle-wrapper.properties" }} - -jobs: - build: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerBuildImages - - save_populated_cache - merge-publish: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerPushImages - release-publish: - executor: gradle_docker - steps: - - setup_build_environment - - gradle: - args: dockerPushImages - validate-charts: - executor: helm - steps: - - checkout - - run: - name: Helm Charts Lint and Template Render - command: | - helm lint --strict ./helm/ - helm template ./helm/ - release-charts: - executor: helm - steps: - - checkout - - run: - name: Add release tag - command: | - git config --global user.email "${CIRCLE_USERNAME}@hypertrace.org" - git config --global user.name "$CIRCLE_USERNAME" - git tag -am "Released by $CIRCLE_USERNAME" $(git describe --abbrev=0 --tags | sed 's/^release-//') - - run: - name: Remove trigger tag - command: git tag -d release-$(git describe --abbrev=0) - - run: - name: Package and Publish Helm Charts - # Read the "name:" from Chart.yaml. The chart version is - - command: | - CHART_VERSION=$(git describe --abbrev=0) - CHART_NAME=$(awk '/^name:/ {print $2}' ./helm/Chart.yaml) - export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/helm-gcs-key.json - echo ${HELM_GCS_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS} - helm repo add helm-gcs ${HELM_GCS_REPOSITORY} - helm package --version ${CHART_VERSION} --app-version ${CHART_VERSION} ./helm/ - helm gcs push ${CHART_NAME}-${CHART_VERSION}.tgz helm-gcs --public --retry - - add_ssh_keys: - fingerprints: - - '95:da:b2:1c:45:1b:b1:a9:c6:20:be:b2:e5:95:6e:a6' - - run: - name: Update remote tags - command: git push origin refs/tags/$(git describe --abbrev=0) :refs/tags/release-$(git describe --abbrev=0) - -workflows: - version: 2 - build-and-publish: - jobs: - - build: - context: - - dockerhub-read - - validate-charts: - context: - - dockerhub-read - - merge-publish: - context: - - hypertrace-publishing - - dockerhub-read - requires: - - build - - validate-charts - filters: - branches: - only: - - main - - release-publish: - context: - - hypertrace-publishing - - dockerhub-read - filters: - branches: - ignore: /.*/ - tags: - only: /^release-.*/ - - release-charts: - context: - - hypertrace-publishing - - dockerhub-read - requires: - - release-publish - filters: - branches: - ignore: /.*/ - tags: - only: /^release-.*/ From 55671a24c13b0c940ea0b9ba33683f0164a12d3a Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 13:22:43 +0530 Subject: [PATCH 4/5] directory --- .github/{ => workflows}/merge-publish.yml | 0 .github/{ => workflows}/pr-build.yml | 0 .github/{ => workflows}/publish.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/merge-publish.yml (100%) rename .github/{ => workflows}/pr-build.yml (100%) rename .github/{ => workflows}/publish.yml (100%) diff --git a/.github/merge-publish.yml b/.github/workflows/merge-publish.yml similarity index 100% rename from .github/merge-publish.yml rename to .github/workflows/merge-publish.yml diff --git a/.github/pr-build.yml b/.github/workflows/pr-build.yml similarity index 100% rename from .github/pr-build.yml rename to .github/workflows/pr-build.yml diff --git a/.github/publish.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/publish.yml rename to .github/workflows/publish.yml From d4d3304e4b01e07f00e491c0a700313b3579436c Mon Sep 17 00:00:00 2001 From: Jayesh Bapu Ahire Date: Thu, 7 Jan 2021 20:26:46 +0530 Subject: [PATCH 5/5] addressed aaron's comments on kafka --- .github/workflows/pr-build.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 0cc0c93..0875e53 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -3,7 +3,7 @@ on: push: branches: - main - pull_request_target: + pull_request: branches: - main @@ -15,8 +15,6 @@ jobs: - name: Check out code uses: actions/checkout@v2.3.4 with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - name: create checksum file @@ -30,12 +28,6 @@ jobs: restore-keys: | gradle-packages-${{ runner.os }}-${{ github.job }} gradle-packages-${{ runner.os }} - - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_READ_USER }} - password: ${{ secrets.DOCKERHUB_READ_TOKEN }} - name: Build with Gradle uses: hypertrace/github-actions/gradle@main @@ -48,8 +40,6 @@ jobs: - name: Check out code uses: actions/checkout@v2.3.4 with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - name: validate charts