Skip to content

Commit b505e0a

Browse files
authored
fix(perf-workflow): add secrets to the template (#1554)
# Description The workflow was failing after templating it as workflow call cannot process runtime variables. We need to pass in the secrets through the workflow as variables. ## Related Issue If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request. ## Checklist - [ ] I have read the [contributing documentation](https://retina.sh/docs/Contributing/overview). - [ ] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [ ] I have correctly attributed the author(s) of the code. - [ ] I have tested the changes locally. - [ ] I have followed the project's style guidelines. - [ ] I have updated the documentation, if necessary. - [ ] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. Signed-off-by: Ritwik Ranjan <ritwikranjan@microsoft.com>
1 parent cc6a46c commit b505e0a

4 files changed

Lines changed: 91 additions & 27 deletions

File tree

.github/workflows/images.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ jobs:
344344
tag: $(make version)
345345
image-namespace: ${{ github.repository }}
346346
retina-mode: basic
347+
azure-location: ${{ vars.AZURE_LOCATION }}
348+
secrets:
349+
azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }}
350+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
351+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
352+
azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
347353

348354
perf-test-advanced:
349355
if: ${{ github.event_name == 'merge_group' && success('manifests')}}
@@ -354,3 +360,9 @@ jobs:
354360
tag: $(make version)
355361
image-namespace: ${{ github.repository }}
356362
retina-mode: advanced
363+
azure-location: ${{ vars.AZURE_LOCATION }}
364+
secrets:
365+
azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }}
366+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
367+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
368+
azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}

.github/workflows/perf-manual.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Network Performance Measurement Manually
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image-registry:
7+
description: 'Image Registry to use for the performance test'
8+
required: true
9+
default: 'ghcr.io'
10+
type: string
11+
tag:
12+
description: 'Image Tag to use for the performance test'
13+
required: true
14+
type: string
15+
image-namespace:
16+
description: 'Image Namespace to use for the performance test'
17+
required: false
18+
type: string
19+
retina-mode:
20+
description: 'Retina mode (basic or advanced)'
21+
required: true
22+
type: string
23+
default: 'basic'
24+
25+
permissions:
26+
contents: read
27+
id-token: write
28+
29+
jobs:
30+
perf-test:
31+
uses: ./.github/workflows/perf-template.yaml
32+
with:
33+
image-registry: ${{ inputs.image-registry }}
34+
tag: ${{ inputs.tag }}
35+
image-namespace: ${{ inputs.image-namespace || github.repository }}
36+
retina-mode: ${{ inputs.retina-mode }}
37+
azure-location: ${{ vars.AZURE_LOCATION }}
38+
secrets:
39+
azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }}
40+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
41+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
42+
azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}

.github/workflows/perf-schedule.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@ jobs:
1717
tag: $(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
1818
image-namespace: ${{ github.repository }}
1919
retina-mode: basic
20+
azure-location: ${{ vars.AZURE_LOCATION }}
21+
secrets:
22+
azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }}
23+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
24+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
25+
azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
26+
2027
perf-test-advanced:
2128
uses: ./.github/workflows/perf-template.yaml
2229
with:
2330
image-registry: ghcr.io
2431
tag: $(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
2532
image-namespace: ${{ github.repository }}
26-
retina-mode: advanced
33+
retina-mode: advanced
34+
azure-location: ${{ vars.AZURE_LOCATION }}
35+
secrets:
36+
azure-subscription: ${{ secrets.AZURE_SUBSCRIPTION }}
37+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
38+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
39+
azure-app-insights-key: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}

.github/workflows/perf-template.yaml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,29 @@ on:
1414
type: string
1515
image-namespace:
1616
description: 'Image Namespace to use for the performance test'
17-
required: false
17+
required: true
1818
type: string
1919
retina-mode:
2020
description: 'Retina mode (basic or advanced)'
2121
required: true
2222
type: string
23-
workflow_dispatch:
24-
inputs:
25-
image-registry:
26-
description: 'Image Registry to use for the performance test'
27-
required: true
28-
default: 'ghcr.io'
29-
type: string
30-
tag:
31-
description: 'Image Tag to use for the performance test'
32-
required: true
33-
type: string
34-
image-namespace:
35-
description: 'Image Namespace to use for the performance test'
36-
required: false
37-
type: string
38-
retina-mode:
39-
description: 'Retina mode (basic or advanced)'
23+
azure-location:
24+
description: 'Azure location for the performance test'
4025
required: true
4126
type: string
42-
default: 'basic'
27+
secrets:
28+
azure-subscription:
29+
description: 'Azure subscription ID'
30+
required: true
31+
azure-tenant-id:
32+
description: 'Azure tenant ID'
33+
required: true
34+
azure-client-id:
35+
description: 'Azure client ID'
36+
required: true
37+
azure-app-insights-key:
38+
description: 'Azure Application Insights key'
39+
required: true
4340

4441
permissions:
4542
contents: read
@@ -62,22 +59,22 @@ jobs:
6259
- name: Az CLI login
6360
uses: azure/login@v2
6461
with:
65-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
66-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
67-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
62+
client-id: ${{ secrets.azure-client-id }}
63+
tenant-id: ${{ secrets.azure-tenant-id }}
64+
subscription-id: ${{ secrets.azure-subscription }}
6865

6966
- name: Run performance measurement for Retina
7067
env:
71-
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
72-
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
73-
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
68+
AZURE_APP_INSIGHTS_KEY: ${{ secrets.azure-app-insights-key }}
69+
AZURE_SUBSCRIPTION_ID: ${{ secrets.azure-subscription }}
70+
AZURE_LOCATION: ${{ inputs.azure-location }}
7471
shell: bash
7572
run: |
7673
set -euo pipefail
7774
7875
TAG="${{ inputs.tag }}"
7976
REGISTRY="${{ inputs.image-registry }}"
80-
NAMESPACE="${{ inputs.image-namespace || github.repository }}"
77+
NAMESPACE="${{ inputs.image-namespace }}"
8178
MODE="${{ inputs.retina-mode }}"
8279
8380
echo "Running in $MODE mode..."

0 commit comments

Comments
 (0)