Skip to content

Commit d444b02

Browse files
authored
ci: updated flows (#197)
* updated flows * corrected * added install lib * added install lib * updated bash
1 parent d8ab413 commit d444b02

6 files changed

Lines changed: 240 additions & 0 deletions

.github/workflows/terratests-ept-prod-suite.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
TEST_DATA_PROD_PORT_2_PRECISION_TIME_PTP: ${{ secrets.TEST_DATA_PROD_PORT_2_PRECISION_TIME_PTP }}
1414
TEST_DATA_PROD_FCR_2_PRECISION_TIME_NPT: ${{ secrets.TEST_DATA_PROD_FCR_2_PRECISION_TIME_NPT }}
1515
TEST_DATA_PROD_VD_2_PRECISION_TIME_NPT: ${{ secrets.TEST_DATA_PROD_VD_2_PRECISION_TIME_NPT }}
16+
outputs:
17+
message: ${{ steps.slack_message.outputs.message }}
1618

1719
steps:
1820
- name: Check out code into the Go module directory
@@ -43,6 +45,7 @@ jobs:
4345
- name: Install jq
4446
run: |
4547
sudo apt-get install jq
48+
sudo apt-get install -y libxml2-utils
4649
4750
- name: Setup Variables Files
4851
run: |
@@ -63,6 +66,25 @@ jobs:
6366
run: |
6467
go-junit-report -parser gojson -in precision_time_prod_suite.log > precision_time_prod_suite.xml && python3 -m junit2htmlreport precision_time_prod_suite.xml precision_time_prod_suite.html
6568
69+
- name: Prepare slack message
70+
id: slack_message
71+
if: always()
72+
shell: bash
73+
run: |
74+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
75+
76+
if [[ -z "$xml_file" ]]; then
77+
echo "No file ending with prod_suite.xml found."
78+
exit 1
79+
fi
80+
81+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
82+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
83+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
84+
echo "message<<EOF" >> $GITHUB_OUTPUT
85+
echo "$message" >> $GITHUB_OUTPUT
86+
echo "EOF" >> $GITHUB_OUTPUT
87+
6688
- name: Upload HTML Testing Report
6789
uses: actions/upload-artifact@v4
6890
with:
@@ -72,3 +94,21 @@ jobs:
7294

7395
- name: Check if Tests are passed
7496
run: sh scripts/check_tests.sh *suite.log
97+
98+
- name: Notify Slack
99+
uses: slackapi/slack-github-action@v2
100+
if: always()
101+
with:
102+
method: chat.postMessage
103+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
104+
payload: |
105+
channel: digin-panthers-gha-automation
106+
107+
attachments:
108+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
109+
text: |
110+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
111+
*Workflow:* ${{ github.workflow }}
112+
*Status:* ${{ job.status }}
113+
*Results:* ${{ steps.slack_message.outputs.message }}
114+
*Triggered by:* <@${{ github.actor }}>

.github/workflows/terratests-fcr-prod-suite.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION}}
2222
TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION}}
2323
TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION}}
24+
outputs:
25+
message: ${{ steps.slack_message.outputs.message }}
2426

2527
steps:
2628
- name: Check out code into the Go module directory
@@ -51,6 +53,7 @@ jobs:
5153
- name: Install jq
5254
run: |
5355
sudo apt-get install jq
56+
sudo apt-get install -y libxml2-utils
5457
5558
- name: Setup Variables Files
5659
run: |
@@ -78,6 +81,25 @@ jobs:
7881
run: |
7982
go-junit-report -parser gojson -in fcr_prod_suite.log > fcr_prod_suite.xml && python3 -m junit2htmlreport fcr_prod_suite.xml fcr_prod_suite.html
8083
84+
- name: Prepare slack message
85+
id: slack_message
86+
if: always()
87+
shell: bash
88+
run: |
89+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
90+
91+
if [[ -z "$xml_file" ]]; then
92+
echo "No file ending with prod_suite.xml found."
93+
exit 1
94+
fi
95+
96+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
97+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
98+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
99+
echo "message<<EOF" >> $GITHUB_OUTPUT
100+
echo "$message" >> $GITHUB_OUTPUT
101+
echo "EOF" >> $GITHUB_OUTPUT
102+
81103
- name: Upload HTML Testing Report
82104
uses: actions/upload-artifact@v4
83105
with:
@@ -87,3 +109,21 @@ jobs:
87109

88110
- name: Check if Tests are passed
89111
run: sh scripts/check_tests.sh *suite.log
112+
113+
- name: Notify Slack
114+
uses: slackapi/slack-github-action@v2
115+
if: always()
116+
with:
117+
method: chat.postMessage
118+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
119+
payload: |
120+
channel: digin-panthers-gha-automation
121+
122+
attachments:
123+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
124+
text: |
125+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
126+
*Workflow:* ${{ github.workflow }}
127+
*Status:* ${{ job.status }}
128+
*Results:* ${{ steps.slack_message.outputs.message }}
129+
*Triggered by:* <@${{ github.actor }}>

