mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 11:37:00 +00:00
Refactor Packer templates for Windows and Ubuntu images (#12305)
Co-authored-by: Shamil Mubarakshin <127750046+shamil-mubarakshin@users.noreply.github.com>
This commit is contained in:
@@ -76,7 +76,6 @@ In any case, you will need these software installed:
|
||||
|
||||
This repository includes a script that assists in generating images in Azure.
|
||||
All you need is an Azure subscription, a resource group in that subscription and a build agent configured as described above.
|
||||
We suggest starting with building the UbuntuMinimal image because it includes only basic software and builds in less than 30 minutes.
|
||||
|
||||
All the commands below should be executed in PowerShell.
|
||||
|
||||
@@ -99,7 +98,7 @@ Finally, run the `GenerateResourcesAndImage` function, setting the mandatory arg
|
||||
- `ResourceGroupName` - the name of the resource group that will store the resulting artifact (e.g., "imagegen-test").
|
||||
The resource group must already exist in your Azure subscription;
|
||||
- `AzureLocation` - the location where resources will be created (e.g., "East US");
|
||||
- `ImageType` - the type of image to build (we suggest choosing "UbuntuMinimal" here; other valid options are "Windows2019", "Windows2022", "Windows2025", "Ubuntu2204", "Ubuntu2404").
|
||||
- `ImageType` - the type of image to build (valid options are "Windows2019", "Windows2022", "Windows2025", "Ubuntu2204", "Ubuntu2404").
|
||||
|
||||
This function automatically creates all required Azure resources and initiates the Packer image generation for the selected image type.
|
||||
|
||||
@@ -200,11 +199,14 @@ Then, you can invoke Packer in your CI/CD pipeline using the following commands:
|
||||
|
||||
```powershell
|
||||
packer plugins install github.com/hashicorp/azure 2.2.1
|
||||
packer build -var "subscription_id=$SubscriptionId" `
|
||||
|
||||
packer build -only "$BuildName*" `
|
||||
-var "subscription_id=$SubscriptionId" `
|
||||
-var "client_id=$ClientId" `
|
||||
-var "client_secret=$ClientSecret" `
|
||||
-var "install_password=$InstallPassword" `
|
||||
-var "location=$Location" `
|
||||
-var "image_os=$ImageOS" `
|
||||
-var "managed_image_name=$ImageName" `
|
||||
-var "managed_image_resource_group_name=$ImageResourceGroupName" `
|
||||
-var "tenant_id=$TenantId" `
|
||||
@@ -213,13 +215,15 @@ packer build -var "subscription_id=$SubscriptionId" `
|
||||
|
||||
Where:
|
||||
|
||||
- `BuildName` - name of the build defined in Packer template's `build{}` block (e.g. "ubuntu-24_04", "windows-2025");
|
||||
- `SubscriptionId` - your Azure Subscription ID;
|
||||
- `ClientId` and `ClientSecret` - Service Principal credentials;
|
||||
- `TenantId` - Azure Tenant ID;
|
||||
- `InstallPassword` - password for the user used to install software (Windows only);
|
||||
- `Location` - location where resources will be created (e.g., "East US");
|
||||
- `ImageOS` - the type of OS that will be deployed as a temporary VM (e.g. "ubuntu24", "win25");
|
||||
- `ImageName` and `ImageResourceGroupName` - name of the resource group where the managed image will be stored;
|
||||
- `TemplatePath` - path to the Packer template file (e.g., "images/windows/templates/windows-2022.pkr.hcl").
|
||||
- `TemplatePath` - path to the folder with Packer template files (e.g., "images/windows/templates").
|
||||
|
||||
### Required variables
|
||||
|
||||
|
||||
Reference in New Issue
Block a user