diff --git a/.github/workflows/ingestion_client.yaml b/.github/workflows/ingestion_client.yaml index f1233c672..17fcd85fa 100644 --- a/.github/workflows/ingestion_client.yaml +++ b/.github/workflows/ingestion_client.yaml @@ -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 }} @@ -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}" diff --git a/samples/ingestion/ingestion-client/.devcontainer/devcontainer.json b/samples/ingestion/ingestion-client/.devcontainer/devcontainer.json index 71021a49e..b434ec530 100644 --- a/samples/ingestion/ingestion-client/.devcontainer/devcontainer.json +++ b/samples/ingestion/ingestion-client/.devcontainer/devcontainer.json @@ -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, diff --git a/samples/ingestion/ingestion-client/.pre-commit-config.yaml b/samples/ingestion/ingestion-client/.pre-commit-config.yaml new file mode 100644 index 000000000..6c87c0473 --- /dev/null +++ b/samples/ingestion/ingestion-client/.pre-commit-config.yaml @@ -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 \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/README.md b/samples/ingestion/ingestion-client/README.md index 9c37e0f1b..6593b6efc 100644 --- a/samples/ingestion/ingestion-client/README.md +++ b/samples/ingestion/ingestion-client/README.md @@ -1,6 +1,6 @@ # Ingestion Client -