-
Notifications
You must be signed in to change notification settings - Fork 5
78 lines (66 loc) · 2.42 KB
/
multiservice-discovery-diff.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
name: MSD Diff
on:
pull_request:
branches:
- "main"
paths:
- 'rs/ic-observability/multiservice-discovery*/src/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
msd-diff:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: "🔧 Setup runner"
uses: ./.github/workflows/manage-runner-pre
- name: "📥 Download main test artifact"
uses: dawidd6/[email protected]
with:
name: test-artifacts
branch: main
workflow: main.yaml
- name: "🔭 Compute MSD"
id: msd-diff
run: |
set -exuo pipefail
REGISTRY_DIR_MAIN="$HOME/tmp/main-registry"
REGISTRY_DIR_BRANCH="$HOME/tmp/branch-registry"
TARGETS_DIR_MAIN="$HOME/main-targets"
TARGETS_DIR_BRANCH="$HOME/branch-targets"
mkdir -p "$REGISTRY_DIR_MAIN" \
"$REGISTRY_DIR_BRANCH" \
"$TARGETS_DIR_MAIN" \
"$TARGETS_DIR_BRANCH"
chmod +x multiservice-discovery
# Run multiservice-discovery for main targets
./multiservice-discovery \
--targets-dir "$REGISTRY_DIR_MAIN" \
--render-prom-targets-to-stdout > "$TARGETS_DIR_MAIN/targets.json"
# Run multiservice-discovery for branch targets with bazel
bazel run //rs/ic-observability/multiservice-discovery -- \
--targets-dir "$REGISTRY_DIR_BRANCH" \
--render-prom-targets-to-stdout > "$TARGETS_DIR_BRANCH/targets.json"
echo "targets_main=$TARGETS_DIR_MAIN" >> $GITHUB_OUTPUT
echo "targets_branch=$TARGETS_DIR_BRANCH" >> $GITHUB_OUTPUT
- name: Setup upterm session
uses: lhotari/action-upterm@v1
- name: "Check MSD Diff"
uses: "int128/diff-action@v1"
with:
base: ${{ steps.msd-diff.outputs.targets_main }}
head: ${{ steps.msd-diff.outputs.targets_branch }}
comment-header: |
## MSD Diff
Remove `prevent-merging-MSD-diff` label to merge after inspection
label: prevent-merging-MSD-diff
enforce-label:
runs-on: ubuntu-20.04
needs: msd-diff
steps:
- uses: yogevbd/[email protected]
with:
BANNED_LABELS: "prevent-merging-MSD-diff"