.github/workflows/terratests-metal-nimf-suite.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
TEST_DATA_PROD_METAL_NIMF_2_PORT_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_PORT_CONNECTION }}
2424
TEST_DATA_PROD_METAL_NIMF_2_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_SERVICE_PROFILE_CONNECTION }}
2525
TEST_DATA_PROD_METAL_NIMF_2_GOOGLE_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_GOOGLE_CONNECTION }}
26+
outputs:
27+
message: ${{ steps.slack_message.outputs.message }}
2628

2729
steps:
2830
- name: Check out code into the Go module directory
@@ -53,6 +55,7 @@ jobs:
5355
- name: Install jq
5456
run: |
5557
sudo apt-get install jq
58+
sudo apt-get install -y libxml2-utils
5659
5760
- name: Set Connection Name variable
5861
run: echo "TF_VAR_connection_name=nimf_$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
@@ -85,6 +88,25 @@ jobs:
8588
run: |
8689
go-junit-report -parser gojson -in metal_prod_suite.log > metal_prod_suite.xml && python3 -m junit2htmlreport metal_prod_suite.xml metal_prod_suite.html
8790
91+
- name: Prepare slack message
92+
id: slack_message
93+
if: always()
94+
shell: bash
95+
run: |
96+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
97+
98+
if [[ -z "$xml_file" ]]; then
99+
echo "No file ending with prod_suite.xml found."
100+
exit 1
101+
fi
102+
103+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
104+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
105+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
106+
echo "message<<EOF" >> $GITHUB_OUTPUT
107+
echo "$message" >> $GITHUB_OUTPUT
108+
echo "EOF" >> $GITHUB_OUTPUT
109+
88110
- name: Upload HTML Testing Report
89111
uses: actions/upload-artifact@v4
90112
with:
@@ -94,3 +116,21 @@ jobs:
94116

95117
- name: Check if Tests are passed
96118
run: sh scripts/check_tests.sh *suite.log
119+
120+
- name: Notify Slack
121+
uses: slackapi/slack-github-action@v2
122+
if: always()
123+
with:
124+
method: chat.postMessage
125+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
126+
payload: |
127+
channel: digin-panthers-gha-automation
128+
129+
attachments:
130+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
131+
text: |
132+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
133+
*Workflow:* ${{ github.workflow }}
134+
*Status:* ${{ job.status }}
135+
*Results:* ${{ steps.slack_message.outputs.message }}
136+
*Triggered by:* <@${{ github.actor }}>

.github/workflows/terratests-port-prod-suite.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
TEST_DATA_PROD_PORT_2_PORT_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_PORT_CONNECTION }}
2424
TEST_DATA_PROD_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION }}
2525
TEST_DATA_PROD_PORT_2_WAN_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_WAN_CONNECTION }}
26+
outputs:
27+
message: ${{ steps.slack_message.outputs.message }}
2628

2729
steps:
2830
- name: Check out code into the Go module directory
@@ -53,6 +55,7 @@ jobs:
5355
- name: Install jq
5456
run: |
5557
sudo apt-get install jq
58+
sudo apt-get install -y libxml2-utils
5659
5760
- name: Setup Variables Files
5861
run: |
@@ -84,6 +87,25 @@ jobs:
8487
run: |
8588
go-junit-report -parser gojson -in port_prod_suite.log > port_prod_suite.xml && python3 -m junit2htmlreport port_prod_suite.xml port_prod_suite.html
8689
90+
- name: Prepare slack message
91+
id: slack_message
92+
if: always()
93+
shell: bash
94+
run: |
95+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
96+
97+
if [[ -z "$xml_file" ]]; then
98+
echo "No file ending with prod_suite.xml found."
99+
exit 1
100+
fi
101+
102+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
103+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
104+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
105+
echo "message<<EOF" >> $GITHUB_OUTPUT
106+
echo "$message" >> $GITHUB_OUTPUT
107+
echo "EOF" >> $GITHUB_OUTPUT
108+
87109
- name: Upload HTML Testing Report
88110
uses: actions/upload-artifact@v4
89111
with:
@@ -93,3 +115,21 @@ jobs:
93115

94116
- name: Check if Tests are passed
95117
run: sh scripts/check_tests.sh *suite.log
118+
119+
- name: Notify Slack
120+
uses: slackapi/slack-github-action@v2
121+
if: always()
122+
with:
123+
method: chat.postMessage
124+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
125+
payload: |
126+
channel: digin-panthers-gha-automation
127+
128+
attachments:
129+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
130+
text: |
131+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
132+
*Workflow:* ${{ github.workflow }}
133+
*Status:* ${{ job.status }}
134+
*Results:* ${{ steps.slack_message.outputs.message }}
135+
*Triggered by:* <@${{ github.actor }}>

