Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 3 additions & 5 deletions eng/docker-tools/DEV-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,10 @@ The system has built-in retry logic but requires manual intervention after repea

Once you've fixed the underlying problem (Dockerfile change, test fix, etc.) and have a successful build:

1. Navigate to the successful pipeline run in Azure DevOps
2. Add the `autobuilder` label to that run
3. This signals to the infrastructure that a successful build has occurred
4. The system will resume automatic rebuilds for that image as needed
1. Manually queue a build for the affected image paths
2. After the build succeeds, the system will resume automatic rebuilds for that image as needed

The `autobuilder` label is how the infrastructure tracks that the failure cycle has been broken and normal operations can resume.
The infrastructure considers the three most recent pipeline runs, so any successful run breaks the failure cycle.

---

Expand Down
2 changes: 1 addition & 1 deletion eng/docker-tools/Install-DotNetSdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ param(
[string]
$InstallPath,
[string]
$Channel = "9.0"
$Channel = "10.0"
)

Set-StrictMode -Version Latest
Expand Down
89 changes: 89 additions & 0 deletions eng/docker-tools/Update-ImageBuilder.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env pwsh

<#
.SYNOPSIS
Example script that updates the bundled docker-tools infrastructure in the current repo to a specific
ImageBuilder image.

.DESCRIPTION
ImageBuilder ships a copy of the eng/docker-tools infrastructure and writes it back to disk via its
'update' command. The reference that 'update' records into
eng/docker-tools/templates/variables/docker-images.yml is supplied as an argument rather than being
baked into the build, so the caller decides exactly which image the repo should pin to.

This example resolves the multi-platform (manifest list / image index) digest of an ImageBuilder image
(the published 'latest' tag by default) and passes that digest reference to the 'update' command, which
runs inside the same image with the repository mounted so it can rewrite eng/docker-tools on disk.

.PARAMETER ImageBuilderImage
The ImageBuilder image to resolve and run. Defaults to the published 'latest' tag.

.PARAMETER RepoRoot
The root of the git repository to update. Defaults to the current directory.

.NOTES
To exercise an unpublished ImageBuilder (for example, the 'update' command before it is released),
build the image, push it to a registry it can be pulled from, and pass its reference via
-ImageBuilderImage. The digest is read from the registry, so the image must be pushed first.
#>
[CmdletBinding()]
param(
[string]
$ImageBuilderImage = "mcr.microsoft.com/dotnet-buildtools/image-builder:latest",

[string]
$RepoRoot = (Get-Location).Path
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

function Exec {
param ([string] $Cmd)

Write-Output "Executing: '$Cmd'"
Invoke-Expression $Cmd
if ($LASTEXITCODE -ne 0) {
throw "Failed: '$Cmd'"
}
}

# Strip any existing tag or digest so the resolved digest can be appended to the bare repository name.
# A tag is a ':' within the final path segment; a registry host's ':port' precedes the last '/', so it
# must not be mistaken for a tag.
function Get-RepositoryName {
param ([string] $Reference)

$withoutDigest = $Reference.Split('@')[0]
$lastSlash = $withoutDigest.LastIndexOf('/')
$lastColon = $withoutDigest.LastIndexOf(':')
if ($lastColon -gt $lastSlash) {
return $withoutDigest.Substring(0, $lastColon)
}

return $withoutDigest
}

# Resolve the multi-platform digest. 'docker buildx imagetools inspect' reads the top-level manifest
# straight from the registry, so for a multi-arch image this is the manifest list (image index) digest
# rather than a single platform's digest. Pinning the index keeps the reference valid on every
# platform the pipeline runs on.
$digest = (docker buildx imagetools inspect $ImageBuilderImage --format '{{.Manifest.Digest}}')
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($digest)) {
throw "Unable to resolve a multi-platform digest for '$ImageBuilderImage'."
}

$repository = Get-RepositoryName $ImageBuilderImage
$imageBuilderRef = "$repository@$($digest.Trim())"

Write-Output "Resolved ImageBuilder reference: $imageBuilderRef"

# Run 'update' from the resolved digest, mounting the repository so it can write eng/docker-tools to
# disk. The command must run from the repository root, which is why $RepoRoot is the mounted working
# directory. Running by the same digest that gets recorded keeps the writer and the pinned reference
# identical.
Exec ("docker run --rm " `
+ "-v `"${RepoRoot}:/repo`" " `
+ "-w /repo " `
+ "$imageBuilderRef " `
+ "update $imageBuilderRef")
2 changes: 1 addition & 1 deletion eng/docker-tools/templates/jobs/cg-build-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ parameters:
# See https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#options for possible Channel values
- name: dotnetVersionChannel
type: string
default: '9.0'
default: '10.0'
displayName: .NET Version
# Additional steps to run before building projects (e.g. custom SDK installation).
- name: initSteps
Expand Down
68 changes: 0 additions & 68 deletions eng/docker-tools/templates/stages/setup-service-connections.yml

This file was deleted.

108 changes: 0 additions & 108 deletions eng/docker-tools/templates/steps/init-docker-linux.yml

This file was deleted.

55 changes: 0 additions & 55 deletions eng/docker-tools/templates/steps/init-docker-windows.yml

This file was deleted.

Loading
Loading