
to a branch, whereas the pull request-based ones to a pull request. The creation of a
branch or pull request creates a new preview environment. The update of a branch
or pull request updates their corresponding preview environment, and the deletion
destroys them. Gitlab-CI supports branch-based preview environments with their
‘Review Apps’
and Jenkins X supports pull request-based preview environments with
their very own ‘preview environments’
. The pull request-based approach, however,
has a great advantage: there’s a place to put peer reviews and notications. For
example, after every successful deployment of a preview environment, Jenkins X
adds a comment to the pull request. But be aware that developers make mistakes.
It’s possible that with preview environments, mistakes such as memory leaks are
automatically deployed in your cluster. So be sure to add the possibility to limit or
delete a deployment explicitly if it runs havoc.
Trunk-based Development vs. Pull Requests
Weaveworks advocates for operation by pull request
. Any operational change, includ-
ing every deployment, is a result of a pull request getting merged. As the rollout of such
a change is automated, the onboarding of new developers only requires permission to
the respective Git repository and permission to merge pull requests. This approach
ensures peer review and audit trails to make changes observable and accountable.
Tools such as Snyk and Jenkins X use pull requests to propose conguration changes.
As a vulnerability scanner, Snyk proposes mitigation of dependency vulnerabilities
in this way to be reviewed and merged by a repository maintainer. Jenkins X is a
CI/CD solution that implements GitOps in a highly opinionated manner. It uses pull
requests to change deployment congurations and to trigger the deployment pipeline.
After a successful deployment, Jenkins X automatically merges the corresponding pull
request.
But how does this workow t into the common practice of trunk-based development
for truly living Continuous Integration, preached by highly valued opinionators such
as Jez Humble and Martin Fowler?
https://docs.gitlab.com/ee/ci/review_apps
https://jenkins-x.io/v3/admin/guides/preview-environments
https://www.weave.works/blog/gitops-operations-by-pull-request
15