Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/signoz/signoz into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitnayan committed Jun 27, 2021
2 parents c07f683 + 1d5ce42 commit 655f8b6
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
To run GitHub workflow, a few environment variables needs to add in GitHub secrets

#### Environment Variables

<table>
<tr>
<th> Variables </th>
<th> Description </th>
<th> Example </th>
</tr>
<tr>
<td> REPONAME </td>
<td> Provide the DockerHub user/organisation name of the image. </td>
<td> signoz</td>
</tr>
<tr>
<td> DOCKERHUB_USERNAME </td>
<td> Docker hub username </td>
<td> signoz</td>
</tr>
<tr>
<td> DOCKERHUB_TOKEN </td>
<td> Docker hub password/token with push permission </td>
<td> **** </td>
</tr>
70 changes: 70 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
151 changes: 151 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
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/<pullrequest-name>" 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: Downloading image artifact
uses: actions/download-artifact@v2
with:
name: env_artifact

- name: Build frontend docker image
shell: bash
run: |
source env-vars
cd frontend
docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FRONTEND_IMAGE}:${IMG_TAG}
- 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: Downloading image artifact
uses: actions/download-artifact@v2
with:
name: env_artifact

- name: Build query-service image
shell: bash
run: |
source env-vars
cd pkg/query-service
docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${QUERY_SERVICE}:${IMG_TAG}
- 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: Downloading image artifact
uses: actions/download-artifact@v2
with:
name: env_artifact

- name: Build flattener docker image
shell: bash
run: |
source env-vars
cd pkg/processors/flattener
docker build . -f Dockerfile -t ${{ secrets.REPONAME }}/${FLATTENER_PROCESSOR}:${IMG_TAG}
- 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
9 changes: 6 additions & 3 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
},
"include": ["src"]
"noEmit": true,
"baseUrl": ".",
"paths": {
"Src/*": ["./src/*"]
}
}
}
2 changes: 1 addition & 1 deletion frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==

0 comments on commit 655f8b6

Please sign in to comment.