From 51470abbe8ff6b81cf627dd471bd980836d5777c Mon Sep 17 00:00:00 2001 From: AlexanderSehr Date: Fri, 20 Dec 2024 14:40:45 +0100 Subject: [PATCH] Fixed reade --- .../dev-ops/cicd-agents-and-runners/README.md | 343 +++++++++++++++++- .../cicd-agents-and-runners/main.bicep | 12 + .../dev-ops/cicd-agents-and-runners/main.json | 40 +- 3 files changed, 382 insertions(+), 13 deletions(-) diff --git a/avm/ptn/dev-ops/cicd-agents-and-runners/README.md b/avm/ptn/dev-ops/cicd-agents-and-runners/README.md index 65992ecd24..1e4be4038e 100644 --- a/avm/ptn/dev-ops/cicd-agents-and-runners/README.md +++ b/avm/ptn/dev-ops/cicd-agents-and-runners/README.md @@ -136,7 +136,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<
-via JSON Parameter file +via JSON parameters file ```json { @@ -182,6 +182,38 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-app' + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + networkType: 'createNew' + virtualNetworkName: 'vnet-aca' +} +param selfHostedConfig = { + agentsPoolName: 'agents-pool' + devOpsOrganization: 'azureDevOpsOrganization' + personalAccessToken: '' + selfHostedType: 'azuredevops' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 2: _Using only defaults for Azure DevOps self-hosted agents using Azure Container Instances._ This instance deploys the module with the minimum set of required parameters for Azure DevOps self-hosted agents in Azure Container Instances. @@ -223,7 +255,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -268,6 +300,37 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + networkType: 'createNew' + virtualNetworkName: 'vnet-aci' +} +param selfHostedConfig = { + agentsPoolName: 'aci-pool' + devOpsOrganization: 'azureDevOpsOrganization' + personalAccessToken: '' + selfHostedType: 'azuredevops' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 3: _Using only defaults for GitHub self-hosted runners using Azure Container Apps._ This instance deploys the module with the minimum set of required parameters for GitHub self-hosted runners in Azure Container Apps. @@ -309,7 +372,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -354,6 +417,37 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-app' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + networkType: 'createNew' + virtualNetworkName: 'vnet-aca' +} +param selfHostedConfig = { + githubOrganization: 'githHubOrganization' + githubRepository: 'dummyRepo' + personalAccessToken: '' + selfHostedType: 'github' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 4: _Using large parameter set for Azure DevOps self-hosted agents using Azure Container Apps._ This instance deploys the module with most of its features enabled for Azure DevOps self-hosted agents using Azure Container Apps. @@ -406,7 +500,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -462,6 +556,48 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-app' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + containerAppSubnetAddressPrefix: '10.0.1.0/24' + containerAppSubnetName: 'acaSubnet' + networkType: 'createNew' + virtualNetworkName: 'vnet-aca' +} +param selfHostedConfig = { + agentNamePrefix: '' + agentsPoolName: 'aca-pool' + azureContainerAppTarget: { + resources: { + cpu: '1' + memory: '2Gi' + } + } + devOpsOrganization: 'azureDevOpsOrganization' + personalAccessToken: '' + placeHolderAgentName: 'acaPlaceHolderAgent' + selfHostedType: 'azuredevops' + targetPipelinesQueueLength: '1' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 5: _Using large parameter set for GitHub self-hosted runners using Azure Container Instances._ This instance deploys the module with most of its features enabled for GitHub self-hosted runners using Azure Container Instances. @@ -515,7 +651,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -572,6 +708,49 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + containerInstanceSubnetAddressPrefix: '10.0.1.0/24' + containerInstanceSubnetName: 'aci-subnet' + networkType: 'createNew' + virtualNetworkName: 'vnet-aci' +} +param selfHostedConfig = { + azureContainerInstanceTarget: { + cpu: 1 + memoryInGB: 2 + numberOfInstances: 3 + sku: 'Standard' + } + ephemeral: true + githubOrganization: 'githHubOrganization' + githubRepository: 'dummyRepo' + personalAccessToken: '' + runnerNamePrefix: '' + runnerScope: 'repo' + selfHostedType: 'github' + targetWorkflowQueueLength: '1' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 6: _Deploys GitHub self-hosted runners using Azure Container Apps for a GitHub organization scope._ This instance deploys the module with the minimum set of required parameters for GitHub self-hosted runners in Azure Container Apps for a GitHub organization scope. @@ -613,7 +792,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -658,6 +837,37 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-app' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + networkType: 'createNew' + virtualNetworkName: 'vnet-aca' +} +param selfHostedConfig = { + githubOrganization: 'githHubOrganization' + personalAccessToken: '' + runnerScope: 'org' + selfHostedType: 'github' +} +// Non-required parameters +param location = '' +param privateNetworking = false +``` + +
+

