Skip to content

Commit

Permalink
Add pre-commit for Bicep files (#273)
Browse files Browse the repository at this point in the history
* Add pre-commit for Bicep files

* Format all Bicep files

* Bump pre-commit
  • Loading branch information
cecheta authored Feb 5, 2024
1 parent 3fbbe72 commit d808211
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 118 deletions.
19 changes: 16 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ repos:
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [--extend-ignore=E501]
- id: flake8
args: [--extend-ignore=E501]

- repo: local
hooks:
- id: bicep
name: bicep
description: Lint and build Bicep files
entry: ./scripts/generate_arm_templates.sh
language: script
files: \.bicep$
require_serial: true
args: # Bicep files that we want to generate ARM templates from
- -f=./infra/deployment.bicep
- -f=./extensions/infrastructure/main.bicep
2 changes: 1 addition & 1 deletion code/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest==8.0.0
pytest-cov==4.1.0
flake8==7.0.0
pre-commit==3.5.0
pre-commit==3.6.0
black==23.12.1
70 changes: 35 additions & 35 deletions extensions/infrastructure/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ param AzureFormRecognizerEndpoint string
@secure()
param AzureFormRecognizerKey string

@description('Storage Account Name - Created during the "Chat with your data" Solution Accelerator')
@description('Storage Account Name - Created during the "Chat with your data" Solution Accelerator')
param AzureBlobAccountName string

@description('Storage Account Key - Created during the "Chat with your data" Solution Accelerator')
Expand Down Expand Up @@ -151,39 +151,39 @@ resource Function 'Microsoft.Web/sites@2018-11-01' = {
properties: {
siteConfig: {
appSettings: [
{ name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4'}
{ name: 'WEBSITES_ENABLE_APP_SERVICE_STORAGE', value: 'false'}
{ name: 'APPINSIGHTS_CONNECTION_STRING', value: AppInsightsConnectionString}
{ name: 'AZURE_SEARCH_SERVICE', value: 'https://${AzureSearchName}.search.windows.net'}
{ name: 'AZURE_SEARCH_INDEX', value: AzureSearchIndex}
{ name: 'AZURE_SEARCH_CONVERSATIONS_LOG_INDEX', value: AzureSearchConversationLogIndex}
{ name: 'AZURE_SEARCH_KEY', value: AzureSearchKey}
{ name: 'AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG', value: AzureSearchSemanticSearchConfig}
{ name: 'AZURE_SEARCH_INDEX_IS_PRECHUNKED', value: AzureSearchIndexIsPrechunked}
{ name: 'AZURE_SEARCH_TOP_K', value: AzureSearchTopK}
{ name: 'AZURE_SEARCH_ENABLE_IN_DOMAIN', value: AzureSearchEnableInDomain}
{ name: 'AZURE_SEARCH_CONTENT_COLUMNS', value: AzureSearchContentColumns}
{ name: 'AZURE_SEARCH_FILENAME_COLUMN', value: AzureSearchFilenameColumn}
{ name: 'AZURE_SEARCH_TITLE_COLUMN', value: AzureSearchTitleColumn}
{ name: 'AZURE_SEARCH_URL_COLUMN', value: AzureSearchUrlColumn}
{ name: 'AZURE_OPENAI_RESOURCE', value: AzureOpenAIResource}
{ name: 'AZURE_OPENAI_KEY', value: AzureOpenAIKey}
{ name: 'AZURE_OPENAI_MODEL', value: AzureOpenAIModel}
{ name: 'AZURE_OPENAI_MODEL_NAME', value: AzureOpenAIModelName}
{ name: 'AZURE_OPENAI_TEMPERATURE', value: AzureOpenAITemperature}
{ name: 'AZURE_OPENAI_TOP_P', value: AzureOpenAITopP}
{ name: 'AZURE_OPENAI_MAX_TOKENS', value: AzureOpenAIMaxTokens}
{ name: 'AZURE_OPENAI_STOP_SEQUENCE', value: AzureOpenAIStopSequence}
{ name: 'AZURE_OPENAI_SYSTEM_MESSAGE', value: AzureOpenAISystemMessage}
{ name: 'AZURE_OPENAI_API_VERSION', value: AzureOpenAIApiVersion}
{ name: 'AZURE_OPENAI_STREAM', value: AzureOpenAIStream}
{ name: 'AZURE_OPENAI_EMBEDDING_MODEL', value: AzureOpenAIEmbeddingModel}
{ name: 'AZURE_FORM_RECOGNIZER_ENDPOINT', value: AzureFormRecognizerEndpoint}
{ name: 'AZURE_FORM_RECOGNIZER_KEY', value: AzureFormRecognizerKey}
{ name: 'AZURE_BLOB_ACCOUNT_NAME', value: AzureBlobAccountName}
{ name: 'AZURE_BLOB_ACCOUNT_KEY', value: AzureBlobAccountKey}
{ name: 'AZURE_BLOB_CONTAINER_NAME', value: AzureBlobContainerName}
{ name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy}
{ name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' }
{ name: 'WEBSITES_ENABLE_APP_SERVICE_STORAGE', value: 'false' }
{ name: 'APPINSIGHTS_CONNECTION_STRING', value: AppInsightsConnectionString }
{ name: 'AZURE_SEARCH_SERVICE', value: 'https://${AzureSearchName}.search.windows.net' }
{ name: 'AZURE_SEARCH_INDEX', value: AzureSearchIndex }
{ name: 'AZURE_SEARCH_CONVERSATIONS_LOG_INDEX', value: AzureSearchConversationLogIndex }
{ name: 'AZURE_SEARCH_KEY', value: AzureSearchKey }
{ name: 'AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG', value: AzureSearchSemanticSearchConfig }
{ name: 'AZURE_SEARCH_INDEX_IS_PRECHUNKED', value: AzureSearchIndexIsPrechunked }
{ name: 'AZURE_SEARCH_TOP_K', value: AzureSearchTopK }
{ name: 'AZURE_SEARCH_ENABLE_IN_DOMAIN', value: AzureSearchEnableInDomain }
{ name: 'AZURE_SEARCH_CONTENT_COLUMNS', value: AzureSearchContentColumns }
{ name: 'AZURE_SEARCH_FILENAME_COLUMN', value: AzureSearchFilenameColumn }
{ name: 'AZURE_SEARCH_TITLE_COLUMN', value: AzureSearchTitleColumn }
{ name: 'AZURE_SEARCH_URL_COLUMN', value: AzureSearchUrlColumn }
{ name: 'AZURE_OPENAI_RESOURCE', value: AzureOpenAIResource }
{ name: 'AZURE_OPENAI_KEY', value: AzureOpenAIKey }
{ name: 'AZURE_OPENAI_MODEL', value: AzureOpenAIModel }
{ name: 'AZURE_OPENAI_MODEL_NAME', value: AzureOpenAIModelName }
{ name: 'AZURE_OPENAI_TEMPERATURE', value: AzureOpenAITemperature }
{ name: 'AZURE_OPENAI_TOP_P', value: AzureOpenAITopP }
{ name: 'AZURE_OPENAI_MAX_TOKENS', value: AzureOpenAIMaxTokens }
{ name: 'AZURE_OPENAI_STOP_SEQUENCE', value: AzureOpenAIStopSequence }
{ name: 'AZURE_OPENAI_SYSTEM_MESSAGE', value: AzureOpenAISystemMessage }
{ name: 'AZURE_OPENAI_API_VERSION', value: AzureOpenAIApiVersion }
{ name: 'AZURE_OPENAI_STREAM', value: AzureOpenAIStream }
{ name: 'AZURE_OPENAI_EMBEDDING_MODEL', value: AzureOpenAIEmbeddingModel }
{ name: 'AZURE_FORM_RECOGNIZER_ENDPOINT', value: AzureFormRecognizerEndpoint }
{ name: 'AZURE_FORM_RECOGNIZER_KEY', value: AzureFormRecognizerKey }
{ name: 'AZURE_BLOB_ACCOUNT_NAME', value: AzureBlobAccountName }
{ name: 'AZURE_BLOB_ACCOUNT_KEY', value: AzureBlobAccountKey }
{ name: 'AZURE_BLOB_CONTAINER_NAME', value: AzureBlobContainerName }
{ name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy }
]
cors: {
allowedOrigins: [
Expand Down Expand Up @@ -214,4 +214,4 @@ resource WaitFunctionDeploymentSection 'Microsoft.Resources/deploymentScripts@20
dependsOn: [
Function
]
}
}
2 changes: 1 addition & 1 deletion extensions/teams/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ module azureBotRegistration './botRegistration/azurebot.bicep' = {

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output BOT_AZURE_APP_SERVICE_RESOURCE_ID string = webApp.id
output BOT_DOMAIN string = webApp.properties.defaultHostName
output BOT_DOMAIN string = webApp.properties.defaultHostName
2 changes: 1 addition & 1 deletion extensions/teams/infra/botRegistration/azurebot.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@202
properties: {
channelName: 'MsTeamsChannel'
}
}
}
Loading

0 comments on commit d808211

Please sign in to comment.