Guidance on splitting the build and deploy phases #1198
Unanswered
aaronpowell
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I've split the workflows for the template I'm working on into 2 actions files. The first runs on commits to main and pull-requests flowchart LR
Build --> Test --> Merge
The main branch is protected and requires this workflow to pass to merge. name: Validate application
on:
workflow_dispatch:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Azure CLI script
uses: azure/CLI@v1
with:
inlineScript: az bicep build -f infra/main.bicep
// ... test and lint my application Then the deployment flow works off main only and does the remaining steps. flowchart LR
Commit --> Provision --> Deploy
The latest update to azd will set the auto-generated actions file to only run on main/master. The biggest downside so far is that if someone force-pushes to the main branch it'll deploy without having tested. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you run
azd deploy
it will perform a build of the project that you're trying to deploy, but from a CI/CD perspective, this can make it opaque as to which point an error occurred or prevent you from placing a gate in the pipeline to prevent excessive deployments. Essentially, so you could do this:This way, if there is a failure in the
Build
phase, say a compilation error, you won't run theProvision
orDeploy
phases, reducing the feedback cycle. Additionally, you could inject more parallel phases beforeProvision
, such as running tests, performing linting, etc.It would be good if there was some guidance on what the approach should be on how you would split the two phases apart so there's a clear step in the pipeline file for each phase.
This will also make it easier to have reusable build assets (such as container images) that get migrated between environments, without a rebuild.
Beta Was this translation helpful? Give feedback.
All reactions