Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: App job documentation updates - avm/res/app/job #2074

Merged
merged 41 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cc56f4a
Update documentation to include metadata and parameter types. Breakin…
ReneHezser May 21, 2024
51a0200
adds resource types
ReneHezser May 22, 2024
3eff66a
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser May 23, 2024
b61bfa8
adds types and improves documentation
ReneHezser May 24, 2024
289a1d8
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser May 24, 2024
d3d48f3
adds manual trigger type
ReneHezser May 24, 2024
e8d22cf
removes unwanted comments
ReneHezser May 24, 2024
e9b1eee
improves documentation
ReneHezser May 24, 2024
e422efb
reverts accidential gitignore changes
ReneHezser May 24, 2024
d91889c
adds secret keyvault examples
ReneHezser May 24, 2024
552c3c4
makes psrule happy
ReneHezser May 25, 2024
0d9a4be
psrule
ReneHezser May 25, 2024
2c34df9
changes max and waf-aligned tests and improves documentation
ReneHezser May 26, 2024
c0c518a
documentation update
ReneHezser May 26, 2024
fb2f74b
main.json saved as CRLF
ReneHezser May 26, 2024
a3b6f01
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser May 26, 2024
d581bdc
LF for main bicep and json
ReneHezser May 26, 2024
9df3c8a
bumps major version
ReneHezser May 26, 2024
50e493e
fixes type
ReneHezser May 27, 2024
eb11101
changes the version to 0.2
ReneHezser May 28, 2024
7b9438e
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser May 28, 2024
9ec200c
Update avm/res/app/job/tests/e2e/max/dependencies.bicep
ReneHezser May 28, 2024
b8fad64
removes unnecessary comment
ReneHezser May 28, 2024
802734c
adjusts output value
ReneHezser May 28, 2024
ca6121b
Merge branch 'main' into app-job-documentation-updates
ReneHezser May 28, 2024
9561c2c
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser May 28, 2024
5fb4e93
Merge branch 'main' into app-job-documentation-updates
ReneHezser May 29, 2024
ff36102
changes some custom type names
ReneHezser May 29, 2024
37db089
Merge branch 'main' into app-job-documentation-updates
ReneHezser May 30, 2024
8e6ed43
adds examples for outputs
ReneHezser May 31, 2024
43f3cb3
Merge branch 'main' into app-job-documentation-updates
ReneHezser May 31, 2024
61b6d8b
updates custom types, documentation and parameters
ReneHezser May 31, 2024
c2a8b23
forgot set-avmmodule
ReneHezser May 31, 2024
0d4c81f
CRLF, again :-( changed to LF, again.
ReneHezser Jun 3, 2024
1ec928b
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser Jun 3, 2024
db6d13d
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser Jun 3, 2024
faca750
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser Jun 5, 2024
847fe14
updates storage account id handling
ReneHezser Jun 5, 2024
639ef99
cleanup of variables
ReneHezser Jun 5, 2024
edf7556
Merge branch 'Azure:main' into app-job-documentation-updates
ReneHezser Jun 5, 2024
cce8eb5
Merge branch 'main' into app-job-documentation-updates
eriqua Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,282 changes: 1,148 additions & 134 deletions avm/res/app/job/README.md

Large diffs are not rendered by default.

465 changes: 449 additions & 16 deletions avm/res/app/job/main.bicep

Large diffs are not rendered by default.

707 changes: 689 additions & 18 deletions avm/res/app/job/main.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions avm/res/app/job/tests/e2e/defaults/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ module testDeployment '../../../main.bicep' = [
triggerType: 'Manual'
manualTriggerConfig: {
replicaCompletionCount: 1
parallelism: 1
}
containers: [
{
name: 'simple-hello-world-container'
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
resources: {
// workaround as 'float' values are not supported in Bicep, yet the resource providers expects them. Related issue: https://github.com/Azure/bicep/issues/1386
cpu: json('0.25')
cpu: '0.25'
memory: '0.5Gi'
}
}
Expand Down
39 changes: 39 additions & 0 deletions avm/res/app/job/tests/e2e/max/dependencies.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,36 @@ resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2022-
location: location
}

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-04-01' = {
name: uniqueString('${managedEnvironmentName}storage')
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
properties: {
allowSharedKeyAccess: true
allowBlobPublicAccess: false
minimumTlsVersion: 'TLS1_2'
networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Deny'
}
}
tags: {
'hidden-title': 'This is visible in the resource name'
Env: 'test'
}

resource storageQueueService 'queueServices@2023-04-01' = {
name: 'default'

resource storageQueue 'queues@2023-04-01' = {
name: 'jobs-queue'
}
}
}

