Skip to content

Commit cd6b01c

Browse files
Fix deploying latency monitor (#2)
* Adding sample push gateway url * Using public reusable tasks * Scape generated files * setup driver kubernetes * Add input to reusable action * Fix metrics instantiation and labels * Fix build * Adding the other workflows * Apply ronny PR comments * Fix formatting * Add error as a counter * Use push instead of PushAdd * change jobname * keep process.env access bundles together * fixed env resolution * Add metric labels globally * adding labels gloabally --------- Co-authored-by: Ronny Esterluss <[email protected]>
1 parent d273083 commit cd6b01c

File tree

7 files changed

+279
-69
lines changed

7 files changed

+279
-69
lines changed

.env.sample

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ UHTTP_LM_ZERO_HOP=true
44
UHTTP_LM_DISCOVERY_PLATFORM=https://discovery.rpch.tech
55
UHTTP_LM_INTERVAL_MS=60000
66
UHTTP_LM_OFFSET_MS=11111
7-
UHTTP_LM_PUSH_GATEWAY=
7+
UHTTP_LM_PUSH_GATEWAY=https://prometheus-pushgateway.staging.hoprnet.link
8+
UHTTP_LM_METRIC_INSTANCE=latency-monitor-green-zurich-1
9+
UHTTP_LM_METRIC_REGION=europe-west6
10+
UHTTP_LM_METRIC_ZONE=europe-west6-a
11+
UHTTP_LM_METRIC_LOCATION=Zurich-Switzerland
12+
UHTTP_LM_METRIC_LATITUDE=47.3668389
13+
UHTTP_LM_METRIC_LONGITUDE=8.5339821
814
DEBUG=latency-monitor:*

.github/workflows/build.yaml

+17-8
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ concurrency:
1010

1111
jobs:
1212
build-and-publish:
13-
name: Build and Publish
13+
name: Build and Push
1414
runs-on: self-hosted-hoprnet-small
1515

1616
steps:
17-
- name: Setup uhttp repository
18-
id: setup
19-
uses: hoprnet/products-ci/.github/actions/setup@main
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
2022
with:
2123
node-version: 20
24+
25+
- name: Setup GCP
26+
uses: hoprnet/hopr-workflows/actions/setup-gcp@master
27+
with:
2228
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
29+
login-artifact-registry: 'true'
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
with:
34+
driver: kubernetes
2335

2436
- name: Building
2537
run: yarn build
@@ -36,14 +48,11 @@ jobs:
3648
- name: Get PR version
3749
id: variables
3850
run: |
39-
BUILD_DATE=$(date +%Y%m%d%H%M%S)
4051
PR_VERSION=$(node -p "require('./package.json').version")-pr.${{ github.event.pull_request.number }}
4152
echo "PR_VERSION=${PR_VERSION}" >> $GITHUB_OUTPUT
4253
4354
- name: Build and push docker image
4455
uses: docker/build-push-action@v4
4556
with:
4657
push: true
47-
tags: |
48-
europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:latest
49-
europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:${{ steps.variables.outputs.PR_VERSION }}
58+
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:${{ steps.variables.outputs.PR_VERSION }}

.github/workflows/merge.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Merge PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: merge
12+
cancel-in-progress: false
13+
14+
jobs:
15+
merge:
16+
name: Merge PR
17+
runs-on: self-hosted-hoprnet-small
18+
if: github.event.pull_request.merged == true
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
26+
with:
27+
node-version: 20
28+
29+
- name: Setup GCP
30+
id: gcp
31+
uses: hoprnet/hopr-workflows/actions/setup-gcp@master
32+
with:
33+
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
34+
login-artifact-registry: 'true'
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
with:
39+
driver: kubernetes
40+
41+
- name: Build and push docker image
42+
uses: docker/build-push-action@v4
43+
with:
44+
push: true
45+
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:latest

.github/workflows/release.yaml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Close release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Next version type'
8+
required: true
9+
type: choice
10+
default: 'patch'
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
concurrency:
17+
group: release
18+
cancel-in-progress: false
19+
20+
jobs:
21+
release:
22+
name: Close release
23+
runs-on: self-hosted-hoprnet-small
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js
30+
uses: hoprnet/hopr-workflows/actions/setup-node-js@master
31+
with:
32+
node-version: 20
33+
34+
- name: Setup GCP
35+
id: gcp
36+
uses: hoprnet/hopr-workflows/actions/setup-gcp@master
37+
with:
38+
google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }}
39+
login-artifact-registry: 'true'
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
with:
44+
driver: kubernetes
45+
46+
- name: Building
47+
run: yarn build
48+
49+
- name: Linting
50+
run: yarn lint:ci
51+
52+
- name: Formatting
53+
run: yarn format:ci
54+
55+
- name: Testing
56+
run: yarn test
57+
58+
- name: Setup environment variables
59+
id: environment
60+
run: |
61+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
62+
echo "release_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
63+
64+
- name: Create Release
65+
uses: softprops/action-gh-release@v2
66+
with:
67+
body_path: changelog.md
68+
name: 'uhttp-latency-monitor - v${{ steps.environment.outputs.release_version }}'
69+
tag_name: v${{ steps.environment.outputs.release_version }}
70+
71+
72+
- name: Build and push docker image
73+
uses: docker/build-push-action@v4
74+
with:
75+
push: true
76+
tags: europe-west3-docker.pkg.dev/hoprassociation/docker-images/uhttp-latency-monitor:${{ steps.environment.outputs.release_version }}
77+
78+
- name: Bump Version
79+
id: bump
80+
run: |
81+
npm version ${{ inputs.release_type }} --no-git-tag-version
82+
BUMP_VERSION=$(node -p "require('./package.json').version")
83+
echo "bump_version=${BUMP_VERSION}" >> $GITHUB_OUTPUT
84+
85+
- name: Create Pull Request
86+
uses: peter-evans/create-pull-request@v6
87+
with:
88+
token: ${{ secrets.GH_RUNNER_TOKEN }}
89+
commit-message: 'Bump to version ${{ steps.bump.outputs.bump_version }}'
90+
base: main
91+
title: 'Open release ${{ steps.bump.outputs.bump_version }}'
92+
body: 'The scope of this PR is to bump the new release ${{ steps.bump.outputs.bump_version }}'
93+
branch: bot/open-${{ inputs.release_type }}-${{ steps.bump.outputs.bump_version }}
94+
delete-branch: true
95+
assignees: ${{ github.actor }}
96+
team-reviewers: '@hoprnet/hopr-products-team'
97+
98+
- name: Notify new release
99+
uses: zulip/github-actions-zulip/send-message@v1
100+
with:
101+
api-key: ${{ secrets.ZULIP_API_KEY }}
102+
email: ${{ secrets.ZULIP_EMAIL }}
103+
organization-url: 'https://hopr.zulipchat.com'
104+
type: 'stream'
105+
to: 'Releases'
106+
topic: 'main'
107+
content: |
108+
I'm thrilled to inform the new **uhttp-latency-monitor** version **${{ steps.environment.outputs.current_version }}** has been released.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ coverage/
2525

2626
# dependencies
2727
node_modules/
28+
.vscode/

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Created by github pipeline
2+
gha-creds-*.json

0 commit comments

Comments
 (0)