This is a SmartCLIDE CI/CD project. As of this moment the main purposes of this project is to be used for demonstration, provide some CI/CD services(Rest-Api) to other resources and handle some specific tasks/jobs.
Also another goal of this project is to provide a way to be used as an early Proof of Concept regarding CI workflows demonstration and validations.
Below are some basic steps and information of what this service can provide and how to use it.
The goal of this service is to provide the ability to containerize and include CI/CD support to services/projects generated from the user by the SmartCLIDE service creation process and SmartCLIDE-jbpm or any other supported types of projects.
This happens by generating CI pipelines, docker files and any other necessary file is needed to containerize a project and include pipeline flow support.
Below are the basic steps to make a non-containerized project containerized, and also included it in a CI/CD flow.
To generate a CI .gitlab-ci.yml for a project, consume the following API.
GET cicd/api/templates/pipelines/{type}/download
Request parameter type is the type of the project.
For example for a maven project.
GET cicd/api/templates/pipelines/maven/download
will produce a .gitlab-ci.yml specific for a maven project containing maven commands for building and testing.
Other available query parameters.
- appName
- variables
- example:
cicd/api/templates/pipelines/maven/download?releaseOnly=master&variables=GIT_DEPTH: 10,PARAM: value
will include in .gitlab-ci.yml
variables: GIT_DEPTH: 10 PARAM: value
- example:
- image
- replace the default docker image with the given one
- testWhen
- testOnly
- default branch is master
- reportOnly
- default branch is master
- reportWhen
- releaseOnly
- default branch is master
- releaseWhen
- buildCommand
- testCommand
To generate a Dockerfile for a project, consume the following API.
GET cicd/api/templates/dockerfiles/{type}/download?extension={extension}
Request parameter type is the type of the project and extension is the deplyment extension
For example for a maven project.
GET cicd/api/templates/dockerfiles/maven/download?extension=war
will produce a Dockerfile image with instructions specific for a maven and java project.
To include extra Build commands
GET cicd/api/templates/dockerfiles/maven/download?extension=war&extraCommands=RUN mv target/externallib.jar ./externallib.jar
Also to generate a .dockerignore for this project consume the following API.
GET cicd/api/templates/dockerfiles/dockerignore/download
Place the above files (.gitlab-ci.yml, Dockerfile, .dockerignore) in the root of the project and commit.
In gitlab the following events will take place.
- CI pipeline flow will start.
- Steps specified in the pipeline flow(build, test...) will be executed.
- An docker image will be uploaded to the gitlab's repo container registry.
To pull and run this project locally.
Pull
docker pull ghcr.io/eclipse-opensmartclide/smartclide-cicd:latest
Run
docker run --rm -p 8080:8080 ghcr.io/eclipse-opensmartclide/smartclide-cicd:latest