Skip to content

Commit 64843c6

Browse files
[fix] linting issues
1 parent df81e99 commit 64843c6

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

content/guides/azure-pipelines.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ This pipeline is triggered automatically on:
139139
> [!TIP]
140140
> Learn more: [Define pipeline triggers in Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops)
141141

142-
143142
### Step 2: Define Common Variables
144143

145144
```yaml
@@ -174,6 +173,7 @@ This stage executes only if:
174173
> [!TIP]
175174
> Learn more: [Stage conditions in Azure Pipelines](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/stages?view=azure-devops&tabs=yaml)
176175

176+
177177
### Step 4: Job Configuration
178178

179179
```yaml
@@ -197,15 +197,13 @@ This job utilizes the latest Ubuntu VM image with Docker support, provided by Mi
197197
steps:
198198
- checkout: self
199199
displayName: Checkout Code
200-
201200
```
202201

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

205204
> [!TIP]
206205
> Learn more: [checkout step documentation](https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines)
207206

208-
209207
#### Step 4.2 Authenticate to Docker Hub
210208

211209
```yaml
@@ -221,7 +219,6 @@ Uses a preconfigured Azure DevOps Docker registry service connection to authenti
221219
> [!TIP]
222220
> 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)
223221

224-
225222
#### Step 4.3 Build the Docker Image
226223

227224
```yaml
@@ -267,29 +264,24 @@ This builds the image with:
267264
tags: |
268265
$(buildTag)
269266
$(latestTag)
270-
271267
```
268+
272269
By applying this condition, the pipeline builds the Docker image on every run to ensure early detection of issues, but only pushes the image to the registry when changes are merged into the main branch—keeping your Docker Hub clean and focused
273270

274271
This uploads both tags to Docker Hub:
275272
- `$(buildTag)` ensures traceability per run.
276273
- `latest` is used for most recent image references.
277-
-
278-
279274

280275
#### Step 4.5 Logout from Docker (Self-Hosted Agents)
281276

282277
```yaml
283278
- script: docker logout
284279
displayName: Docker Logout (Self-hosted only)
285280
condition: ne(variables['Agent.OS'], 'Windows_NT')
286-
287281
```
288282

289283
Executes docker logout at the end of the pipeline on Linux-based self-hosted agents to proactively clean up credentials and enhance security posture.
290284

291-
---
292-
293285
## Summary
294286

295287
With this Azure Pipelines CI setup, you get:
@@ -298,7 +290,6 @@ With this Azure Pipelines CI setup, you get:
298290
- Efficient builds leveraging Docker BuildKit cache.
299291
- Safe cleanup with logout on persistent agents.
300292
- Build images that meet modern software supply chain requirements with SBOM and attestation
301-
---
302293

303294
## Further Reading
304295

0 commit comments

Comments
 (0)