-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathindustrial-edge-insights-time-series-pull-request.yml
More file actions
185 lines (173 loc) · 8.27 KB
/
industrial-edge-insights-time-series-pull-request.yml
File metadata and controls
185 lines (173 loc) · 8.27 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#
# Apache v2 license
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
name: "[Industrial Edge Insights Time Series and Multimodal] PR workflow"
run-name: "[Industrial Edge Insights Time Series and Multimodal] PR workflow (by @${{ github.actor }} via ${{ github.event_name }})"
on:
pull_request:
paths:
- 'manufacturing-ai-suite/industrial-edge-insights-time-series/**'
- 'manufacturing-ai-suite/industrial-edge-insights-multimodal/**'
workflow_call:
workflow_dispatch:
permissions:
contents: read
packages: read
pull-requests: read
security-events: write
actions: read
jobs:
industrial-edge-insights-time-series-pre-merge-build:
permissions:
contents: read
packages: read # needed for actions/checkout
runs-on: ubuntu-24.04
steps:
- name: Runner workspace path
run: |
echo "Cleaning up previous run"
if [ -n "$(docker ps -aq)" ]; then
docker stop $(docker ps -aq)
fi
if [ -n "$(docker ps -aq)" ]; then
docker rm $(docker ps -aq)
fi
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi -f
- name: Checkout edge-ai-libraries (main)
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
repository: open-edge-platform/edge-ai-libraries
ref: main
path: edge-ai-libraries
persist-credentials: false
- name: Building Time Series Analytics microservices
run: |
cd ./edge-ai-libraries/microservices/time-series-analytics/docker
docker compose down -v
docker compose build
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: timeseries
persist-credentials: false
- name: Building Time Series Sample App
run: |
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-time-series
make down
# Generate random values for sensitive environment variables
INFLUXDB_USERNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
base=$(tr -dc 'a-zA-Z' </dev/urandom | head -c9)
digit=$(tr -dc '0-9' </dev/urandom | head -c1)
pos=$((RANDOM % 10))
INFLUXDB_PASSWORD=${base:0:$pos}${digit}${base:$pos}
VISUALIZER_GRAFANA_USER=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
VISUALIZER_GRAFANA_PASSWORD=${base:0:$pos}${digit}${base:$pos}
sed -i "s/INFLUXDB_USERNAME=.*/INFLUXDB_USERNAME=${INFLUXDB_USERNAME}/g" .env
sed -i "s/INFLUXDB_PASSWORD=.*/INFLUXDB_PASSWORD=${INFLUXDB_PASSWORD}/g" .env
sed -i "s/VISUALIZER_GRAFANA_USER=.*/VISUALIZER_GRAFANA_USER=${VISUALIZER_GRAFANA_USER}/g" .env
sed -i "s/VISUALIZER_GRAFANA_PASSWORD=.*/VISUALIZER_GRAFANA_PASSWORD=${VISUALIZER_GRAFANA_PASSWORD}/g" .env
make build
- name: Deploying Wind Turbine Anomaly Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-time-series
echo "Deploying Wind Turbine Anomaly Detection Sample App"
echo "Deploying using mqtt ingestion"
make up_mqtt_ingestion app=wind-turbine-anomaly-detection
count=0
while IFS= read -r line; do
echo "$line"
if [[ "$line" == *"Attempting to connect to Kapacitor"* ]]; then
((count++))
echo "⚠️ Found Kapacitor connection attempt ($count)"
if (( count > 5 )); then
echo "🚨 More than 5 attempts detected - exiting"
exit 1
fi
fi
done < <(timeout 30s docker logs -f ia-time-series-analytics-microservice -n 5 2>&1)
echo "Deploying using opcua ingestion"
make up_opcua_ingestion app=wind-turbine-anomaly-detection
count=0
while IFS= read -r line; do
echo "$line"
if [[ "$line" == *"Attempting to connect to Kapacitor"* ]]; then
((count++))
echo "⚠️ Found Kapacitor connection attempt ($count)"
if (( count > 5 )); then
echo "🚨 More than 5 attempts detected - exiting"
exit 1
fi
fi
done < <(timeout 30s docker logs -f ia-time-series-analytics-microservice -n 5 2>&1)
- name: Undeploying Wind Turbine Anomaly Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-time-series
make down
- name: Deploying Weld Anomaly Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-time-series
echo "Deploying Weld Anomaly Detection Sample App"
make up_mqtt_ingestion app=weld-anomaly-detection
count=0
while IFS= read -r line; do
echo "$line"
if [[ "$line" == *"Attempting to connect to Kapacitor"* ]]; then
((count++))
echo "⚠️ Found Kapacitor connection attempt ($count)"
if (( count > 5 )); then
echo "🚨 More than 5 attempts detected - exiting"
exit 1
fi
fi
done < <(timeout 30s docker logs -f ia-time-series-analytics-microservice -n 5 2>&1)
- name: Undeploying Weld Anomaly Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-time-series
make down
- name: Building Multimodal Sample App
run: |
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-multimodal
make down
# Generate random values for sensitive environment variables
INFLUXDB_USERNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
base=$(tr -dc 'a-zA-Z' </dev/urandom | head -c9)
digit=$(tr -dc '0-9' </dev/urandom | head -c1)
pos=$((RANDOM % 10))
INFLUXDB_PASSWORD=${base:0:$pos}${digit}${base:$pos}
VISUALIZER_GRAFANA_USER=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
VISUALIZER_GRAFANA_PASSWORD=${base:0:$pos}${digit}${base:$pos}
MTX_WEBRTCICESERVERS2_0_USERNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
MTX_WEBRTCICESERVERS2_0_PASSWORD=$(openssl rand -hex 10)
HOST_IP=$(hostname -I | awk '{print $1}')
S3_STORAGE_USERNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z' | head -c 8)
S3_STORAGE_PASSWORD=$(openssl rand -hex 10)
sed -i "s/INFLUXDB_USERNAME=.*/INFLUXDB_USERNAME=${INFLUXDB_USERNAME}/g" .env
sed -i "s/INFLUXDB_PASSWORD=.*/INFLUXDB_PASSWORD=${INFLUXDB_PASSWORD}/g" .env
sed -i "s/VISUALIZER_GRAFANA_USER=.*/VISUALIZER_GRAFANA_USER=${VISUALIZER_GRAFANA_USER}/g" .env
sed -i "s/VISUALIZER_GRAFANA_PASSWORD=.*/VISUALIZER_GRAFANA_PASSWORD=${VISUALIZER_GRAFANA_PASSWORD}/g" .env
sed -i "s/MTX_WEBRTCICESERVERS2_0_USERNAME=.*/MTX_WEBRTCICESERVERS2_0_USERNAME=${MTX_WEBRTCICESERVERS2_0_USERNAME}/g" .env
sed -i "s/MTX_WEBRTCICESERVERS2_0_PASSWORD=.*/MTX_WEBRTCICESERVERS2_0_PASSWORD=${MTX_WEBRTCICESERVERS2_0_PASSWORD}/g" .env
sed -i "s/S3_STORAGE_USERNAME=.*/S3_STORAGE_USERNAME=${S3_STORAGE_USERNAME}/g" .env
sed -i "s/S3_STORAGE_PASSWORD=.*/S3_STORAGE_PASSWORD=${S3_STORAGE_PASSWORD}/g" .env
sed -i "s/HOST_IP=.*/HOST_IP=${HOST_IP}/g" .env
make build
- name: Deploying Multimodal Weld Defect Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-multimodal
echo "Deploying Multimodal Weld Defect Detection Sample App"
make up
- name: Undeploying Multimodal Weld Defect Detection Sample App
run: |
cd "${{ github.workspace }}"
cd ./timeseries/manufacturing-ai-suite/industrial-edge-insights-multimodal
make down
industrial-edge-insights-time-series-scans:
uses: ./.github/workflows/industrial-edge-insights-time-series-scans.yml
with:
target: all-scans