Listen!
After all, if the stars are lit,
it means that somebody needs it?
(V.V. Mayakovsky)
Foreword
It just so happened that some time ago, at one of my jobs, I had to set up collective code development tools for one group of Fortran programmers . First, they set up Gitosis themselves , then Trac , but all the time something was missing. There were constant problems with the simultaneous injection of code, as well as with what is called code review ... In general, this group of developers has grown to a full-fledged system of joint development with CI / CD. Since the group is not rich, at the time of the installation of the joint development system, they had a weak dual-core server with 2 GB of RAM at their disposal. For this reason, the choice fell on a bunch of Gogs + Drone . Small ones written in Go, practically without any special "features" of the program. But immediately after the next injection of code, it became possible to check its assembly and test whether it works correctly.
This is how the current version of Drone 0.8 used in "combat" mode looks like .
Update
, , , 2021 . Gitea Drone . Gogs Gitea , . Drone 0.8 1.x , , , . , , — . Gitea + Drone 1.10 Drone 2.0 (13 2021 ), .
Drone 2.0
Drone CI . -, Drone CI Harness CI, :
, ( ). , : , , — ? , , Drone UI .
, , CSS . , , . , , , CSS Drone UI. , Drone GitHub Drone UI. , (.drone.yml) Drone UI. Drone UI . , , . — , :
go get -v -insecure xxx.com/xxx/drone-ui
sed -i '' 's/github.com\/drone\/drone-ui/xxx.com\/xxx\/drone-ui/' ./handler/web/{logout,pages,web}.go
( ), Drone Drone UI . - , , Node.js, . .
, , . drone : (clone), Go (test), drone-server (build) Docker- (publish). — .drone.yml, drone:
---
kind: pipeline
type: docker
name: linux-amd64
platform:
arch: amd64
os: linux
steps:
- name: test
image: golang:1.14.4
commands:
- go test ./...
- name: build
image: golang:1.14.4
commands:
- sh scripts/build.sh
environment:
GOARCH: amd64
GOOS: linux
- name: publish
image: plugins/docker:18
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: docker/Dockerfile.server.linux.amd64
repo: drone/drone
username:
from_secret: docker_username
password:
from_secret: docker_password
when:
event:
- push
- tag
, , , Drone UI.
. drone:
- name: clone
image: drone/git
commands:
- export DRONE_TAG=v2.0.0
- export DRONE_COMMIT_REF=refs/tags/$DRONE_TAG
- export DRONE_REMOTE_URL=https://github.com/drone/drone.git
- clone
- name: clone drone-ui
image: drone/git
commands:
- export DRONE_COMMIT_BRANCH=drone2
- export DRONE_COMMIT_REF=refs/heads/$DRONE_COMMIT_BRANCH
- export DRONE_COMMIT_SHA=d96f1e26d4482663535cfc913f650956c914f27f
- export DRONE_REMOTE_URL=https://github.com/drone/drone-ui.git
- export DRONE_WORKSPACE=$DRONE_WORKSPACE_BASE/web
- clone
. , , drone/git.
- name: clone patch
image: drone/git
commands:
- export DRONE_WORKSPACE=$DRONE_WORKSPACE_BASE/patch
- mkdir -p $DRONE_WORKSPACE
- clone
. , Drone, , $DRONE_WORKSPACE_BASE
drone, patch
. , , :
clone:
disable: true
drone-ui - CSS .
- name: patch drone-ui
image: node:15.14.0
commands:
- cd $DRONE_WORKSPACE_BASE/web
- patch -p1 < ../patch/drone-ui-2.0-customize.patch
, web drone-ui, () drone-server.
— drone-ui:
- name: build drone-ui
image: node:15.14.0
commands:
- cd $DRONE_WORKSPACE_BASE/web
- npm install
- npm run build
environment:
CI: false
Node.js, drone-ui . , CI
false
, (warnings) .
drone-ui — . dist_gen.go
, drone. :
- name: generate drone-ui
image: golang:1.14.4
commands:
- cd $DRONE_WORKSPACE_BASE/web
- go get github.com/bradrydzewski/togo
- rm -vf dist/dist_gen.go
- go generate ./dist
. togo, dist_gen.go
:
go get github.com/bradrydzewski/togo
, , dist_gen.go
:
go generate ./dist
( ) . , , :
rm -vf dist/dist_gen.go
- name: replace drone-ui
image: golang:1.14.4
commands:
- cd $DRONE_WORKSPACE_BASE/web
- go mod init github.com/drone/drone-ui
- cd $DRONE_WORKSPACE_BASE
- go mod edit -replace=github.com/drone/drone-ui=./web
github.com/drone/drone-ui web:
go mod init github.com/drone/drone-ui
.
, , drone-ui , web:
go mod edit -replace=github.com/drone/drone-ui=./web
, . — ./web
. ./
, web.
- name: test
image: golang:1.14.4
commands:
- export GOPATH=$DRONE_WORKSPACE_BASE/go
- go test ./...
- name: build
image: golang:1.14.4
commands:
- export GOPATH=$DRONE_WORKSPACE_BASE/go
- sh scripts/build.sh
- strip -s -R .comment release/linux/$GOARCH/drone-server
environment:
GOARCH: amd64
GOOS: linux
—
export GOPATH=$DRONE_WORKSPACE_BASE/go
— , . , DRONE_WORKSPACE_BASE
/drone/src
, Drone CI.
,
strip -s -R .comment release/linux/$GOARCH/drone-server
, .
- name: publish
image: plugins/docker:18
settings:
tags: [ latest, "2", "2.0", "2.0.0" ]
dockerfile: docker/Dockerfile.server.linux.amd64
repo: drone/drone-server-customized
username:
from_secret: docker_username
password:
from_secret: docker_password
dry_run: true
when:
repo:
- tkushnir/drone-server-customized
branch:
- main
event:
exclude:
- pull_request
Drone 2.0 :
Gitea Drone .
, , Drone. , - . , , , Vue Node.js .
During the upgrade from Drone 0.8 to Drone 1.10 and further to Drone 2.0, it was found that the old steps of assemblies, which were made in version 0.8 and were normally transferred to version 1.10 by the standard utility , are no longer visible . This problem was solved quite simply. If I describe the steps of transition from Drone 0.8 to Drone 2.0, I will share this experience as well.
It might also make sense to share the problems (and their solutions) that have arisen in the transition from Gogs to the latest versions of Gitea. Initially, it was thought that this transition would be quite simple, but it turned out that there are some pitfalls here too.