Skip to content

Commit

Permalink
[IngestionClient] refactor: Using bicep template instead of raw ARM j…
Browse files Browse the repository at this point in the history
…son template (#2491)

* Using bicep for provision

* Deleting ArmTemplateBatch.json

* Updating workflow action to fail build if json not in sync with bicep

* Updating docs to generate main.json

* adding vscode pull request extension

* review comments
  • Loading branch information
komalg1 authored Jul 16, 2024
1 parent 0c864b1 commit d0e3f4d
Show file tree
Hide file tree
Showing 9 changed files with 1,846 additions and 1,062 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/ingestion_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,33 @@ on:
paths: ['samples/ingestion/ingestion-client/**', '.github/workflows/ingestion_client.yaml']

jobs:
convert_bicep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az --version
- name: Install Bicep CLI
run: |
az bicep install
az bicep upgrade
- name: Convert Bicep to ARM Template
run: |
az bicep build --file ./samples/ingestion/ingestion-client/infra/main.bicep --outfile ./samples/ingestion/ingestion-client/infra/generated_main.json
- name: Validate ARM Template
run: |
if ! cmp -s ./samples/ingestion/ingestion-client/infra/main.json ./samples/ingestion/ingestion-client/infra/generated_main.json; then
echo "Generated ARM template does not match the existing main.json. Please update main.json accordingly." >&2
exit 1
fi
build:
needs: convert_bicep
runs-on: ubuntu-latest
outputs:
releaseversionoutput: ${{ steps.get_release_versions.outputs.version }}
Expand All @@ -20,7 +46,7 @@ jobs:
id: get_release_versions
run: |
set -u -e -o pipefail
version=$(cat ./samples/ingestion/ingestion-client/Setup/ArmTemplateBatch.json | jq -r .variables.Version)
version=$(cat ./samples/ingestion/ingestion-client/infra/main.json | jq -r .variables.Version)
echo version=$version >> "$GITHUB_OUTPUT"
echo "Batch template: ${version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {}
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1.0.5": {}
},
"postCreateCommand": "pre-commit install",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-pull-request-github",
"ms-dotnettools.csdevkit",
"ms-vscode.azure-account",
"ms-azuretools.vscode-azurefunctions",
"editorconfig.editorconfig"
"editorconfig.editorconfig",
"ms-azuretools.vscode-bicep",
"ms-dotnettools.vscode-dotnet-runtime"
],
"settings": {
"omnisharp.enableRoslynAnalyzers": true,
Expand Down
12 changes: 12 additions & 0 deletions samples/ingestion/ingestion-client/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: local
hooks:
- id: bicep
name: bicep
description: Lint and build Bicep files
entry: ./samples/ingestion/ingestion-client/scripts/generate_arm_templates.sh
language: script
files: \.bicep$
require_serial: true
args: # Bicep files that we want to generate ARM templates from
- -f=./samples/ingestion/ingestion-client/infra/main.bicep
4 changes: 2 additions & 2 deletions samples/ingestion/ingestion-client/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ingestion Client

<!--
<!--
Guidelines on README format: https://review.docs.microsoft.com/help/onboard/admin/samples/concepts/readme-template?branch=master
Guidance on onboarding samples to docs.microsoft.com/samples: https://review.docs.microsoft.com/help/onboard/admin/samples/process/onboarding?branch=master
Expand All @@ -23,7 +23,7 @@ Outline the file contents of the repository. It helps users navigate the codebas
| `StartTranscriptionByServiceBus` | Function to add a new transcription job to the speech service as one-job-per-file. |
| `StartTranscriptionByTimer` | Function to add a new transcription job to the speech service for all files added in a certain period of time. |
| `PowerBI` | Template files and deployment guide for visualizing insights from the accelerator. |
| `Setup` | ARM template to setup the project on Azure. |
| `infra` | Bicep template to setup the project on Azure. |
| `Tests` | Unit tests for both functions. |

## Prerequisites
Expand Down
Loading

0 comments on commit d0e3f4d

Please sign in to comment.