Skip to content

Instantly share code, notes, and snippets.

@melvinlee
Created May 15, 2020 23:58
Show Gist options
  • Select an option

  • Save melvinlee/ce5819b9b4d2de18284247dd214cecd9 to your computer and use it in GitHub Desktop.

Select an option

Save melvinlee/ce5819b9b4d2de18284247dd214cecd9 to your computer and use it in GitHub Desktop.
#File: .azure-pipelines/azure-pipelines-fluxcd.yaml
trigger:
branches:
include:
- master
- releases/*
paths:
include:
- flux/*
exclude:
- flux/README.md
pool:
vmImage: 'Ubuntu-16.04'
jobs:
- job: InitialJob
steps:
- publish: $(System.DefaultWorkingDirectory)/flux
artifact: flux
# track deployments on the environment
- deployment: DeployFlux
displayName: Deploy Flux to AKS
environment: 'aks-flux'
strategy:
# default deployment strategy
runOnce:
preDeploy:
steps:
- download: current
artifact: flux
deploy:
steps:
- task: AzureCLI@2
displayName: Install Flux
inputs:
azureSubscription: 'Azure Enterprise'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
set -e
echo "acquiring credentials for cluster"
az aks get-credentials -n 'aks' -g 'rg-sandbox-aks'
echo "ensuring flux namespace exists"
kubectl apply -f $(Pipeline.Workspace)/flux/namespace.yaml
echo "ensuring flux secret exists"
kubectl apply -f $(Pipeline.Workspace)/flux/secret.yaml
echo "installing flux. adding fluxcd helm repo"
helm repo add fluxcd https://charts.fluxcd.io
echo "updating chart"
helm repo update
echo "installing flux. installing the main operator"
helm upgrade -i flux fluxcd/flux --wait \
--namespace fluxcd \
--values $(Pipeline.Workspace)/flux/values.yaml \
--version 1.3.0
echo "installing flux. installing the helm operator"
helm upgrade -i helm-operator fluxcd/helm-operator --wait \
--namespace fluxcd \
--set helm.versions=v3 \
--version 1.0.2
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment