forked from SigNoz/signoz
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (146 loc) · 4.64 KB
/
push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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: 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" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
make build-push-frontend
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: 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 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" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
make build-push-query-service
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: 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" ] || [[ $branch =~ ^v[0-9]*.[0-9]*.x$ ]]
then
source env-vars
make build-push-flattener
fi