Pipeline generator - bachelor thesis
- Head to demo petriflow engine (registration needed)
- Left menu ->
Processes
-> Upload file button -> upload both files (pipeline_generator.xml
&new_step.xml
) - Left menu ->
All Cases
-> Plus button -> choosePipeline Generator
in newest version ->Next
->Create
- Choose system for CI/CD pipeline generation
- In build, test deploy steps
- add new steps, write CMD commands (e.g.
mvn test
)
- add new steps, write CMD commands (e.g.
- Download generated file
- Note for Jenkins - update agent (e.g.
docker
)
- Note for Jenkins - update agent (e.g.
- main process (parent)
- file
pipeline_generator.xml
- places
- start
- chosen system
- build steps done
- test steps done
- config file done
- transitions
- choose system
- select system to generate pipeline for
- build steps
- add build steps to pipeline
- test steps
- add test steps to pipeline
- deploy steps
- add deploy steps to pipeline
- get file
- download config file for pipeline
- choose system
- data variables:
- system
- Text
- system to generate pipeline for
- default:
Jenkins
- config_file
- File
- generated file to download in last form
- taskRef0
- Task Ref
- used for adding more steps
- button0
- Button
- add new step function
- system
- cache
resultMap
- Groovy map
- example:
[ build: ["step1", "step2"], test: ["step1", "step2"], deploy: ["step1"] ]
- sub process (child)
- file
new_step.xml
- transitions
- t1
- input command
- delete step (self)
- t1
- data variables:
- text0
- Text
- command for step
- button0
- Button
- delete step (self)
- parent_id
- Text
- parent case id
- used for deletion of step
- parent_transition_id
- Text
- parent transition id
- used for deletion of step
- text0
- Fork and clone example-project-java
- Clone jenkins-docker
- In
jenkins-docker
directory root
$ docker compose up
$ # alternatively docker-compose up
- Go to http://localhost:8080/ & copy paste
secret-key
from console - In Jenkins, install required plugins and create user
- In Jenkins, click
New Item
on the left, add name - In Jenkins, select
Pipeline
and confirm - In Jenkins, section
Pipeline
, fieldDefinition
- change value toPipeline script from SCM
- In Jenkins, section
Pipeline
, fieldSCM
- change value toGit
- In Jenkins, section
Pipeline
, fieldRepository URL
- change value to forked repository, e.g.https://github.com/your-username/example-java-project
- In Jenkins, section
Pipeline
, sectionBranches to build
, add 2 items, values*/test-success
,*/test-error
- In Jenkins, save configuration
- Head to demo petriflow engine (register or sign in)
- In demo petriflow engine, left menu ->
Processes
-> Upload file button -> upload both.xml
files - In demo petriflow engine, left menu ->
All Cases
-> Add new case (plus button) -> choosePipeline Generator
and create - In demo petriflow engine, choose system
Jenkins
- In demo petriflow engine,
assign
taskbuild steps
andAdd step
, fill in valuemvn clean compile
- In demo petriflow engine,
assign
tasktest steps
andAdd step
, fill in valuemvn test
- In demo petriflow engine,
assign
taskdeploy steps
andAdd step
, fill in valuemvn compile exec:java -Dexec.mainClass="org.example.App"
- In demo petriflow engine,
assign
taskget file
, downloadJenkinsfile
- Update downloaded
Jenkinsfile
-> replaceagent any
foragent { docker { image 'maven:3.8.4-openjdk-11-slim' } }
- final Jenkinsfile should look like
pipeline {
agent { docker { image 'maven:3.8.4-openjdk-11-slim' } }
stages {
stage('build') {
steps {
sh 'mvn clean compile'
}
}
stage('test') {
steps {
sh 'mvn test'
}
}
stage('deploy') {
steps {
sh 'mvn compile exec:java -Dexec.mainClass="org.example.App"'
}
}
}
}
- Add updated
Jenkinsfile
to forked repositoryexample-java-project
to branchestest-success
&test-error
- In Jenkins, open configured project from dashboard, click
Build Now
twice - In Jenkins, one pipeline passed, second failed