Important: This plug-in is maintained by the Jenkins community and won’t be supported by Microsoft as of February 29, 2024.
Azure Container Agents Plugin can help you to run a container instance as an agent in Jenkins
You can install/update this plugin in Jenkins update center (Manage Jenkins -> Manage Plugins, search Azure Container Agents Plugin).
Azure Container Instances offers the fastest and simplest way to run a container in Azure, without having to provision any virtual machines and without having to adopt a higher-level service.
Add a new cloud
and choose Azure Container Instance
Cloud Name
and it should be unique.Azure Credential
or create a new credential.Resource Group
.Name
and Labels
Startup Timeout
.Image OS Type
, Windows or Linux.Docker Image
. The default image is jenkins/inbound-agent
and you can also use it as base image.Command
. Now the Command
will override the ENTRYPOINT. Arguments
. ${rootUrl}
, ${secret}
, ${instanceIdentity}
and ${nodeName}
will be replaced with JenkinsUrl, Secret, Instance identity and ComputerNodeName automatically.Working Dir
. Ensure the user has write permission to this directory.Ports
, Environment Variables
and Volumes
as needed.CPU Requirement
and Memory Requirement
, ACI containers costs per second. Find more details in Container Instances pricing.You can use the sample below in Manage Jenkins -> Script Console. The sample only contains a few arguments. Find all the arguments in the builders package.
import com.microsoft.jenkins.containeragents.builders.*
def myCloud = new AciCloudBuilder()
.withCloudName("mycloud")
.withAzureCredentialsId("<Your Credentials Id>")
.withResourceGroup("myResourceGroup")
.addNewTemplate()
.withName("mytemplate")
.withLabel("aci")
.addNewPort("80")
.addNewEnvVar("key","value")
.endTemplate()
.build()
Jenkins.get().clouds.add(myCloud)
//inherit template from existing template
import com.microsoft.jenkins.containeragents.builders.*
def baseTemplate = new AciContainerTemplateBuilder()
.withImage("privateImage")
.addNewPort("80")
.addNewEnvVar("key", "value")
.build()
def myCloud = new AciCloudBuilder()
.withCloudName("mycloud")
.withAzureCredentialsId("<Your Credentials Id>")
.withResourceGroup("myResourceGroup")
.addNewTemplateLike(baseTemplate)
.withName("mytemplate")
.withLabel("aci")
.endTemplate()
.build()
Jenkins.get().clouds.add(myCloud)
If you were previously using this plugin to integrate with AKS you should use the Kubernetes plugin instead.