Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: separate pipelines per environment into single deployment pipeline #52

Merged
merged 12 commits into from
May 5, 2022

Conversation

julie-ng
Copy link
Collaborator

@julie-ng julie-ng commented May 5, 2022

Purpose

Previously we had separate dev.yaml and production.yaml pipelines. In part because I was paranoid about what code was going where and tried to get security via code, e.g. this vars/global.yaml.

variables:
  isMain:              ${{ eq(variables['Build.SourceBranch'], 'refs/heads/main') }}
  isProduction:        ${{ eq(variables['Build.SourceBranch'], 'refs/heads/production') }}
  isTag:               ${{ startsWith(variables['Build.SourceBranch'], 'refs/tags/v') }}
  isFork:              ${{ eq(variables['System.PullRequest.IsFork'], 'True') }}
  isPR:                ${{ eq(variables['Build.Reason'], 'PullRequest') }}
  isTrustedCode:       ${{ eq(variables.isFork, 'False') }}
  isScheduled:         ${{ eq(variables['Build.Reason'], 'Schedule') }}
  isTrustedCI:         ${{ and( eq(variables.isFork,'False'), eq(variables.isPR,'False'), eq(variables.isScheduled,'False') ) }}

Actually this is convoluted. Instead, we will

  • apply security guardrails in form of Approval on the credentials (service connection or variable group)
  • using single pipeline allows for linear CI --> Dev --> Production staging visualization that many customers want.

Screen Shot 2022-05-05 at 13 29 22

Instead of looking for which branch triggered the deployment, we can recognize from the circles, which environment was deployed. Note: in the current YAML, main and production are separate triggers. So you will never get all 3 stages (e.g. circles) green in a single pipeline run.

@julie-ng julie-ng merged commit 521cea9 into main May 5, 2022
@julie-ng julie-ng deleted the fix/azure-pipelines branch May 5, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant