DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Understanding OneDev Pipeline
Robin Shen
Robin Shen

Posted on

Understanding OneDev Pipeline

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.

Create a Pipeline

Login to OneDev demo site with account demo/demo, switch to CI spec definition page of the demo project, you will see job definitions like below:

Image description

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:

Image description

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:

Image description

NOTE: pipeline tab is only visible to users with code read permission

Pipeline Characteristics

Pipeline has two characteristics:

  1. 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.
  2. 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:

Image description

Also pipeline tab of the deploy build shows that it belongs to same pipeline as test build above:

Image description

If we run deploy job again in this pipeline, OneDev will indicate that the build is already fired:

Image description

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:

Image description

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.

Image description

Pipeline Automation

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:

Image description

Make some changes to app.txt and save the file, you will see that test job is running:

Image description

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:

Image description

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:

Image description

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:

Image description

Now you should get an idea how pipeline works in OneDev. Any questions, please post at our issue tracker.

Thanks for watching!

Top comments (0)

Yes, this is technically an β€œad”, but hear me out.

We have 900k+ developers reading, posting, and enjoying community, and would love to have you.

Create an account and continue your coding journey.