-
Notifications
You must be signed in to change notification settings - Fork 268
171 lines (151 loc) · 6.38 KB
/
test-extension-workflows-master.yml
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
name: Test Extension workflows - Master (3.x)
on:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash
working-directory: ./
jobs:
test-extensions-creators-and-update-paths:
if: ${{ github.repository_owner == 'rancher' }}
runs-on: ubuntu-latest
outputs:
test-extensions-creators-and-update-paths-job-status: ${{ job.status }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Retrieve Shell and Creators versions
run: .github/workflows/scripts/test-extensions-creators-build.sh
id: test-extensions-and-creators
shell: bash
branch-checks:
if: ${{ github.repository_owner == 'rancher' }}
runs-on: ubuntu-latest
strategy:
matrix:
branch: [master, release-2.9, release-2.8]
outputs:
status-${{ matrix.branch }}: ${{ job.status }}
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Validate workflows
run: .github/workflows/scripts/check-creators-workflows-code.sh "${{ matrix.branch }}"
matching-creators-workflows:
if: ${{ github.repository_owner == 'rancher' }}
runs-on: ubuntu-latest
needs: [branch-checks]
outputs:
matching-creators-workflows-job-status: ${{ steps.aggregate.outputs.result }}
steps:
- name: Aggregate results
id: aggregate
run: |
# Check all branch check outcomes
if [[ '${{ needs.branch-checks.result }}' == 'failure' ]]; then
echo "result=failure" >> $GITHUB_OUTPUT
else
echo "result=success" >> $GITHUB_OUTPUT
fi
retrieve-tags-master:
if: ${{ github.repository_owner == 'rancher' }}
runs-on: ubuntu-latest
outputs:
SHELL_TAG: ${{ steps.retrieve-data.outputs.SHELL_TAG }}
CREATORS_TAG: ${{ steps.retrieve-data.outputs.CREATORS_TAG }}
ECI_TAG: ${{ steps.retrieve-data.outputs.ECI_TAG }}
EXTENSION_TAG: ${{ steps.retrieve-data.outputs.EXTENSION_TAG }}
CURR_JOB_ID: ${{ github.job }}
tags-job-status: ${{ job.status }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master
- name: Retrieve Shell and Creators versions
run: source ./.github/workflows/scripts/retrieve-versions.sh
id: retrieve-data
shell: bash
test-build-extension-charts-master:
needs: retrieve-tags-master
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
permissions:
actions: write
contents: write
deployments: write
pages: write
with:
target_branch: 'gh-pages'
tagged_release: ${{ needs.retrieve-tags-master.outputs.EXTENSION_TAG }}
is_test: 'true'
test_ext_repo: 'ui-plugin-examples'
test_ext_branch: 'main'
test-build-extension-catalog-master:
needs: retrieve-tags-master
uses: rancher/dashboard/.github/workflows/build-extension-catalog.yml@master
permissions:
actions: write
contents: read
packages: write
with:
registry_target: ghcr.io
registry_user: ${{ github.actor }}
tagged_release: ${{ needs.retrieve-tags-master.outputs.ECI_TAG }}
is_test: 'true'
test_ext_repo: 'ui-plugin-examples'
test_ext_branch: 'main'
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
test-release-shell-pkg-master:
needs: retrieve-tags-master
uses: rancher/dashboard/.github/workflows/release-shell-pkg.yaml@master
with:
is_test: 'true'
test_branch: 'master'
tag: ${{ needs.retrieve-tags-master.outputs.SHELL_TAG }}
test-release-creators-pkg-master:
needs: retrieve-tags-master
uses: rancher/dashboard/.github/workflows/release-shell-pkg.yaml@master
with:
is_test: 'true'
test_branch: 'master'
tag: ${{ needs.retrieve-tags-master.outputs.CREATORS_TAG }}
slack-message:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [matching-creators-workflows, test-extensions-creators-and-update-paths, retrieve-tags-master, test-build-extension-charts-master, test-build-extension-catalog-master, test-release-shell-pkg-master, test-release-creators-pkg-master]
steps:
- name: Slack message for workflow
if: always()
shell: bash
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL_EXT_WFS }}
run: |
OUTPUT_ARRAY=("${{ needs.matching-creators-workflows.outputs.matching-creators-workflows-job-status }}" "${{ needs.test-extensions-creators-and-update-paths.outputs.test-extensions-creators-and-update-paths-job-status }}" "${{ needs.retrieve-tags-master.outputs.tags-job-status }}" "${{ needs.test-build-extension-charts-master.outputs.build-job-status }}" "${{ needs.test-build-extension-catalog-master.outputs.build-extension-catalog-job-status }}" "${{ needs.test-release-shell-pkg-master.outputs.build-release-shell-creators-status }}" "${{ needs.test-release-creators-pkg-master.outputs.build-release-shell-creators-status }}")
JOB_NAME_ARRAY=("matching-creators-workflows" "test-extensions-creators-and-update-paths" "retrieve-tags-master" "test-build-extension-charts-master" "test-build-extension-catalog-master" "test-release-shell-pkg-master" "test-release-creators-pkg-master")
if [[ ${OUTPUT_ARRAY[@]} =~ "failure" ]]; then
MSG_PREFIX="\nWorkflows testing for extensions failed! ❌"
elif [[ ${OUTPUT_ARRAY[@]} =~ (^|[[:space:]])""($|[[:space:]]) ]]; then
MSG_PREFIX="\nSomething went wrong during the workflows testing! ⭕"
else
MSG_PREFIX="\nWorkflows testing for extensions succedded! ✅"
fi
echo "message prefix ::: $MSG_PREFIX"
MSG="$MSG_PREFIX"
for index in "${!OUTPUT_ARRAY[@]}"
do
if [[ ${OUTPUT_ARRAY[$index]} == "failure" ]]; then
EMOJI="❌"
elif [[ ${OUTPUT_ARRAY[$index]} == "" ]]; then
EMOJI="NO JOB STATUS! ⭕"
else
EMOJI="✅"
fi
MSG="$MSG \n::: Status for ${JOB_NAME_ARRAY[$index]} job => ${OUTPUT_ARRAY[$index]} $EMOJI"
done
echo "message sent: $MSG"
curl -X POST -H 'Content-type: application/json; charset=utf-8' \
--data "{\"branch\": \"master\", \"message\": \"$MSG\", \"workflow_run\": ${{ github.run_id }} }" $SLACK_WEBHOOK