## ABSTRACT
The project provides a pipeline DSL plugin that allows users to use buildpacks while developing a pipeline script in Jenkins.
## LINKS
[GSOC 2021 JENKINS PLUGINS PROPOSAL - FATIH ATES](https://docs.google.com/document/d/1TgUSIgDRFDt7bHzU37zPzfUYww0Ahrh_ndp_UubuV7w/edit?usp=sharing)
[FULL DEFINED PIPELINE DSL](https://hackmd.io/NIfdbyRNRcGpBtaNjIyvrQ?view)
[Buildpacks PLUGIN's README](https://github.com/jromero/buildpacks-jenkins-plugin/blob/main/README.md)
[Jenkins Buildpacks Plugin Repository](https://github.com/jromero/buildpacks-jenkins-plugin)
[Latest Version(v0.1.1)](https://github.com/jromero/buildpacks-jenkins-plugin/releases/tag/v0.1.1)
## GENERAL INFO
**Mentor**
Full Name: Javier Romero
E-mail: [root@jromero.codes](mailto:root@jromero.codes)
GitHub: [jromero](https://github.com/jromero)
Web: https://why.jromero.codes/
**Student**
Full Name: Fatih ATES
E-mail: [fatiiates@gmail.com](mailto:jfatiiates@gmail.com)
GitHub: [fatiiates](https://github.com/fatiiates)
Web: https://fatiiates.github.io/
## PHASES
1. **Phase** A user is able to provide a Buildpacks specific DSL that specifies a builder, a path, and image name which results in an image created as \<image name>.
2. **Phase** A user should be able to fully use [defined DSL](https://hackmd.io/NIfdbyRNRcGpBtaNjIyvrQ?view) expressions.
3. **Phase** What can be added in addition to DSL ? For example: colorful outputs, connected [java-buildpack-client](https://github.com/snowdrop/java-buildpack-client) outputs to plugin...
4. **Phase** This phase, includes the integration of the constantly evolving Buildpacks features into the Jenkins Buildpacks plugin and making improvements and bug fixes on the plugin according to the constantly improving Jenkins system. This step never ends.
## WHAT WAS DONE
### **My Repositories**
#### **buildpacks-jenkins-plugin**
I developed [this](https://github.com/jromero/buildpacks-jenkins-plugin) Jenkins plugin from scratch.
### **Other Repositories**
#### **java-buildpack-client**
[The repository](https://github.com/snowdrop/java-buildpack-client) is a java client for buildpacks developed by the snowdrop team.
**Issues:**
1. https://github.com/snowdrop/java-buildpack-client/issues/12 (Closed)
2. https://github.com/snowdrop/java-buildpack-client/issues/13 (Closed)
3. https://github.com/snowdrop/java-buildpack-client/issues/15 (Open)
**PR:**
1. https://github.com/snowdrop/java-buildpack-client/pull/14 (Under review)
#### **java-buildpack-client(clone)**
[This repository](https://github.com/jromero/java-buildpack-client) is the same PR sent to the java-buildpack-client repository. It is a repository created to include in pom.xml as if from a maven repository. Development was made on this repository until the PR was accepted. How it is included from Jitpack.io can be seen in [this line](https://github.com/jromero/buildpacks-jenkins-plugin/blob/9fa65dc3560b4ebd98fda3ab778bf744d0405c71/pom.xml#L156).
## HOW IT WAS DONE
#### Background
Buildpacks works like this: basically a builder image is determined, a name is given to the newly created image, and when you give the path of the application, the builder image is run and the lifecycle is run in it, it performs lifecycle operations and creates the OCI image with the desired name.
#### Implementation
Firstly, we should be able to access the docker socket in Jenkins. This was requested as the first step and we successfully passed this step by proving that we had access. Afterwards, I was presented with two options: the first was to start developing directly and to learn while developing the system.
Secondly, I needed to define the DSL and find a library or Jenkins plugin to be able to communicate with the docker socket. I chose the second one. We defined a DSL by taking pack-cli as an example and divided it into three [phases](#phases). It would be great if I could put forward a plugin that could run the 1st stage until the first evaluation, unfortunately, I could not fulfill this request because it coincided with my exam week. After passing the first assessment, my relationship with the school was over for this period and we completed [phase-1](#phases). Phase-1 was completed in a short time by communicating on Slack almost every day.
Later, we made it a plugin that supports **Environment Variables**, which is one of the most important stages of the build phase. Finally, we decided to add a UI component, and I've included a guiding example so that global configurations can be included in the system.
Last but not least, we have created a comprehensive ```Readme.md``` file because we are aware of how difficult the tools with poor documentation can be for people.
I would like to thank **@jromero** for his endless patience and helpfulness. Thank you Google.
Buildpack Jenkins Plugin was made with ❤️.
## FUTURE WORKS
With [Phase-1](#phases) completed ([see release 0.1.0](https://github.com/jromero/buildpacks-jenkins-plugin/releases/tag/v0.1.0)), the next step is to transfer the features in pack-cli to the jenkins plugin, that is, to complete [Phase-2](#phases). Progress was made in this phase, and the latest version can be found [here](https://github.com/jromero/buildpacks-jenkins-plugin/releases/tag/v0.1.1).
After [Phase-2](#phases) is complete, the process now comes to [Phase-3](#phases). [Phase-3](#phases), again, includes adding some features to the DSL from pack-cli, giving colored outputs in console outputs, connecting the logs of java-buildpack-client to jenkins and discussing what can be added.
[Phase-4](#phases), also known as the last phase, the plug-in is operational with all DSL features. Only the routine checks of the plugin, the newly added features to the buildpacks system are also included in the plugin, and the innovations/requirements brought to the plugins by Jenkins are applied to the plugin. This step will continue as long as the ecosystem lives...
## CONCLUSION
Terminal commands were already available in Jenkins. So this allowed you to use the pack command. However, when you want to write a pipeline script, it didn't give a chance to have a system that works compatible with jenkins. In addition, it was a non-recommended use.
Jenkins pipeline DSL Buildpacks plugin allows you to use buildpacks compatible with Jenkins. The base system([Phase-1](#phases)) is currently available. What needs to be done is to fix the bugs and add new features.