L
L
Lagoon
Search…
Triggering Deployments

Trigger a new deployment using Azure Pipelines

In order to automatically trigger new deployments using Azure Pipelines follow these instructions:
    1.
    Add your deployment SSH private key to Azure as a secure file as id_rsa_lagoon. For more information about Secure Files have a look at the Azure Documentation Site.
    2.
    Add the following configuration to your azure-pipelines.yml:
azure-pipelines.yml
1
pool:
2
vmImage: 'ubuntu-latest'
3
4
stages:
5
# .. other stages
6
- stage: Deploy
7
condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/staging', 'refs/heads/develop'))
8
jobs:
9
- job: DeployLagoon
10
steps:
12
name: lagoonSshKey
13
displayName: 'Download Lagoon SSH key'
14
inputs:
15
secureFile: id_rsa_lagoon
16
- script: |
17
curl -L "https://github.com/amazeeio/lagoon-cli/releases/download/0.9.2/lagoon-cli-0.9.2-linux-amd64" -o ./lagoon
18
chmod +x ./lagoon
19
displayName: 'Download lagoon-cli'
20
- script: ./lagoon login -i $(lagoonSshKey.secureFilePath)
21
displayName: 'Log into Lagoon'
22
- script: ./lagoon deploy branch -e $(Build.SourceBranchName) -p my-awesome-project -b $(Build.SourceBranchName) --force
23
displayName: 'Trigger deployment using lagoon-cli'
Copied!
This will trigger a new deployment whenever changes are made on the develop or staging branch. Adjust these values accordingly so they fit your deployment strategy and configuration.

Push without deploying

There may be a case where you want to push without a deployment. Make sure your commit message contains "[skip deploy]" or "[deploy skip]" and Lagoon will not trigger a deployment from that commit.
Last modified 4mo ago