CI and CD isn't just to ship finished features faster; it's to finish features faster.
Reduce design cycle time by sharing work-in-progress.
Reduce stakeholder approval time by showing approval candidates easily.
Stop sharing localhost:9000
over WebEx! Slap a link into Slack instead.
Push a branch, get a 'free' review site
This repository (public link): https://github.com/thinkcompany/netlify-static
is watched by Netlify (not a public link): https://app.netlify.com/sites/netlify-static/overview
...and it deploys here (public link): https://netlify-static.thinkcompany.dev/
JOHN DEMONSTRATES A PUSH TO MASTER
- A push to
master
shows up at netlify-static.thinkcompany.dev a minute or two later. - You can watch the build come together in Netlify (if you were logged in to Netlify)
- You can see the finished deployment announced in Slack.
So far, this is well-traveled ground; a finished feature was pushed to a production site.
JOHN DEMONSTRATES A FEATURE BRANCH BUILD
- A push to
branch-name
shows up as a new deploy in Netlify - The URL of the build is
branch-name--netlify-static.netlify.app
- I usually use the Slack annoucement to get this URL. You can copy and paste this URL into any message you like.
At Think, we use this process a lot to share work-in-progress with design colleagues, and to share features with stakeholders. We also use it for pull requests!
This saves a lot of time as a reviewer, because you don't have to warm up the code, pull the branch, build the server, etc.
Netlify is a vendor implementation with all the bells and whistles, including branch builds and Slack notifications.
We'll work through the process of creating a simpler deployment in Azure. All the bells and whistles can be added to what we're going to do.
Ryan Killeen's HOWTO is on Google Docs here, and we'll be following that recipe.
- Log in to Azure Portal and create a new storage account.
- Activate "static website"
- Add
index.html
and record Storage Account Name, Primary Endpoint, andkey1
.
- Log in to Azure DevOps) and create an organization and project.
- Create a build pipeline and point to GitHub.
- Create the
.yaml
build script
- Create a release pipeline
- Add an artifact, and record the Source Alias
- Activate the continuous deployment trigger
- Name the first stage of the release and add a task
- Add a powershell script inline, and configure with the Source Alias, Storage Account Name, and
key1
. - Save changes and trigger a release.
- Commit a change to source control
- Watch the build kick off
- Watch the release... release
- Check the primary endpoint!
Item | URL | |
---|---|---|
GitHub Repository | https://github.com/thinkcompany/phillydevops | |
Azure Portal storage account | Storage account name: TK access key: TK |
|
Azure DevOps project | Project name: TK Source alias: TK |
|
Web location | URL here |
This was John's first pass at building CD in Azure
Item | URL |
---|---|
GitHub Repository | https://github.com/thinkcompany/phillydevops |
Azure Portal storage account | phillydevops |
Azure DevOps project | think-azure-sandbox |
Web location | https://phillydevops.z13.web.core.windows.net/ |
This was John's second pass at building CD in Azure
Item | URL |
---|---|
GitHub Repository | https://github.com/thinkcompany/phillydevops |
Azure Portal storage account | Storage account name: phillydevops2 access key: ZWq5ehezW7dHXUnr9WNPm6AKCHpALLNfOvf08/CxxcJ5TfS0FtOZ/hxl4eYjc7Y9Jo6WAmlSidpobRn1JVyKbQ== |
Azure DevOps project | phillydevops Source alias: _thinkcompany.phillydevops |
Web location | https://phillydevops2.z13.web.core.windows.net/ |
Write-Host "Change Folder Location"
cd $(System.DefaultWorkingDirectory)/_thinkcompany.phillydevops/drop
Write-Host "Push files to blob storage"
az storage blob upload-batch -s ./ -d '$web' --account-name phillydevops2 --account-key "ZWq5ehezW7dHXUnr9WNPm6AKCHpALLNfOvf08/CxxcJ5TfS0FtOZ/hxl4eYjc7Y9Jo6WAmlSidpobRn1JVyKbQ=="
You can use these files as starters for your own deployment.
Get twelve months of free Azure services here: https://azure.microsoft.com/en-us/free/
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Write-Host "Change Folder Location"
cd $(System.DefaultWorkingDirectory)/_[your-source-alias]/drop
Write-Host "Push files to blob storage"
az storage blob upload-batch -s ./ -d '$web' --account-name [account-name-from-access-key page] --account-key "[your account key, in quotes]"