Giter Club home page Giter Club logo

azure-devops-templates's Introduction

Build Status

Azure DevOps Templates

Templates for Azure DevOps build pipelines

build.yaml

Build and package containerised applications.

Pre-requisites

  • must be static HTML, Helm, Node.js or one of the following .NET versions
    • .NET Core 3.1
    • .NET 6.0
    • .NET 8.0
  • must use semantic versioning in package.json for Node.js .csproj for .NET or VERSION for HTML.
  • must have Dockerfile
  • if tests are to be run, docker-compose.test.yaml must exist to run tests with exit on complete
  • Azure DevOps must be setup with connections to GitHub

Steps

  • set build variables
  • run containerised tests if docker-compose.test.yaml exists.
  • determine version for build assets
  • build container image
  • publish container image to DockerHub tagged with version
  • publish Helm chart to Helm chart repository tagged with version
  • create GitHub release tagged with version if doesn't already exist

Usage

Add template repository as a resource to an Azure DevOps pipeline definition. Then add an extends section referencing the build.yaml template.

Parameters

  • name <string>: name to package image and Helm chart with

  • project <string>: .NET only, name of the .NET project to build

  • containerRepository <string> (optional): name of container registry in DockerHub to publish image to. If not supplied will assume johnwatson484/repo

  • helmChartPath <string> (optional): path to Helm chart directory in repository. If not supplied will assume ./helm/repo

  • framework <string> (optional): node, html, helm or net accepted. If not supplied will assume node

  • deploy: true or false accepted. If not supplied will assume false. If true will deploy to Kubernetes cluster

  • namespace <string> (optional): Kubernetes namespace to deploy to.

  • hasSecureHelmValuesFile: true or false accepted. If not supplied will assume false. If true will use helmValuesFile persisted as Azure secure file to override default Helm values

Example (Node.js)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build.yaml@templates
  parameters:
    name: my-repo-name
    deploy: true
    namespace: my-namespace

Example (.NET)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build.yaml@templates
  parameters:
    name: my-repo-name
    project: MyProjectName
    framework: net
    deploy: true
    namespace: my-namespace

Example (HTML)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build.yaml@templates
  parameters:
    name: my-repo-name
    framework: html
    deploy: true
    namespace: my-namespace

Example (Helm)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build.yaml@templates
  parameters:
    name: my-repo-name
    framework: helm
    deploy: true
    namespace: my-namespace

build-nuget.yaml

Build, package and publish NuGet package

Pre-requisites

  • must use semantic versioning in .csproj
  • Azure DevOps must be setup with connections to GitHub and NuGet

Steps

  • determine version for build assets
  • build package
  • publish package to NuGet tagged with version
  • create GitHub release tagged with version if doesn't already exist

Usage

Add template repository as a resource to an Azure DevOps pipeline definition. Then add an extends section referencing the build-nuget.yaml template.

Parameters

  • repo <string>: name of repository

  • project <string>: name of the .NET project to build

Example (Node.js)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build-nuget.yaml@templates
  parameters:
    repo: my-repo-name
    project: MyProjectName

build-container-app.yaml

Build and package containerised applications for Azure Container Apps.

Pre-requisites

  • must be static HTML, Helm, Node.js or one of the following .NET versions
    • .NET Core 3.1
    • .NET 6.0
    • .NET 8.0
  • must use semantic versioning in package.json for Node.js .csproj for .NET or VERSION for HTML.
  • must have Dockerfile
  • if tests are to be run, docker-compose.test.yaml must exist to run tests with exit on complete
  • Azure DevOps must be setup with connections to GitHub

Steps

  • set build variables
  • run containerised tests if docker-compose.test.yaml exists.
  • determine version for build assets
  • build container image
  • publish container image to DockerHub tagged with version
  • publish Helm chart to Helm chart repository tagged with version
  • create GitHub release tagged with version if doesn't already exist

Usage

Add template repository as a resource to an Azure DevOps pipeline definition. Then add an extends section referencing the build.yaml template.

Parameters

  • name <string>: name to package image with

  • project <string>: .NET only, name of the .NET project to build

  • containerRepository <string> (optional): name of container registry in DockerHub to publish image to. If not supplied will assume johnwatson484/repo

  • framework <string> (optional): node, html, helm or net accepted. If not supplied will assume node

  • deploy: true or false accepted. If not supplied will assume false. If true will deploy to Azure Container Apps

Example (Node.js)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build-container-app.yaml@templates
  parameters:
    name: my-repo-name
    deploy: true

Example (.NET)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build-container-app.yaml@templates
  parameters:
    name: my-repo-name
    project: MyProjectName
    framework: net
    deploy: true

Example (HTML)

trigger:
  - main

resources:
  repositories:
  - repository: templates
    type: github
    endpoint: John D Watson
    name: johnwatson484/azure-devops-templates

extends:
  template: build.yaml@templates
  parameters:
    name: my-repo-name
    framework: html
    deploy: true

azure-devops-templates's People

Contributors

johnwatson484 avatar

Watchers

 avatar  avatar

Forkers

orney21d

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.