Skip to content

220527 OndeDev piplines

Kjell Bovin edited this page Jun 2, 2022 · 2 revisions

2022-05-27

Intro

Onedev is a self-hosted Git server with Kanban and CI/CD. Here is a description of how to set up Onedev and define a simple pipeline with lint and pep8 to check the code quality. If there are deviations in the code, they are automatically corrected with autopep8

Requirements

  • Docker
  • Docker-compose

Install OneDev in docker container

Clone or copy the code from the repository. In OneDev folder:

docker-compose up

Setup OneDev

  • Go to http://localhost:6610
  • Create Administrator Account
  • Enter Name, Password and e-mailadress
  • Next
  • Finish

Start a new project

  • Click add project
  • Name the project Test-project
  • Click Create

Start a new terminal in OneDev folder and push the repository to OneDev

git remote add onedev http://localhost:6610/Test-project
git push onedev

Specify Job Executor

  • Log in to the website to see that all 5 builds failed.
  • In the OneDev menu, click Administration and click Job Excursions.
  • Click Add Executor

Select Server Docker Executor and enter name:

localhost-docker
  • Save

New Git push

Make some changes in src/main.py and push

git add .
git commit -m "FUNKA.NU"
git push

Add Access Token to Autopep8

This is so that autopep8 can make changes to the code and be able to push up to the repo itself.

  • Click on admin link at the top right corner
  • Click on Access Token
  • Click the copy to clipboard button
  • Click the OneDev icon in the top left corner
  • Click on your Test-project
  • Click Settings in the bottom left corner
  • Click on Job Secrets
  • Click the button Add new secret

Name and value to the new Job Secret

Name: onedev-token

Value: The access-token copied to the clipboard