.github/workflows/terratests-prod-suite-all.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION}}
3636
TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION}}
3737
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AWS_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AWS_CONNECTION}}
38+
outputs:
39+
message: ${{ steps.slack_message.outputs.message }}
3840

3941
steps:
4042
- name: Check out code into the Go module directory
@@ -65,6 +67,7 @@ jobs:
6567
- name: Install jq
6668
run: |
6769
sudo apt-get install jq
70+
sudo apt-get install -y libxml2-utils
6871
6972
- name: Setup Variables Files
7073
run: |
@@ -120,6 +123,25 @@ jobs:
120123
run: |
121124
go-junit-report -parser gojson -in prod_suite_all.log > prod_suite_all.xml && python3 -m junit2htmlreport prod_suite_all.xml prod_suite_all.html
122125
126+
- name: Prepare slack message
127+
id: slack_message
128+
if: always()
129+
shell: bash
130+
run: |
131+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
132+
133+
if [[ -z "$xml_file" ]]; then
134+
echo "No file ending with prod_suite.xml found."
135+
exit 1
136+
fi
137+
138+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
139+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
140+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
141+
echo "message<<EOF" >> $GITHUB_OUTPUT
142+
echo "$message" >> $GITHUB_OUTPUT
143+
echo "EOF" >> $GITHUB_OUTPUT
144+
123145
- name: Upload HTML Testing Report
124146
uses: actions/upload-artifact@v4
125147
with:
@@ -129,3 +151,21 @@ jobs:
129151

130152
- name: Check if Tests are passed
131153
run: sh scripts/check_tests.sh *suite_all.log
154+
155+
- name: Notify Slack
156+
uses: slackapi/slack-github-action@v2
157+
if: always()
158+
with:
159+
method: chat.postMessage
160+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
161+
payload: |
162+
channel: digin-panthers-gha-automation
163+
164+
attachments:
165+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
166+
text: |
167+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
168+
*Workflow:* ${{ github.workflow }}
169+
*Status:* ${{ job.status }}
170+
*Results:* ${{ steps.slack_message.outputs.message }}
171+
*Triggered by:* <@${{ github.actor }}>

.github/workflows/terratests-virtualdevice-prod-suite.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION}}
1919
TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION}}
2020
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AWS_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AWS_CONNECTION}}
21+
outputs:
22+
message: ${{ steps.slack_message.outputs.message }}
2123

2224
steps:
2325
- name: Check out code into the Go module directory
@@ -48,6 +50,7 @@ jobs:
4850
- name: Install jq
4951
run: |
5052
sudo apt-get install jq
53+
sudo apt-get install -y libxml2-utils
5154
5255
- name: Setup Variables Files
5356
run: |
@@ -70,6 +73,25 @@ jobs:
7073
run: |
7174
go-junit-report -parser gojson -in vd_prod_suite.log > vd_prod_suite.xml && python3 -m junit2htmlreport vd_prod_suite.xml vd_prod_suite.html
7275
76+
- name: Prepare slack message
77+
id: slack_message
78+
if: always()
79+
shell: bash
80+
run: |
81+
xml_file=$(find . -type f -name '*prod_suite.xml' | head -n 1)
82+
83+
if [[ -z "$xml_file" ]]; then
84+
echo "No file ending with prod_suite.xml found."
85+
exit 1
86+
fi
87+
88+
tests=$(xmllint --xpath 'string(//testsuite/@tests)' "$xml_file")
89+
errors=$(xmllint --xpath 'string(//testsuite/@failures)' "$xml_file")
90+
message="*Results:* $((tests-errors)) Passed, $errors Errors"
91+
echo "message<<EOF" >> $GITHUB_OUTPUT
92+
echo "$message" >> $GITHUB_OUTPUT
93+
echo "EOF" >> $GITHUB_OUTPUT
94+
7395
- name: Upload HTML Testing Report
7496
uses: actions/upload-artifact@v4
7597
with:
@@ -79,3 +101,21 @@ jobs:
79101

80102
- name: Check if Tests are passed
81103
run: sh scripts/check_tests.sh *suite.log
104+
105+
- name: Notify Slack
106+
uses: slackapi/slack-github-action@v2
107+
if: always()
108+
with:
109+
method: chat.postMessage
110+
token: ${{ secrets.SLACK_ACCESS_TOKEN }}
111+
payload: |
112+
channel: digin-panthers-gha-automation
113+
114+
attachments:
115+
- color: ${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}
116+
text: |
117+
*Repository:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.repository }}>
118+
*Workflow:* ${{ github.workflow }}
119+
*Status:* ${{ job.status }}
120+
*Results:* ${{ steps.slack_message.outputs.message }}
121+
*Triggered by:* <@${{ github.actor }}>

0 commit comments

Comments
 (0)