@description('The resource ID of the created Managed Identity.')
output managedIdentityResourceId string = managedIdentity.id

Expand All @@ -38,3 +68,12 @@ output managedEnvironmentResourceId string = managedEnvironment.id

@description('The principal ID of the created Managed Identity.')
output managedIdentityPrincipalId string = managedIdentity.properties.principalId

@description('The name of the storage account created.')
output storageAccountName string = storageAccount.name

@description('The name of the storage queue created.')
output storageQueueName string = storageAccount::storageQueueService::storageQueue.name

@description('The resource ID of the storage account created.')
output storageAccountResourceId string = storageAccount.id
92 changes: 78 additions & 14 deletions avm/res/app/job/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ param serviceShort string = 'ajmax'
@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '#_namePrefix_#'

// needed for using listKeys in the secrets, as the storage account is created in the nested deployment and the value needs to exist at the time of deployment
var storageAccountName = uniqueString('dep-${namePrefix}-menv-${serviceShort}storage')
var storageAccountId = '/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Storage/storageAccounts/${storageAccountName}'

// =========== //
// Deployments //
// =========== //
Expand Down Expand Up @@ -70,27 +74,45 @@ module testDeployment '../../../main.bicep' = [
nestedDependencies.outputs.managedIdentityResourceId
]
}
secrets: {
secureList: [
{
name: 'customtest'
value: guid(deployment().name)
}
]
}
triggerType: 'Manual'
manualTriggerConfig: {
replicaCompletionCount: 1
triggerType: 'Event'
eventTriggerConfig: {
parallelism: 1
replicaCompletionCount: 1
scale: {
minExecutions: 1
maxExecutions: 1
pollingInterval: 55
rules: [
{
name: 'queue'
type: 'azure-queue'
metadata: {
queueName: nestedDependencies.outputs.storageQueueName
storageAccountResourceId: nestedDependencies.outputs.storageAccountResourceId
}
auth: [
{
secretRef: 'connectionString'
triggerParameter: 'connection'
}
]
}
]
}
}
secrets: [
{
name: 'connection-string'
value: listKeys(storageAccountId, '2023-04-01').keys[0].value
}
]
containers: [
{
name: 'simple-hello-world-container'
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
resources: {
// workaround as 'float' values are not supported in Bicep, yet the resource providers expects them. Related issue: https://github.com/Azure/bicep/issues/1386
cpu: json('0.25')
memory: '0.5Gi'
cpu: '1.25'
memory: '1.5Gi'
}
probes: [
{
Expand All @@ -109,6 +131,48 @@ module testDeployment '../../../main.bicep' = [
periodSeconds: 3
}
]
env: [
{
name: 'AZURE_STORAGE_QUEUE_NAME'
value: nestedDependencies.outputs.storageQueueName
}
{
name: 'AZURE_STORAGE_CONNECTION_STRING'
secretRef: 'connection-string'
}
]
volumeMounts: [
{
volumeName: '${namePrefix}${serviceShort}emptydir'
mountPath: '/mnt/data'
}
]
}
{
name: 'second-simple-container'
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
env: [
{
name: 'SOME_ENV_VAR'
value: 'some-value'
}
]
args: [
'arg1'
'arg2'
]
command: [
'/bin/bash'
'-c'
'echo hello'
'sleep 100000'
]
}
]
volumes: [
{
storageType: 'EmptyDir'
name: '${namePrefix}${serviceShort}emptydir'
}
]
roleAssignments: [
Expand Down
10 changes: 5 additions & 5 deletions avm/res/app/job/tests/e2e/waf-aligned/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ module testDeployment '../../../main.bicep' = [
environmentResourceId: nestedDependencies.outputs.managedEnvironmentResourceId
workloadProfileName: serviceShort
location: resourceLocation
triggerType: 'Manual'
manualTriggerConfig: {
replicaCompletionCount: 1
triggerType: 'Schedule'
scheduleTriggerConfig: {
cronExpression: '0 0 * * *'
parallelism: 1
replicaCompletionCount: 1
}
containers: [
{
name: 'simple-hello-world-container'
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
resources: {
// workaround as 'float' values are not supported in Bicep, yet the resource providers expects them. Related issue: https://github.com/Azure/bicep/issues/1386
cpu: json('0.25')
cpu: '0.25'
memory: '0.5Gi'
}
probes: [
Expand Down
4 changes: 2 additions & 2 deletions avm/res/app/job/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.1",
"version": "0.2",
"pathFilters": [
"./main.json"
]
}
}