Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

ci: adding 'push' workflow

Yoni Bettane555e05f586d
diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml
index facd460d08..288b956d92 100644
--- a/.github/workflows/push.yaml
+++ b/.github/workflows/push.yaml
@@ -1,172 +1,72 @@
-name: push-pipeline
+name: push
+
on:
push:
- branches:
- - main
- - ^v[0-9]*.[0-9]*.x$
- tags:
- - "*"
- # pull_request:
- # branches:
- # - main
- # - v*
- # paths:
- # - 'pkg/**'
- # - 'frontend/**'
-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/*/v}
- elif [ ${array[1]} == "pull" ]
- then
- img_tag="pull-${{ github.event.number }}"
- 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
+ paths:
+ - 'pkg/query-service/**'
+ - 'frontend/**'
- - name: Set up Docker Buildx
- id: buildx
- uses: docker/setup-buildx-action@v1
- with:
- version: latest
-
- - name: Login to DockerHub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- - name: Build & Push Frontend Docker Image
- shell: bash
- env:
- FRONTEND_DIRECTORY: "frontend"
- REPONAME: ${{ secrets.REPONAME }}
- FRONTEND_DOCKER_IMAGE: ${FRONTEND_IMAGE}
- DOCKER_TAG: ${IMG_TAG}
- run: |
- branch=${GITHUB_REF#refs/*/}
- array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
- if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [ ${array[1]} == "pull" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
- then
- source env-vars
- make build-push-frontend
- fi
+jobs:
- build-and-push-query-service:
+ image-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: Set up QEMU
+ uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
- id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - uses: benjlevesque/[email protected]
+ id: short-sha
+ - name: Get branch name
+ id: branch-name
+ uses: tj-actions/[email protected]
+ - name: Build and push docker image
+ env:
+ DOCKER_TAG: ${{ steps.short-sha.outputs.sha }}
+ DOCKER_SECOND_TAG: ${{ steps.branch-name.outputs.current_branch }}
+ run: make build-push-query-service
- - name: Build & Push Query Service Docker Image
- shell: bash
- env:
- QUERY_SERVICE_DIRECTORY: "pkg/query-service"
- REPONAME: ${{ secrets.REPONAME }}
- QUERY_SERVICE_DOCKER_IMAGE: ${QUERY_SERVICE}
- DOCKER_TAG: ${IMG_TAG}
- run: |
- branch=${GITHUB_REF#refs/*/}
- array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
- if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [ ${array[1]} == "pull" ] ||[[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
- then
- source env-vars
- make build-push-query-service
- fi
-
- build-and-push-flattener:
+ image-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: Install dependencies
+ working-directory: frontend
+ run: yarn install
+ - name: Run Prettier
+ working-directory: frontend
+ run: npm run prettify
+ continue-on-error: true
+ - name: Run ESLint
+ working-directory: frontend
+ run: npm run lint
+ continue-on-error: true
- name: Set up Docker Buildx
- id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- - name: Build & Push Flattener Processor Docker Image
- shell: bash
- env:
- FLATTENER_DIRECTORY: "pkg/processors/flattener"
- REPONAME: ${{ secrets.REPONAME }}
- FLATTERNER_DOCKER_IMAGE: ${FLATTENER_PROCESSOR}
- DOCKER_TAG: ${IMG_TAG}
- run: |
- branch=${GITHUB_REF#refs/*/}
- array=(`echo ${GITHUB_REF} | sed 's/\//\n/g'`)
- if [ $branch == "main" ] || [ ${array[1]} == "tags" ] || [ ${array[1]} == "pull" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
- then
- source env-vars
- make build-push-flattener
- fi
+ - uses: benjlevesque/[email protected]
+ id: short-sha
+ - name: Get branch name
+ id: branch-name
+ uses: tj-actions/[email protected]
+ - name: Build and push docker image
+ env:
+ DOCKER_TAG: ${{ steps.short-sha.outputs.sha }}
+ DOCKER_SECOND_TAG: ${{ steps.branch-name.outputs.current_branch }}
+ run: make build-push-frontend
diff --git a/Makefile b/Makefile
index 085045e339..83ba66976b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,15 @@ build-push-frontend:
@echo "------------------"
@echo "--> Building and pushing frontend docker image"
@echo "------------------"
+ifndef DOCKER_SECOND_TAG
@cd $(FRONTEND_DIRECTORY) && \
docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) .
+else
+ @cd $(FRONTEND_DIRECTORY) && \
+ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 . \
+ --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) \
+ --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_SECOND_TAG)
+endif
# Steps to build and push docker image of query service
.PHONY: build-query-service-amd64 build-push-query-service
@@ -47,8 +54,15 @@ build-push-query-service:
@echo "------------------"
@echo "--> Building and pushing query-service docker image"
@echo "------------------"
+ifndef DOCKER_SECOND_TAG
@cd $(QUERY_SERVICE_DIRECTORY) && \
docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
+else
+ @cd $(QUERY_SERVICE_DIRECTORY) && \
+ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 . \
+ --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
+ --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_SECOND_TAG)
+endif
# Steps to build and push docker image of flattener
.PHONY: build-flattener-amd64 build-push-flattener