+ ### Example 7: _Using only defaults for Azure DevOps self-hosted agents using Private networking in an existing vnet._ This instance deploys the module with the minimum set of required parameters Azure DevOps self-hosted agents using Private networking in Azure Container Instances in an existing vnet. @@ -710,7 +920,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -766,6 +976,48 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + computeNetworking: { + computeNetworkType: 'azureContainerInstance' + containerInstanceSubnetName: 'aci-subnet' + } + containerRegistryPrivateDnsZoneResourceId: '' + containerRegistryPrivateEndpointSubnetName: 'acr-subnet' + natGatewayPublicIpAddressResourceId: '' + natGatewayResourceId: '' + networkType: 'useExisting' + virtualNetworkResourceId: '' +} +param selfHostedConfig = { + agentNamePrefix: '' + agentsPoolName: 'aci-pool' + azureContainerInstanceTarget: { + numberOfInstances: 2 + } + devOpsOrganization: 'azureDevOpsOrganization' + personalAccessToken: '' + selfHostedType: 'azuredevops' +} +// Non-required parameters +param location = '' +param privateNetworking = true +``` + +
+

+ ### Example 8: _Using only defaults for GitHub self-hosted runners using Private networking in an existing vnet._ This instance deploys the module with the minimum set of required parameters GitHub self-hosted runners using Private networking in Azure Container Apps in an existing vnet. @@ -817,7 +1069,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -872,6 +1124,47 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + computeNetworking: { + computeNetworkType: 'azureContainerApp' + containerAppDeploymentScriptSubnetName: 'aca-ds-subnet' + containerAppSubnetName: 'aca-subnet' + containerInstanceSubnetName: 'aci-subnet' + deploymentScriptPrivateDnsZoneResourceId: '' + } + containerRegistryPrivateDnsZoneResourceId: '' + containerRegistryPrivateEndpointSubnetName: 'acr-subnet' + natGatewayPublicIpAddressResourceId: '' + natGatewayResourceId: '' + networkType: 'useExisting' + virtualNetworkResourceId: '' +} +param selfHostedConfig = { + githubOrganization: 'githHubOrganization' + githubRepository: 'dummyRepo' + personalAccessToken: '' + selfHostedType: 'github' +} +// Non-required parameters +param location = '' +param privateNetworking = true +``` + +
+

+ ### Example 9: _Using only defaults for GitHub self-hosted runners using Private networking._ This instance deploys the module with the minimum set of required parameters GitHub self-hosted runners using Private networking in Azure Container Instances. @@ -913,7 +1206,7 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

-via JSON Parameter file +via JSON parameters file ```json { @@ -958,6 +1251,37 @@ module cicdAgentsAndRunners 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:<

+

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/dev-ops/cicd-agents-and-runners:' + +// Required parameters +param computeTypes = [ + 'azure-container-instance' +] +param namingPrefix = '' +param networkingConfiguration = { + addressSpace: '10.0.0.0/16' + networkType: 'createNew' + virtualNetworkName: 'vnet-aci' +} +param selfHostedConfig = { + githubOrganization: 'githHubOrganization' + githubRepository: 'dummyRepo' + personalAccessToken: '' + selfHostedType: 'github' +} +// Non-required parameters +param location = '' +param privateNetworking = true +``` + +
+

