Skip to content

Commit 2bd138b

Browse files
[feat] improve azure docs
1 parent 8859428 commit 2bd138b

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

content/guides/azure-pipelines.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ params:
88
time: 10 minutes
99
---
1010

11+
> This guide was created by [Kristiyan Velkov](https://www.linkedin.com/in/kristiyan-velkov-763130b3/).
12+
1113
## Prerequisites
1214

1315
Before you begin, ensure the following requirements are met:
@@ -83,7 +85,10 @@ stages:
8385
$(buildTag)
8486
$(latestTag)
8587
dockerfile: './Dockerfile'
86-
arguments: '--sbom=true --attest type=provenance --cache-from $(imageName):latest'
88+
arguments: |
89+
--sbom=true
90+
--attest type=provenance
91+
--cache-from $(imageName):latest
8792
env:
8893
DOCKER_BUILDKIT: 1
8994

@@ -129,7 +134,7 @@ This pipeline is triggered automatically on:
129134
- Commits pushed to the `main` branch
130135
- Pull requests targeting `main` main branch
131136

132-
> [!NOTE]
137+
> [!TIP]
133138
> Learn more: [Define pipeline triggers in Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops)
134139

135140

@@ -148,7 +153,7 @@ These variables ensure consistent naming, versioning, and reuse throughout the p
148153
- `buildTag`: a unique tag for each pipeline run
149154
- `latestTag`: a stable alias for your most recent image
150155

151-
> [!NOTE]
156+
> [!TIP]
152157
> Learn more: [Define and use variables in Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch)
153158

154159

@@ -166,7 +171,7 @@ This stage executes only if:
166171
- The pipeline completes successfully.
167172
- The source branch is main.
168173

169-
> [!NOTE]
174+
> [!TIP]
170175
> Learn more: [Stage conditions in Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/stages?view=azure-devops&tabs=yaml)
171176

172177
### Step 4: Job Configuration
@@ -181,7 +186,7 @@ jobs:
181186

182187
This job uses the latest Ubuntu VM image provided by Microsoft-hosted agents. It can be swapped with a custom pool for self-hosted agents if needed.
183188

184-
> [!NOTE]
189+
> [!TIP]
185190
> Learn more: [Specify a pool in your pipeline](https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/pools-queues?view=azure-devops&tabs=yaml%2Cbrowser)
186191

187192
#### Step 4.1 Checkout Code
@@ -195,7 +200,7 @@ steps:
195200

196201
This step pulls your repository code into the build agent, so the pipeline can access the Dockerfile and application files.
197202

198-
> [!NOTE]
203+
> [!TIP]
199204
> Learn more: [checkout step documentation](https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines)
200205

201206

@@ -211,38 +216,45 @@ This step pulls your repository code into the build agent, so the pipeline can a
211216

212217
Uses a preconfigured Azure DevOps Docker registry service connection to authenticate securely without exposing credentials directly.
213218

214-
> [!NOTE]
219+
> [!TIP]
215220
> Learn more: [Use service connections for Docker Hub](https://learn.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops#docker-hub-or-others)
216221

217222

218223
#### Step 4.3 Build the Docker Image
219224

220225
```yaml
221-
- task: Docker@2
222-
displayName: Build Docker Image
223-
inputs:
224-
command: build
225-
repository: $(imageName)
226-
tags: |
227-
$(buildTag)
228-
$(latestTag)
229-
dockerfile: './Dockerfile'
230-
arguments: '--cache-from $(imageName):latest'
231-
env:
232-
DOCKER_BUILDKIT: 1
226+
- task: Docker@2
227+
displayName: Build Docker Image
228+
inputs:
229+
command: build
230+
repository: $(imageName)
231+
tags: |
232+
$(buildTag)
233+
$(latestTag)
234+
dockerfile: './Dockerfile'
235+
arguments: |
236+
--sbom=true
237+
--attest type=provenance
238+
--cache-from $(imageName):latest
239+
env:
240+
DOCKER_BUILDKIT: 1
233241
```
234242

235243
This builds the image with:
236244

237-
- Two tags: one with the build ID and one as latest
238-
- Docker BuildKit for faster builds and layer caching
239-
- Cache pull from the last pushed latest tag
240-
241-
> [!NOTE]
242-
> Learn more: [Docker task for Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/docker-v2?view=azure-pipelines&tabs=yaml)
245+
- Two tags: one with the unique Build ID and one as latest
246+
- Docker BuildKit enabled for faster builds and efficient layer caching
247+
- Cache pull from the most recent pushed latest image
248+
- Software Bill of Materials (SBOM) for supply chain transparency
249+
- Provenance attestation to verify how and where the image was built
243250

251+
> [!TIP]
252+
> Learn more:
253+
> - [Docker task for Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/docker-v2?view=azure-pipelines&tabs=yaml)
254+
> - [Docker SBOM Attestations](/build/metadata/attestations/slsa-provenance/#create-a-provenance-attestation)
244255

245256
#### Step 4.4 Push the Docker Image
257+
246258
```yaml
247259
- task: Docker@2
248260
displayName: Push Docker Image
@@ -260,7 +272,7 @@ This uploads both tags to Docker Hub:
260272
- `latest` is used for most recent image references.
261273

262274

263-
5. Logout from Docker (Self-Hosted Agents)
275+
#### Step 4.5 Logout from Docker (Self-Hosted Agents)
264276

265277
```yaml
266278
- script: docker logout
@@ -288,4 +300,4 @@ With this Azure Pipelines CI setup, you get:
288300
- [Azure Pipelines Documentation](https://learn.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops) - Comprehensive guide to configuring and managing CI/CD pipelines in Azure DevOps.
289301
- [Docker Task for Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker) - Detailed reference for using the Docker task in Azure Pipelines to build and push images.
290302
- [Docker Buildx Bake](/manuals/build/bake/_index.md) - Explore Docker's advanced build tool for complex, multi-stage, and multi-platform build setups. See also the [Mastering Buildx Bake Guide](/guides/bake/index.md) for practical examples and best practices.
291-
- [Docker Build Cloud](/guides/docker-build-cloud/_index.md) - Learn about Docker's managed build service for faster, scalable, and multi-platform image builds in the cloud.
303+
- [Docker Build Cloud](/guides/docker-build-cloud/_index.md) - Learn about Docker's managed build service for faster, scalable, and multi-platform image builds in the cloud.

0 commit comments

Comments
 (0)