Skip to content

add inputs for workflow dispatch with conditional logic #9

add inputs for workflow dispatch with conditional logic

add inputs for workflow dispatch with conditional logic #9

name: Azure Load Tests
on:
push:
branches:
- azure-load-tests
#schedule:
#- cron: "0 0 * * 1"
workflow_dispatch:
inputs:
load-test-name:
required: true
type: string
description: name of load test that is run
test-id:
required: true
type: string
description: test id for load test
workflow_call:
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
jobs:
loadtest:
name: Load Test
environment:
name: internal
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v2
# Login to Azure using the CLI
- name: Login via Azure CLI
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# Run the Azure Load Test
- name: Run Load Test On Push
if: github.event_name == 'push'
run: |
az load test-run create \
--resource-group "csels-rsti-internal-moderate-rg" \
--load-test-resource "load-testing-internal" \
--test-id "9020b745-5fc4-4284-8803-04076ea09650" \
--test-run-id "run_"`date +"%Y%m%d%_H%M%S"`
# Run the Azure Load Test
- name: Trigger Load Test
if: github.event_name == 'workflow_dispatch'
run: |
az load test-run create \
--resource-group "csels-rsti-internal-moderate-rg" \
--load-test-resource "${{ github.event.inputs.load-test-name }}" \
--test-id "${{ github.event.inputs.test-id }}" \
--test-run-id "run_"`date +"%Y%m%d%_H%M%S"`