+ ## Parameters **Required parameters** @@ -1049,7 +1373,6 @@ This section gives you an overview of all local-referenced module files (i.e., o | Reference | Type | | :-- | :-- | -| `ptn/dev-ops/cicd-agents-and-runners` | Local reference | | `br/public:avm/ptn/authorization/resource-role-assignment:0.1.1` | Remote reference | | `br/public:avm/res/app/job:0.4.0` | Remote reference | | `br/public:avm/res/app/managed-environment:0.6.2` | Remote reference | diff --git a/avm/ptn/dev-ops/cicd-agents-and-runners/main.bicep b/avm/ptn/dev-ops/cicd-agents-and-runners/main.bicep index f8efb15b7f..672adb6334 100644 --- a/avm/ptn/dev-ops/cicd-agents-and-runners/main.bicep +++ b/avm/ptn/dev-ops/cicd-agents-and-runners/main.bicep @@ -804,6 +804,7 @@ output location string = location // Definitions // // ================ // +@export() type newNetworkType = { @description('Required. The network type. This can be either createNew or useExisting.') networkType: 'createNew' @@ -854,6 +855,7 @@ type newNetworkType = { deploymentScriptPrivateDnsZoneResourceId: string? } +@export() type existingNetworkType = { @description('Required. The network type. This can be either createNew or useExisting.') networkType: 'useExisting' @@ -877,6 +879,7 @@ type existingNetworkType = { computeNetworking: computeNetworkingType } +@export() type containerAppNetworkConfigType = { @description('Required. The Azure Container App networking type.') computeNetworkType: 'azureContainerApp' @@ -902,12 +905,15 @@ type containerInstanceNetworkConfigType = { containerInstanceSubnetName: string } +@export() @discriminator('networkType') type networkType = newNetworkType | existingNetworkType +@export() @discriminator('computeNetworkType') type computeNetworkingType = containerAppNetworkConfigType | containerInstanceNetworkConfigType +@export() type azureContainerInstanceTargetType = { @description('Optional. The Azure Container Instance Sku name.') sku: 'Standard' | 'Dedicated'? @@ -925,11 +931,13 @@ type azureContainerInstanceTargetType = { port: int? }? +@export() type azureContainerAppTargetType = { @description('Optional. The Azure Container App Job CPU and memory resources.') resources: acaResourcesType? } +@export() type gitHubRunnersType = { @description('Required. The self-hosted runner type.') selfHostedType: 'github' @@ -969,6 +977,7 @@ type gitHubRunnersType = { azureContainerAppTarget: azureContainerAppTargetType? } +@export() type devOpsAgentsType = { @description('Required. The self-hosted runner type.') selfHostedType: 'azuredevops' @@ -1002,6 +1011,7 @@ type devOpsAgentsType = { azureContainerAppTarget: azureContainerAppTargetType? } +@export() type acaResourcesType = | { cpu: '0.25', memory: '0.5Gi' } | { cpu: '0.5', memory: '1Gi' } @@ -1020,8 +1030,10 @@ type acaResourcesType = | { cpu: '3.75', memory: '7.5Gi' } | { cpu: '4', memory: '8Gi' } +@export() @discriminator('selfHostedType') type selfHostedRunnerType = gitHubRunnersType | devOpsAgentsType +@export() @description('Required. The target compute environments for the private runners.') type computeTypesType = ('azure-container-app' | 'azure-container-instance')[] diff --git a/avm/ptn/dev-ops/cicd-agents-and-runners/main.json b/avm/ptn/dev-ops/cicd-agents-and-runners/main.json index c1009244a3..72b959a9c6 100644 --- a/avm/ptn/dev-ops/cicd-agents-and-runners/main.json +++ b/avm/ptn/dev-ops/cicd-agents-and-runners/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.32.4.45862", - "templateHash": "6001450753869128172" + "templateHash": "4749597093525960786" }, "name": "CI CD Agents and Runners", "description": "This module deploys self-hosted agents and runners for Azure DevOps and GitHub on Azure Container Instances and/or Azure Container Apps.", @@ -128,6 +128,9 @@ "description": "Optional. The deployment script private DNS zone Id. If not provided, a new private DNS zone will be created. Only required if private networking is used." } } + }, + "metadata": { + "__bicep_export!": true } }, "existingNetworkType": { @@ -179,6 +182,9 @@ "description": "Required. The compute type networking type." } } + }, + "metadata": { + "__bicep_export!": true } }, "containerAppNetworkConfigType": { @@ -219,6 +225,9 @@ "description": "Required. The container instance subnet name in the created virtual network. If not provided, a default name will be used. This subnet is required for private networking Azure DevOps scenarios to deploy the deployment script which starts the placeholder agent privately." } } + }, + "metadata": { + "__bicep_export!": true } }, "containerInstanceNetworkConfigType": { @@ -253,6 +262,9 @@ "$ref": "#/definitions/existingNetworkType" } } + }, + "metadata": { + "__bicep_export!": true } }, "computeNetworkingType": { @@ -267,6 +279,9 @@ "$ref": "#/definitions/containerInstanceNetworkConfigType" } } + }, + "metadata": { + "__bicep_export!": true } }, "azureContainerInstanceTargetType": { @@ -312,7 +327,10 @@ } } }, - "nullable": true + "nullable": true, + "metadata": { + "__bicep_export!": true + } }, "azureContainerAppTargetType": { "type": "object", @@ -324,6 +342,9 @@ "description": "Optional. The Azure Container App Job CPU and memory resources." } } + }, + "metadata": { + "__bicep_export!": true } }, "gitHubRunnersType": { @@ -421,6 +442,9 @@ "description": "Optional. The GitHub runner Azure Container app configuration." } } + }, + "metadata": { + "__bicep_export!": true } }, "devOpsAgentsType": { @@ -495,6 +519,9 @@ "description": "Optional. The AzureDevOps agents Azure Container app configuration." } } + }, + "metadata": { + "__bicep_export!": true } }, "acaResourcesType": { @@ -564,7 +591,10 @@ "cpu": "4", "memory": "8Gi" } - ] + ], + "metadata": { + "__bicep_export!": true + } }, "selfHostedRunnerType": { "type": "object", @@ -578,6 +608,9 @@ "$ref": "#/definitions/devOpsAgentsType" } } + }, + "metadata": { + "__bicep_export!": true } }, "computeTypesType": { @@ -587,6 +620,7 @@ "azure-container-instance" ], "metadata": { + "__bicep_export!": true, "description": "Required. The target compute environments for the private runners." } }