OneDev introduced pipeline concept since 7.0. In short, a pipeline is an execution of job dependency graph. It can be created by running any job in the graph, either manually or automatically via job triggers.
Here we define a test job to compile and test our app, and then publish compiled app as artifacts so that it can be deployed later. The deploy job retrieves published app via dependency to the test job, and gets it deployed as shown below:
Now run the test job, you will be brought to the page showing generated build. A pipeline will also be created as the job dependency graph is executed as result of running the test job. The pipeline tab shows the created pipeline current build is part of:
NOTE: pipeline tab is only visible to users with code read permission
Pipeline has two characteristics:
- Builds fired manually from pipeline view, or by other builds in the pipeline via job triggers, dependencies and post-build actions belong to same pipeline.
- For a particular pipeline, only one build will be generated from same job and parameter. If no parameter is defined for the job, it can only be triggered once then.
To demonstrate, run the deploy job from above pipeline, from the build log you will see that it is actually deploying the app published by existing test build in that pipeline:
Also pipeline tab of the deploy build shows that it belongs to same pipeline as test build above:
If we run deploy job again in this pipeline, OneDev will indicate that the build is already fired:
However if you run deploy job from outside of the pipeline, a new pipeline will be created and new builds for test and deploy job will be generated for the new pipeline. Again, let’s check this in action. Switch to commits page to run deploy job for some commit with existing test build:
A new deploy build will be generated, as well as a new pipeline. Switch to pipeline tab of the new build, you will see that new test build also gets generated in regardless of existing test builds for the commit.
Pipeline can be created automatically if a job is set to fire upon certain event. For instance, in CI spec of this demo project, we set job test to trigger automatically when there are new commits in master branch:
Make some changes to app.txt and save the file, you will see that test job is running:
Click the running test build and you will be brought to build detail page, from which created pipeline can be accessed.
Now assume you want to deploy the app automatically when test job is successful. To do it, add a trigger to fire the deploy job when dependency jobs finished like below:
To test it in action, make some changes to app.txt in this project, save the file, open created pipeline and wait to see deploy job running automatically after test job is successful:
Alternatively, you may also configure a branch update trigger for deploy job. In that case, both deploy job and test job will be fired upon changing file, but deploy job will wait for test job to complete before running as shown in the pipeline:
Now you should get an idea how pipeline works in OneDev. Any questions, please post at our issue tracker.
Thanks for watching!