Do you want to build and deploy your Spin applications from within Azure DevOps pipelines? No matter if you want to target Fermyon Wasm Functions or Fermyon Cloud, the extensions I published to the Visual Studio Marketplace are here to help.

Earlier today I published three distinct extensions for Azure DevOps allowing you to do all-the-things Spin, Fermyon Cloud and Fermyon Wasm Functions straight from within your Azure DevOps pipelines.

Although everything could be accomplished using good old bash scripts as part of your pipeline, dedicated “steps” are way more convenient and integrate seamlessly with core concepts of Azure DevOps pipelines like referencing variables, secrets, or leveraging variables produced by those steps to lay out control flow (conditions).

Before diving into the details, here’s how the three extensions fit together:

The Azure DevOps Extension for Spin is the foundation, giving you everything you need to build, test, and work with Spin applications inside a pipeline.

On top of that, you add one of the deployment-focused extensions depending on your target: use the Fermyon Wasm Functions extension if you want globally distributed, serverless runtime deployments, or the Fermyon Cloud extension if you prefer hosting on Fermyon’s managed cloud platform. In short: Spin handles building, and you pick Fermyon Wasm Functions or Fermyon Cloud for where you want to run your app.

Azure DevOps Extension for Spin🔗

No matter if you want to deploy straight to Fermyon Wasm Functions or Fermyon Cloud, the Azure DevOps Extension for Spin lays the foundation and provides all necessary steps to:

  • Install Spin CLI
  • Install different Spin Plugins
  • Retrieve the version of Spin CLI
  • Build Spin Application
  • Execute any sub-command from Spin CLI

For example, consider the following Azure DevOps pipeline YAML, which illustrates how to install the latest version of the Spin CLI (spin) including a set of reasonable plugins (namely cloud, aka) and how to compile a Spin application (executing spin build):

steps:

- checkout: self
  fetchDepth: 1

- task: Bash@3
  displayName: Install wasm32-wasi target for Rust
  inputs:
    targetType: inline
    script: rustup target add wasm32-wasip1

- task: spin-tool@1
  displayName: Install Spin CLI
  inputs:
    version: 'latest'
    plugins: true
    templates: false

- task: spin-build@1
  displayName: Build the Spin App

You can use this link to install the Azure DevOps Extension for Spin straight from the Visual Studio Marketplace.

Azure DevOps Extension for Fermyon Wasm Functions🔗

Fermyon Wasm Functions - our fully managed, globally distributed, and serverless runtime - is your deployment target? Then you should also install the Azure DevOps Extension for Fermyon Wasm Functions, which allows you to:

  • Log in to Fermyon Wasm Functions using a Personal Access Token (PAT)
  • Deploy Spin applications to Fermyon Wasm Functions
  • Retrieve Application Identifiers from Fermyon Wasm Functions

The following YAML snippet shows how you authenticate against Fermyon Wasm Functions using a PAT, check if the application already exists within your account, and either perform a first-time deployment or update the application already existing on your account. In the snippet, the PAT is specified using the pipeline secret fwf.pat :

variables:
  appName: hello-azdo

steps:

- checkout: self
  fetchDepth: 1

- task: Bash@3
  displayName: Install wasm32-wasi target for Rust
  inputs:
    targetType: inline
    script: rustup target add wasm32-wasip1

- task: spin-tool@1
  displayName: Install Spin CLI
  inputs:
    version: 'latest'
    plugins: true
    templates: false

- task: spin-build@1
  displayName: Build the Spin App

- task: spin-aka-login@1
  displayName: Login to Fermyon Wasm Functions
  inputs:
    token: $(fwf.pat)

- task: get-fermyon-wasm-functions-app-id@1
  displayName: Get Fermyon Wasm Functions App ID
  inputs:
    appName: $(appName)

- task: deploy-to-fermyon-wasm-functions@1
  displayName: First Time FWF Deployment
  condition: eq(variables['fwfAppId'], '')
  inputs:
    createName: $(appName)

- task: deploy-to-fermyon-wasm-functions@1
  displayName: Recurring FWF Deployment
  condition: ne(variables['fwfAppId'], '')
  inputs:
    appId: $(fwfAppId) 

You can use this link to install the Azure DevOps Extension for Fermyon Wasm Functions straight from the Visual Studio Marketplace.

Azure DevOps Extension for Fermyon Cloud🔗

Fermyon Cloud is a great place for developers to host their Spin applications. (Did you know that you can run up to 5 Spin applications for free on Fermyon Cloud?). The Azure DevOps Extension for Fermyon Cloud contains two steps allowing you to:

  • Log in to Fermyon Cloud using a Personal Access Token (PAT)
  • Deploy a Spin Application to Fermyon Cloud

Again, let’s take a quick look at a subset of an Azure DevOps pipeline. This time we authenticate against Fermyon Cloud using a PAT and deploy the Spin application to Fermyon Cloud. The PAT is pulled from the pipeline secret fc.pat:

steps:

- checkout: self
  fetchDepth: 1

- task: Bash@3
  displayName: Install wasm32-wasi target for Rust
  inputs:
    targetType: inline
    script: rustup target add wasm32-wasip1

- task: spin-tool@1
  displayName: Install Spin CLI
  inputs:
    version: 'latest'
    plugins: true
    templates: false

- task: spin-build@1
  displayName: Build the Spin App

- task: spin-cloud-login@1
  inputs:
    token: $(fc.pat)
    
- task: spin-cloud-deploy@1

You can use this link to install the Azure DevOps Extension for Fermyon Cloud straight from the Visual Studio Marketplace.

What if you need more🔗

Although I tried to address the most common scenarios with those Azure DevOps Extensions, chances are that you miss a command or that you find yourself enhancing your Azure DevOps pipelines with raw bash scripts. Please let me know if that’s the case. I’d love to extend those extensions and provide robust steps addressing your needs.

You can either leave a comment below or file a new issue over on GitHub at https://github.com/ThorstenHans/fermyon-tasks-az-devops/issues