Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ Pipeline strategies for a mono-repo โ€“ experiences with our Football Match Center projects in CodeCatalyst

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Pipeline strategies for a mono-repo โ€“ experiences with our Football Match Center projects in CodeCatalyst


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

Both Christian and I have been writing about our โ€œFootball Match Centerโ€ project โ€“ and as part of this project we obviously also needed a CI/CD (Continuous Integration and Continuous Deployment) pipeline. Our aim was to be able to integrate changes that we do regularly and see commits to the main branch being directly and automatically deployed to our environments.

I will first try to define some pre-requisites and then talk about learnings and experiences.

What is a mono-repo

A mono-repo is an abbreviation of a โ€œmono repositoryโ€ which I understand as being a single repository, where different microservices or components are stored and saved in the same git repository. This can be various different services, infrastructure or user interface components or backend services.

A mono-repo has special requirements when building the CI/CD pipeline.

Expectations for our CI/CD pipeline

For our CI/CD pipeline we wanted to be able push changes to production quickly and be able to iterate fast. We wanted to achieve 100% automation for everything required for our project. As we have been writing, we completely develop this project using Amazon CodeCatalyst and thus the pipeline also should be build using the Workflows in CodeCatalyst.

Going forward we want to ensure that the pipeline also includes all CI/CD best practices as well as security scans and automated integration or end to end tests.

How to structure your pipelines

In this article we will purely focus on the CI/CD pipeline for your โ€œmainโ€ or โ€œtrunkโ€ branch โ€“ the production branch that will be used to deploy your software or product to the production environment.

We will not consider pipelines that should be executed on feature branches or on pull request creation.

The โ€œone-pipeline-to-rule-them-allโ€ approach

In this approach all services are deployed within the same pipeline. This means that there is only a single pipeline for the โ€œmainโ€ branch. All services that are independed rom each other can deployed in parallel, services that have a dependency need to be deployed one after another. Dependencies or information from one to another service can be pushed through the pipeline using environment variables.

This can lead to longer deployment/execution timelines but ensures that โ€œone commitโ€ to this โ€œmainโ€ branch is always deployed completely after a commit. If tests are included in the pipeline, they will need to cover all aspects of the application.

The โ€œcontext-specificโ€ or โ€œcomponent-specificโ€ approach

Different components or contextes get a different pipeline โ€“ which means that e.g. the backend-services are deployed in one pipeline and the frontend-services in a different pipeline.

In this approach, you automate the deployments for components and need to ensure that, if there are dependencies between the components, the pipeline verifies the dependencies. If one component requires information from another one you need to pass these dependencies using other options.

This can lead to faster iteration cycles for specific components but increases the complexity of the pipeline dependencies. You can also do not directly see if a specific commit has been deployed for all components or not.

The โ€œone-pipeline-for-each-serviceโ€ approach

This is the most decoupled option for building a CI/CD pipeline. Each service (lambda function, backend, microservice) gets its own pipeline. For each service, you can implement service specific steps as part of the pipeline.

One of the main requirement for this is that the services are fully decoupled, otherwise managing dependencies can get very difficult. However, this allows a very fast iteration and development cycle for each microservice as the pipeline execution for each service is usually very fast.

The pipeline needs to verify the dependencies for each service as it executes the deployment.

Football Match Center โ€“ our experiences with building our CI/CD pipeline in Amazon CodeCatalyst

For our project we decided to start with a โ€œmono-repoโ€ โ€“ in our case today, we have a CDK application (written in Typescript) that describes the required infrastructure and includes Lambda functions (where required) and a user interface which is written in Flutter.

From a deployment perspective, the CDK application needs to be deployed on AWS and the Flutter application then needs to be deployed on a S3 bucket to serve as a Single Page Application (SPA) behind Cloudfront. Obviously this deployment/upload has the pre-requisite of the S3 bucket to be already available.

How we started

We started, very classic, with the โ€œone-pipeline-to-rule-them-allโ€ approach. We had one single pipeline that was used to deploy all services that are part of the infrastructure.

