From bf0c1a3dccf7b5e56d88dbcefc7184e3a8e69b8f Mon Sep 17 00:00:00 2001 From: Yash Joshi Date: Fri, 25 Jun 2021 23:49:53 +0530 Subject: [PATCH 1/4] chore: fix tsconfig to support webpack alias (#175) --- frontend/tsconfig.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 824a8b0d55..c2509fb541 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -16,7 +16,10 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true - }, - "include": ["src"] + "noEmit": true, + "baseUrl": ".", + "paths": { + "Src/*": ["./src/*"] + } + } } From 09586faed28a6716f5e2852a272c5ae9b944f323 Mon Sep 17 00:00:00 2001 From: Raj Babu Das Date: Fri, 25 Jun 2021 23:54:21 +0530 Subject: [PATCH 2/4] Adding CI pipeline with github workflow for query service, frontend, flattener (#173) * Adding github workflow for signoz Signed-off-by: rajdas98 * Adding github workflow for signoz Signed-off-by: rajdas98 * minor fix Signed-off-by: rajdas98 * minor fix Signed-off-by: rajdas98 * changing branch name from master to main Signed-off-by: rajdas98 --- .github/workflows/README.md | 25 +++++++ .github/workflows/build.yaml | 70 +++++++++++++++++++ .github/workflows/push.yaml | 128 +++++++++++++++++++++++++++++++++++ frontend/yarn.lock | 2 +- 4 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/push.yaml diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000000..2535ecc9bb --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,25 @@ +To Run github workflow, few environment varibale needs to added in github secrets + +#### Tunables + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000000..7298787d8a --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,70 @@ +name: build-pipeline +on: + pull_request: + branches: + - main + - v* + paths: + - 'pkg/**' + - 'frontend/**' + +jobs: + get_filters: + runs-on: ubuntu-latest + # Set job outputs to values from filter step + outputs: + frontend: ${{ steps.filter.outputs.frontend }} + query-service: ${{ steps.filter.outputs.query-service }} + flattener: ${{ steps.filter.outputs.flattener }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + frontend: + - 'frontend/**' + query-service: + - 'pkg/query-service/**' + flattener: + - 'pkg/processors/flattener/**' + + build-frontend: + runs-on: ubuntu-latest + needs: + - get_filters + if: ${{ needs.get_filters.outputs.frontend == 'true' }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build frontend docker image + shell: bash + run: | + cd frontend + docker build . -f Dockerfile + build-query-service: + runs-on: ubuntu-latest + needs: + - get_filters + if: ${{ needs.get_filters.outputs.query-service == 'true' }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build query-service image + shell: bash + run: | + cd pkg/query-service + docker build . -f Dockerfile + build-flattener: + runs-on: ubuntu-latest + needs: + - get_filters + if: ${{ needs.get_filters.outputs.flattener == 'true' }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build flattener docker image + shell: bash + run: | + cd pkg/processors/flattener + docker build . -f Dockerfile diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 0000000000..15e6ee7191 --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,128 @@ +name: push-pipeline +on: + push: + branches: + - main + - ^v[0-9]*.[0-9]*.x$ + tags: + - "*" + +jobs: + get-envs: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - shell: bash + run: | + img_tag="" + array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`) + if [ ${array[1]} == "tags" ] + then + echo "tag build" + img_tag=${GITHUB_REF#refs/*/} + else + echo "non tag build" + img_tag="latest" + fi + # This is a condition where image tag looks like "pull/" during pull request build + NEW_IMG_TAG=`echo $img_tag | sed "s/\//-/g"` + echo $NEW_IMG_TAG + echo export IMG_TAG=$NEW_IMG_TAG >> env-vars + echo export FRONTEND_IMAGE="frontend" >> env-vars + echo export QUERY_SERVICE="query-service" >> env-vars + echo export FLATTENER_PROCESSOR="flattener-processor" >> env-vars + - name: Uploading envs + uses: actions/upload-artifact@v2 + with: + name: env_artifact + path: env-vars + + build-and-push-frontend: + runs-on: ubuntu-latest + needs: + - get-envs + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build frontend docker image + shell: bash + run: | + cd frontend + docker build . -f Dockerfile + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push frontend docker image + shell: bash + run: | + branch=${GITHUB_REF#refs/*/} + array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`) + if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]] + then + source env-vars + docker push ${{ secrets.REPONAME }}/${FRONTEND_IMAGE}:${IMG_TAG} + fi + + build-and-push-query-service: + runs-on: ubuntu-latest + needs: + - get-envs + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build query-service image + shell: bash + run: | + cd pkg/query-service + docker build . -f Dockerfile + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push query service docker image + shell: bash + run: | + branch=${GITHUB_REF#refs/*/} + array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`) + if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]] + then + source env-vars + docker push ${{ secrets.REPONAME }}/${QUERY_SERVICE}:${IMG_TAG} + fi + + build-and-push-flattener: + runs-on: ubuntu-latest + needs: + - get-envs + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build flattener docker image + shell: bash + run: | + cd pkg/processors/flattener + docker build . -f Dockerfile + - name: Build flattener processor docker image + shell: bash + run: | + cd pkg/query-service + docker build . -f Dockerfile + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push flattener processor docker image + shell: bash + run: | + branch=${GITHUB_REF#refs/*/} + array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`) + if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]] + then + source env-vars + docker push ${{ secrets.REPONAME }}/${FLATTENER_PROCESSOR}:${IMG_TAG} + fi \ No newline at end of file diff --git a/frontend/yarn.lock b/frontend/yarn.lock index edc1d1c91f..98cc2d8949 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -14277,4 +14277,4 @@ yargs@~3.10.0: yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== \ No newline at end of file From 0c12eaf89b2a70a8c936bf505d389a39cf08b022 Mon Sep 17 00:00:00 2001 From: Raj Babu Das Date: Sat, 26 Jun 2021 00:44:13 +0530 Subject: [PATCH 3/4] adding download env step in github workflow (#189) * adding download env step in github workflow Signed-off-by: rajdas98 * adding download env step in github workflow Signed-off-by: rajdas98 --- .github/workflows/README.md | 4 ++-- .github/workflows/push.yaml | 31 ++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 2535ecc9bb..6486823672 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,6 +1,6 @@ -To Run github workflow, few environment varibale needs to added in github secrets +To run GitHub workflow, a few environment variables needs to add in GitHub secrets -#### Tunables +#### Environment Variables
Variables Description Example
REPONAME Provide the DockerHub user/organisation name of the image. signoz
DOCKERHUB_USERNAME Docker hub username signoz
DOCKERHUB_TOKEN Docker hub password/token with push permission ****
diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 15e6ee7191..2adc8bbfd9 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -32,11 +32,12 @@ jobs: echo export FRONTEND_IMAGE="frontend" >> env-vars echo export QUERY_SERVICE="query-service" >> env-vars echo export FLATTENER_PROCESSOR="flattener-processor" >> env-vars + - name: Uploading envs uses: actions/upload-artifact@v2 with: name: env_artifact - path: env-vars + path: signoz/env-vars build-and-push-frontend: runs-on: ubuntu-latest @@ -45,16 +46,25 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + + - name: Downloading image artficate + uses: actions/download-artifact@v2 + with: + name: env_artifact + path: signoz + - name: Build frontend docker image shell: bash run: | cd frontend docker build . -f Dockerfile + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push frontend docker image shell: bash run: | @@ -73,16 +83,25 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + + - name: Downloading image artficate + uses: actions/download-artifact@v2 + with: + name: env_artifact + path: signoz + - name: Build query-service image shell: bash run: | cd pkg/query-service docker build . -f Dockerfile + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push query service docker image shell: bash run: | @@ -101,21 +120,31 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + + - name: Downloading image artficate + uses: actions/download-artifact@v2 + with: + name: env_artifact + path: signoz + - name: Build flattener docker image shell: bash run: | cd pkg/processors/flattener docker build . -f Dockerfile + - name: Build flattener processor docker image shell: bash run: | cd pkg/query-service docker build . -f Dockerfile + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push flattener processor docker image shell: bash run: | From 1d5ce423f29bd2599ba6880e8f60a5f1fe4b4598 Mon Sep 17 00:00:00 2001 From: Raj Babu Das Date: Sat, 26 Jun 2021 18:10:23 +0530 Subject: [PATCH 4/4] Fixing github workflow push pipeline (#190) * adding download env step in github workflow Signed-off-by: rajdas98 * adding download env step in github workflow Signed-off-by: rajdas98 --- .github/workflows/push.yaml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 2adc8bbfd9..8b5cd4a78e 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -37,7 +37,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: env_artifact - path: signoz/env-vars + path: env-vars build-and-push-frontend: runs-on: ubuntu-latest @@ -47,17 +47,17 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Downloading image artficate + - name: Downloading image artifact uses: actions/download-artifact@v2 with: name: env_artifact - path: signoz - name: Build frontend docker image shell: bash run: | + source env-vars cd frontend - docker build . -f Dockerfile + docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FRONTEND_IMAGE}:${IMG_TAG} - name: Login to DockerHub uses: docker/login-action@v1 @@ -84,17 +84,17 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Downloading image artficate + - name: Downloading image artifact uses: actions/download-artifact@v2 with: name: env_artifact - path: signoz - name: Build query-service image shell: bash run: | + source env-vars cd pkg/query-service - docker build . -f Dockerfile + docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${QUERY_SERVICE}:${IMG_TAG} - name: Login to DockerHub uses: docker/login-action@v1 @@ -121,23 +121,17 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Downloading image artficate + - name: Downloading image artifact uses: actions/download-artifact@v2 with: name: env_artifact - path: signoz - name: Build flattener docker image shell: bash run: | + source env-vars cd pkg/processors/flattener - docker build . -f Dockerfile - - - name: Build flattener processor docker image - shell: bash - run: | - cd pkg/query-service - docker build . -f Dockerfile + docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FLATTENER_PROCESSOR}:${IMG_TAG} - name: Login to DockerHub uses: docker/login-action@v1