Azure Pipeline Part 9 – Resources

Azure Pipeline Part 9 – Resources

Azure Pipeline Part 9 – Resources

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

Today we are going to discuss how to use Resources in Azure Pipeline with examples. A resource is any external service that is consumed as part of your pipeline. An example of a resource is another CI/CD pipeline that produces:

  • Artifacts like Azure Pipelines or Jenkins.
  • Code repositories like GitHub, Azure Repos, or Git.
  • Container-image registries like Azure Container Registry or Docker hub.

Resources in YAML represent sources of pipelines, containers, repositories, and types.

Azure Pipeline Part 9 – Resources

Prerequisites:

Setup:

Azure Pipeline – Pipeline Resource:

If you have an Azure pipeline that produces artifacts, your pipeline can consume the artifacts by using the pipeline keyword to define a pipeline resource. You can also enable pipeline-completion triggers.

Azure Pipeline – Pipeline Resource Syntax:

Azure Pipeline – Pipeline Resource Example:

Azure Pipeline – Repository Resource:

If your pipeline has templates in another repository, or if you want to use multi-repo checkout with a repository that requires a service connection, you must let the system know about that repository. The repository keyword lets you specify an external repository.

Azure Pipeline – Repository Resource Syntax:

Azure Pipeline – Repository Resource Example:

Create a service connection to GitHub as shown in this link.

Azure Pipeline – Container Resource:

Container jobs let you isolate your tools and dependencies inside a container. The agent launches an instance of your specified container then runs steps inside it. The container keyword lets you specify your container images.

Azure Pipeline – Container Resource Syntax:

Azure Pipeline – Container Resource Example:

Azure Pipeline – Package Resource:

You can consume NuGet and npm GitHub packages as a resource in YAML pipelines. When specifying package resources, set the package as NuGet or npm.

Azure Pipeline – Package Resource Syntax:

Azure Pipeline – Package Resource Example:

Create a service connection to GitHub package as shown in this link.

You need to have a GitHub package, create one if don’t have using this guide.

Clean up:

Hope you have enjoyed this article. To know more about Azure DevOps, please refer below official documentation

https://docs.microsoft.com/en-us/azure/devops/?view=azure-devops

Leave a Reply

Close Menu