This pipeline started with โ€œcdk synthโ€ using the โ€œCDK deployโ€ action in CodeCatalyst and then had other steps that depended on the first one โ€“ to executing the โ€œflutter buildโ€ and later the โ€œUI deployโ€ (using the S3 deploy action).

In this first version, the CDK deploy step had variables/output with the name of the S3 bucket and the CloudFront distribution ID passing it it to the next step where the output of โ€œflutter buildโ€ was then uploaded and the CloudFront distribution invalidation request was triggered.

In this approach a commit to the โ€œmainโ€ branch always triggered the same pipeline and this pipeline deployed the complete application.

We also used only natively available CodeCatalyst actions for deployment โ€“ โ€œcdk deployโ€ and โ€œbuildโ€. For the Flutter action we used a Github Action for flutter.

Experiences and pipeline adjustments

With this approach we had the problem that the Flutter build step took ~8 minutes and blocked a new iteration of changes in the CDK application or the lambda function. Thus, this slowed down our development cycle.

In addition to that we found out that there was no possibility to influence the CDK version with the CDK deploy action โ€“ but we wanted to be able to use the version defined in our Projen project โ€“ to be able to deploy to development environments from our local with the same version as from the CI/CD pipeline.

Both of these findings and experiences brought us to implement some changes to the pipeline:

  • We separated the UI build from the CDK build
  • We moved away from using โ€œcdk deployโ€ and replaced it with a โ€œbuildโ€ step โ€“ to be able to trigger โ€œprojenโ€ as part of the pipeline

