This is a custom GitHub action meant for updating Azure Stream Analytics (ASA) jobs
There is a known blocker with ASA that Terraform, ARM Templates, that you must first stop the running job before updating the transformation. This action looks to remedy the need to update and wrap it in a stop and start.
In your GitHub workflow, you can ideally use the action azure/login@v2
to
establish an Azure Login for this action.
NOTE: this action makes use of
DefaultAzureCredentials
to automatically use an available credential based upon the fallback rules. see defaultazurecredential
In the following, the Azure Login step is used, then a bash command to read in
the ASA SQL to an environment variable, which is then passed to the settings on
this action for the job-query
.
asa-deployment:
runs-on: ubuntu-latest
name: 'ASA Deployment'
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Azure login
uses: azure/login@v2
with:
creds:
'{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{
secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{
secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{
secrets.AZURE_TENANT_ID }}"}'
- name: Read asa job query
id: file_reader
run: |
content=$(cat ./Asa/sosvariance/sosvariance.asaql)
echo "FILE_CONTENT<<EOF" >> $GITHUB_ENV
echo "$content" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: ASA Deployment
uses: cicorias/[email protected]
with:
cmd: update
job-name: foobar
resource-group: myResourceGroup
subscription: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
job-query: ${{ env.FILE_CONTENT }}
restart: true
log-level: info
inputs:
cmd:
description: The command to run
required: true
job-name:
description: The name of the job to update
required: true
resource-group:
description: The resource group of the job
required: true
subscription:
description: The subscription of the job
required: true
job-query:
description: The query to update the job with
required: false
restart:
description: restart the job
required: false
start-time:
description: instead of last update time
required: false
log-level:
description: The log level - verbose, info, warning, error
required: false
default: warning
outputs:
job-start-status:
description: streaming job information
You can make use of the npm package npm i -g @github/local-action
to test
locally. There is a sample.env
file that illustrates the required INPUT_vars
needed.
- run
npm ci
- run
npm run test
npm run all
-- this will prep the bundle for a push -- using the vercel bundler, along with formatting, linting, etc.
"bundle": "npm run format:write && npm run package",
"ci:test": "npx jest",
"coverage": "npx make-coverage-badge --output-path ./badges/coverage.svg",
"format:write": "npx prettier --write .",
"format:check": "npx prettier --check .",
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
"lint:fix": "npx eslint . -c ./.github/linters/.eslintrc.yml --fix",
"package": "npx ncc build src/index.ts -o dist --source-map --license licenses.txt",
"package:watch": "npm run package -- --watch",
"test": "npx jest",
"all": "npm run format:write && npm run lint && npm run test
&& npm run coverage && npm run package",
"local:action": "local-action . src/index.ts .env"
run the ./script/release
command to push an updated tag.