Search code examples
javajenkinsartifacts

How do Jenkins, Gradle and "artifacts" all tie together?


I am working on project where we are uploading artifacts to AWS, which is our central repository. I am not sure why we are storing artifacts there; what will be the use of it? We are using Jenkins script to upload artifacts from our Gradle build to AWS. I want to know the relation between artifacts, Gradle and Jenkins. We are using an S3 repository for artifacts.


Solution

  • An artifact is typically the end product of a build. It may or may not be compiled, and it may or may not be packaged in a specific fashion (think JARs, WARs for Java, Gems for Ruby or Eggs for Python).

    Artifacts are simply an abstraction to talk about what is released in production, or what contains production-quality code. So for instance, if I wanted to release a Java-based web app packaged as a WAR, I would need to ensure that my build tool was capable of packaging the application as a WAR, and I would need to ensure that wherever it was deployed was capable of accepting a WAR as an artifact with which to run my application.

    Build tools like Gradle (or Maven) allow us to do various things, including (but not limited to):

    • Test our code in an environment-agnostic fashion
    • Compile our code in an environment-agnostic fashion
    • Package our code (e.g. build an artifact) in an environment-agnostic fashion
    • Export our artifact to an artifact store (in your case, S3)

    Jenkins provides a place for you to execute all of the above in a "clean" environment; you don't have to rely on a single person's machine to build production-grade artifacts, nor should you. A build service like Jenkins enables a team to continuously build or continuously deploy artifacts at will, and typically Jenkins does handle the step of publishing the artifact to an artifact store.

    I cannot speak to your application lifecycle - I for one wouldn't be using S3 as a place to house artifacts - but the convention would be that you have a central location to place these artifacts, and you are then relying on that central place to then deploy to various other services.