So now we have two pipelines:

  1. CDK deployment
    • Triggered on changes to the โ€œcdk-app/*โ€ folder
    • Executing CDK synth, build and deploy steps โ€“ but not using the โ€œcdk deployโ€ action but a normal build step instead
    • We adjusted the CDK app to include Cloudformation exports that exports the S3 bucket name and the Cloudfront distribution ID
  2. Ui deployment
    • Triggered on changes to the โ€œui/*โ€ folder
    • Reads the values for the S3 bucket and the CloudFront distribution ID from the CloudFormation exports using the AWS cli
    • Executing the Flutter build steps and the S3 deploy action

These changes reduced in faster iterations for the development cycle of the CDK app and allowed decoupling the backend from the UI part. We were also able to fix the CDK version to the version we have selected in Projen.

In our project we have chosen the โ€œ context-specific โ€ approach for the pipeline.

My recommendations for building CI/CD pipelines for a mono-repo

Our CI/CD pipeline is not perfect yet and weโ€™re yet to add some important things to our pipeline.

From the experiences we have made I am still not convinced that our โ€œcontext-speficโ€ approach is the right path.

As of writing this post in early April 2023 Iโ€™m inclined to move towards a model where we combine the โ€œcontext specificโ€ and the โ€œone-pipeline-to-rule-them-allโ€ approach: context-specific for โ€œlowerโ€, non production environments and then a single pipeline that does the promotion to our production environment.

Today we do not yet have a production environment, so we did not answer that question yet ! :-)

How do you solve this challenge around building CI/CD pipelines for mono-repos?

...



๐Ÿ“Œ Connecting to AWS AppSync using Amplify for Flutter for our Football Match Center


๐Ÿ“ˆ 43.42 Punkte

๐Ÿ“Œ CI/CD Pipeline for Terraform Workflow Using Amazon CodeCatalyst


๐Ÿ“ˆ 38.13 Punkte

๐Ÿ“Œ Validating Python code with a CodeCatalyst Pipeline.


๐Ÿ“ˆ 38.13 Punkte

๐Ÿ“Œ Custom BluePrints in CodeCatalyst โ€“ templated projects that empower you to build better software


๐Ÿ“ˆ 36.78 Punkte

๐Ÿ“Œ Facial Recognition Tech To Be Implemented Again At Cardiff-Swansea Football Match โ€“ Expert Reaction


๐Ÿ“ˆ 27.18 Punkte

๐Ÿ“Œ Iran is doing to our networks what it did to our spy drone, claims Uncle Sam: Now they're bombing our hard drives


๐Ÿ“ˆ 26.74 Punkte

๐Ÿ“Œ Match 2: 90 Second Summary - Google DeepMind Challenge Match


๐Ÿ“ˆ 26.38 Punkte

๐Ÿ“Œ Match 5: 90 Second Summary - Google DeepMind Challenge Match 2016


๐Ÿ“ˆ 26.38 Punkte

๐Ÿ“Œ Match 4: 90 Second Summary - Google DeepMind Challenge Match 2016


๐Ÿ“ˆ 26.38 Punkte

๐Ÿ“Œ Match 3: 90 Second Summary - Google DeepMind Challenge Match 2016


๐Ÿ“ˆ 26.38 Punkte

๐Ÿ“Œ Match 1: 90 Second Summary - Google DeepMind Challenge Match 2016


๐Ÿ“ˆ 26.38 Punkte

๐Ÿ“Œ A first look at Amazon CodeCatalyst โ€“ Managing your Cloud-Build & Deployment infrastructure natively on AWS


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ A second look at Amazon CodeCatalyst โ€“ CI/CD natively on AWS to empower developers to deliver faster and reduce heavy lifting


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ How CodeCatalyst compares to other AWS Services related to Development and CI/CD processes


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ Sending notifications from CodeCatalyst Workflows in March 2023


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ Amazon CodeCatalyst Quality Reports - What Reports Should Be


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ Bootstrapping AWS CDK Automation With Amazon CodeCatalyst


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ AWS re:Invent: Amazon CodeCatalyst, AWS Step Functions distributed map, and more


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ Amazon Codecatalyst reaches โ€œGAโ€ status and becomes available for general use


๐Ÿ“ˆ 26.37 Punkte

๐Ÿ“Œ Crafting Experiences: Strategies for Mobile Apps


๐Ÿ“ˆ 24.87 Punkte

๐Ÿ“Œ Transitioning From Monoliths to Microservices: Companies, Experiences, and Migration Strategies


๐Ÿ“ˆ 24.87 Punkte

๐Ÿ“Œ Tackling side projects and Sunday football with OutSystems


๐Ÿ“ˆ 24.4 Punkte

๐Ÿ“Œ 5 Strategies To Secure Your Custom Software Development Pipeline


๐Ÿ“ˆ 23.88 Punkte

๐Ÿ“Œ Colonial Pipeline cyberattack shuts down pipeline that supplies 45% of East Coast's fuel


๐Ÿ“ˆ 23.53 Punkte

๐Ÿ“Œ Colonial Pipeline Initiates Restart of Pipeline Operations After Ransomware Attack


๐Ÿ“ˆ 23.53 Punkte

๐Ÿ“Œ Dockerizing an Ansible playbook, and deploying to K8s via Gitlab pipeline - -Part 2:deploy to K8s via Gitlab pipeline


๐Ÿ“ˆ 23.53 Punkte

๐Ÿ“Œ Akademy2020's call for papers is now open. Join KDE's big yearly event as a speaker and tell us all about your projects and experiences.


๐Ÿ“ˆ 23.17 Punkte

๐Ÿ“Œ Poor Grades Tied To Class Times That Don't Match Our Biological Clocks


๐Ÿ“ˆ 22.11 Punkte

๐Ÿ“Œ Continuing our journey to bring instant experiences to the whole web


๐Ÿ“ˆ 21.67 Punkte

๐Ÿ“Œ Sony's CEO describes a PlayStation future with Windows and AI: "We will expand our gaming experiences to PC, cloud, and mobile."


๐Ÿ“ˆ 21.67 Punkte

๐Ÿ“Œ Opinion: 5G Has an Exciting Future When It Comes To Dedicated Mobile Apps But Will Do Little To Improve Our General Browsing Experiences.


๐Ÿ“ˆ 21.67 Punkte

๐Ÿ“Œ Discover 2023's Cloud Security Strategies in Our Upcoming Webinar - Secure Your Spot


๐Ÿ“ˆ 21.03 Punkte

๐Ÿ“Œ Join our webinar to learn about the rise of DDoS attacks, its threat to your security strategies, and what can be done to stop them.


๐Ÿ“ˆ 21.03 Punkte











matomo