Code Artifact Repositories - seems a fancy word for GitHub or Bitbucket.
While GitHub is a web-based platform for version control, collaboration, hosting, and managing source code repositories. Code Artifact Repositories serve a completely different purpose. It is a centralized location for storing and managing code artifacts which are output of the software development process. These artifacts can include compiled binaries, libraries, dependencies, and other files that are essential for building, deploying, and running software applications.
Let me explain with one example, we use React Native to build cross-platform mobile applications by writing code in JavaScript.
The Android project is built using Gradle build system, Gradle downloads dependencies, compiles Java and native code, processes resources, and generates the final APK. The compilation of code occurs when Gradle processes the code into XML file and further an APK. So this compilation occurs every time we build the app, and it is time-consuming and you don't have control over this process.
This is where code artifact is useful, it can store and cache some of these steps and build the app faster. This also allows you to control the process by pointing your project to your code artifact instead of Gradle's central repository.
Code artifact can also store your npm packages or RubyGems.
How cool is that? 🥶
I know it doesn't seem cool because we can get every package from their respective GitHub repositories. But do you know these external packages can have malicious code or have the ability to take control and crumble your project.
This is getting creepy now. ☠️
I know there's a very little chance for this, but it has happened.
On the enterprise level, companies think of these packages as a threat and prefer to use code artifacts.
Enough about benefits of these artifacts, how do they actually work?
There are a bunch of companies out there who provide this solution. What actually happens is if we want to use code artifacts, we can buy it from said companies and just make little changes in our code and start using them instantly without worrying about a "pirate package". I just made this word up. 🤥
Now these artifact repositories have a built-in firewall, for which they charge more, of course!
This firewall will scan every package coming into the repository and keep it stored within. We can directly install these artifact repositories on our servers and we don't even need the internet to download packages anymore Voila!
Moreover, they can be used in automating SDLC process by storing compiled and built code in them. This ensures whatever code you had written is tested by QA and the same built code is going to production.
In summary, code artifact repositories serve as a crucial component in the software development lifecycle by providing a reliable and organized way to manage and distribute software artifacts. They contribute to the efficiency, consistency, and reproducibility of the development and deployment processes.