What is a build artifact? Give Java, JS, and C++ examples.
Your grasp of the source-to-deployable boundary in CI/CD.
Define artifacts as compiled outputs; list JAR/WAR for Java, webpack bundle for JS, and binary/.so for C++; note immutability.
What's really being asked
This question probes whether you understand the precise boundary between version-controlled source code and the generated outputs that flow through a CI/CD pipeline. A senior engineer should know that artifacts are immutable, versioned, and stored in repositories, not just files that get built.
The full answer
First, a crisp definition: a build artifact is any file produced by a build or compilation step that is not human-edited source code. Second, domain-specific examples: for a Java web application, mention a JAR file for a microservice or a WAR file for a servlet container deployment; for a front-end JavaScript project, mention the webpack or Vite output bundle, typically minified JS and CSS with content-hashed filenames like main.a3f2b1c.js; for a C++ application, mention an ELF executable, a static library (.a), or a shared object (.so) on Linux, plus debug symbols if stripped separately. Third, lifecycle context: artifacts are emitted by the build stage, published to an artifact repository such as Nexus, Artifactory, or an S3 bucket, and then consumed by deploy or test stages. Fourth, immutability: once published, an artifact should never be overwritten; a new build gets a new version or hash.
The mistakes people make
Calling Git tags or Dockerfiles artifacts. Treating npm or Maven dependencies as artifacts rather than inputs. Claiming a Docker image is not an artifact; while it is a different packaging format, it is still a build output. Saying artifacts are only binaries and forgetting front-end bundles or infrastructure templates. Failing to mention that artifacts are typically separated from source by being stored in binary repositories, not Git.
What usually comes next
How do you version artifacts and trace them back to the source commit? What is the difference between an artifact repository and a package registry? When would you promote an artifact versus rebuilding from source? How do you handle artifact retention and cleanup in a large monorepo?
A concrete example
In a typical Java Spring Boot pipeline, Maven compiles source into classes, packages them into an executable JAR like orders-service-2.4.1.jar, and the CI runner pushes it to an Artifactory repository under a path that includes the Git SHA. The deploy stage downloads that exact JAR and runs it in Kubernetes. The JAR is the artifact; the pom.xml and Java files are source; the Maven dependencies are cached inputs.
Interview question
In a CI/CD pipeline, which item is correctly classified as a build artifact rather than source or an input?
- a.A Git tag marking the release version
- b.A Dockerfile committed to version control
- c.A Maven dependency cached from a central registry
- d.A webpack-generated bundle with a content-hashed filenameCorrect
Why? this is the answer
A webpack bundle is a compiled output produced by the build step, making it an artifact. Maven dependencies are tempting to call artifacts, but they are external inputs fetched by the build, not generated outputs published by it.
Just read this? Test yourself on what you have been reading.
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ci/cd — each one lists the topics its interview covers.
See open roles