Giter Site home page Giter Site logo

jenkinsci / azure-container-agents-plugin Goto Github PK

View Code? Open in Web Editor NEW
19.0 7.0 27.0 500 KB

Azure Container Agents Plugin for Jenkins

Home Page: https://plugins.jenkins.io/azure-container-agents/

License: MIT License

Java 97.39% HTML 2.61%
azure agent aci azure-aci

azure-container-agents-plugin's Introduction

Azure Container Agents Plugin

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

How to install

You can install/update this plugin in Jenkins update center (Manage Jenkins -> Manage Plugins, search Azure Container Agents Plugin).

Pre-requirements

Azure Container Instance

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.

Pre-requirements

Configure the plugin

  1. Jenkins -> Manage Jenkins -> Configure System
  2. Press Add a new cloud and choose Azure Container Instance
  3. Specify Cloud Name and it should be unique.
  4. Choose an existing Azure Credential or create a new credential.
  5. Choose Resource Group.

Configure the Container Template

  1. Specify Name and Labels
  2. Set Startup Timeout.
  3. Select Image OS Type, Windows or Linux.
  4. Fill in Docker Image. The default image is jenkins/inbound-agent and you can also use it as base image.
  5. If you use a private registry, you need to specify a credential.
  6. Specify a 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.
  7. Specify the Working Dir. Ensure the user has write permission to this directory.
  8. Add Ports, Environment Variables and Volumes as needed.
  9. Choose a retention strategy. You can get details by clicking the help icon.
  10. Specify CPU Requirement and Memory Requirement, ACI containers costs per second. Find more details in Container Instances pricing.
  11. Decide if the container instance should use a private IP address or not. You can get details by clicking the help icon.

Configure Azure Container Instance via Groovy Script

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)

Azure Kubernetes Service

If you were previously using this plugin to integrate with AKS you should use the Kubernetes plugin instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.