mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-06 08:16:19 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
88873929bd
@ -5,12 +5,14 @@ env:
|
|||||||
- GOROOT=/usr/local/go
|
- GOROOT=/usr/local/go
|
||||||
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
||||||
script:
|
script:
|
||||||
- sudo apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null
|
- sudo apt-get -y install zip libsqlite3-dev sqlite3 rpm 1> /dev/null 2> /dev/null
|
||||||
|
- gem install fpm
|
||||||
|
- rbenv rehash
|
||||||
- make deps
|
- make deps
|
||||||
- make test
|
- make test
|
||||||
- make test_postgres
|
- make test_postgres
|
||||||
- make test_mysql
|
- make test_mysql
|
||||||
- make dpkg
|
- make packages
|
||||||
services:
|
services:
|
||||||
- postgres
|
- postgres
|
||||||
- mysql
|
- mysql
|
||||||
@ -29,5 +31,5 @@ publish:
|
|||||||
bucket: downloads.drone.io
|
bucket: downloads.drone.io
|
||||||
access_key: $AWS_KEY
|
access_key: $AWS_KEY
|
||||||
secret_key: $AWS_SECRET
|
secret_key: $AWS_SECRET
|
||||||
source: debian/drone.deb
|
source: packaging/output/drone.*
|
||||||
target: $DRONE_BRANCH/
|
target: $DRONE_BRANCH/
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,11 +6,12 @@ drone.sublime-workspace
|
|||||||
*~
|
*~
|
||||||
~*
|
~*
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.deb
|
drone.deb
|
||||||
|
drone.rpm
|
||||||
*.out
|
*.out
|
||||||
*.rice-box.go
|
*.rice-box.go
|
||||||
|
|
||||||
cli/cli
|
cli/cli
|
||||||
client/client
|
client/client
|
||||||
server/server
|
server/server
|
||||||
debian/drone/usr
|
packaging/root/usr/local
|
||||||
|
50
Makefile
50
Makefile
@ -20,8 +20,9 @@ test_postgres:
|
|||||||
TEST_DRIVER="postgres" TEST_DATASOURCE="host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
|
TEST_DRIVER="postgres" TEST_DATASOURCE="host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -o debian/drone/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli
|
mkdir -p packaging/root/usr/local/bin
|
||||||
go build -o debian/drone/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
|
go build -o packaging/root/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli
|
||||||
|
go build -o packaging/root/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -t /usr/local/bin debian/drone/usr/local/bin/drone
|
install -t /usr/local/bin debian/drone/usr/local/bin/drone
|
||||||
@ -32,28 +33,53 @@ run:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
find . -name "*.out" -delete
|
find . -name "*.out" -delete
|
||||||
rm -f debian/drone/usr/local/bin/drone
|
rm -rf packaging/output
|
||||||
rm -f debian/drone/usr/local/bin/droned
|
rm -f packaging/root/usr/local/bin/drone
|
||||||
rm -f debian/drone.deb
|
rm -f packaging/root/usr/local/bin/droned
|
||||||
rm -f server/server
|
mkdir -p packaging/output
|
||||||
rm -f cli/cli
|
|
||||||
|
|
||||||
lessc:
|
lessc:
|
||||||
lessc --clean-css server/app/styles/drone.less server/app/styles/drone.css
|
lessc --clean-css server/app/styles/drone.less server/app/styles/drone.css
|
||||||
|
|
||||||
dpkg: build embed deb
|
packages: clean build embed deb rpm
|
||||||
|
|
||||||
# embeds content in go source code so that it is compiled
|
# embeds content in go source code so that it is compiled
|
||||||
# and packaged inside the go binary file.
|
# and packaged inside the go binary file.
|
||||||
embed:
|
embed:
|
||||||
rice --import-path="github.com/drone/drone/server" append --exec="debian/drone/usr/local/bin/droned"
|
rice --import-path="github.com/drone/drone/server" append --exec="packaging/root/usr/local/bin/droned"
|
||||||
|
|
||||||
# creates a debian package for drone to install
|
# creates a debian package for drone to install
|
||||||
# `sudo dpkg -i drone.deb`
|
# `sudo dpkg -i drone.deb`
|
||||||
deb:
|
deb:
|
||||||
mkdir -p debian/drone/usr/local/bin
|
fpm -s dir -t deb -n drone -v 0.3 -p packaging/output/drone.deb \
|
||||||
mkdir -p debian/drone/var/lib/drone
|
--deb-priority optional --category admin \
|
||||||
dpkg-deb --build debian/drone
|
--force \
|
||||||
|
--deb-compression bzip2 \
|
||||||
|
--after-install packaging/scripts/postinst.deb \
|
||||||
|
--before-remove packaging/scripts/prerm.deb \
|
||||||
|
--after-remove packaging/scripts/postrm.deb \
|
||||||
|
--url https://github.com/drone/drone \
|
||||||
|
--description "Drone continuous integration server" \
|
||||||
|
-m "Brad Rydzewski <brad@drone.io>" \
|
||||||
|
--license "Apache License 2.0" \
|
||||||
|
--vendor "drone.io" -a amd64 \
|
||||||
|
--config-files /etc/drone/drone.toml \
|
||||||
|
packaging/root/=/
|
||||||
|
|
||||||
|
rpm:
|
||||||
|
fpm -s dir -t rpm -n drone -v 0.3 -p packaging/output/drone.rpm \
|
||||||
|
--rpm-compression bzip2 --rpm-os linux \
|
||||||
|
--force \
|
||||||
|
--after-install packaging/scripts/postinst.rpm \
|
||||||
|
--before-remove packaging/scripts/prerm.rpm \
|
||||||
|
--after-remove packaging/scripts/postrm.rpm \
|
||||||
|
--url https://github.com/drone/drone \
|
||||||
|
--description "Drone continuous integration server" \
|
||||||
|
-m "Brad Rydzewski <brad@drone.io>" \
|
||||||
|
--license "Apache License 2.0" \
|
||||||
|
--vendor "drone.io" -a amd64 \
|
||||||
|
--config-files /etc/drone/drone.toml \
|
||||||
|
packaging/root/=/
|
||||||
|
|
||||||
# deploys drone to a staging server. this requires the following
|
# deploys drone to a staging server. this requires the following
|
||||||
# environment variables are set:
|
# environment variables are set:
|
||||||
|
@ -18,8 +18,13 @@ We have optimized the installation process for Ubuntu since that is what we test
|
|||||||
You can run the following commands to quickly download an install Drone on an Ubuntu machine.
|
You can run the following commands to quickly download an install Drone on an Ubuntu machine.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
# Ubuntu, Debian
|
||||||
wget downloads.drone.io/master/drone.deb
|
wget downloads.drone.io/master/drone.deb
|
||||||
sudo dpkg -i drone.deb
|
sudo dpkg -i drone.deb
|
||||||
|
|
||||||
|
# CentOS, RedHat
|
||||||
|
wget downloads.drone.io/master/drone.rpm
|
||||||
|
sudo yum localinstall drone.rpm
|
||||||
```
|
```
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
2
debian/drone/DEBIAN/conffiles
vendored
2
debian/drone/DEBIAN/conffiles
vendored
@ -1,2 +0,0 @@
|
|||||||
/etc/init/drone.conf
|
|
||||||
/etc/drone/drone.toml
|
|
7
debian/drone/DEBIAN/control
vendored
7
debian/drone/DEBIAN/control
vendored
@ -1,7 +0,0 @@
|
|||||||
Package: drone
|
|
||||||
Version: 0.3
|
|
||||||
Section: base
|
|
||||||
Priority: optional
|
|
||||||
Architecture: amd64
|
|
||||||
Maintainer: Brad Rydzewski <brad@drone.io>
|
|
||||||
Description: Drone continuous integration server
|
|
24
debian/drone/DEBIAN/postinst
vendored
24
debian/drone/DEBIAN/postinst
vendored
@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
abort-upgrade|abort-remove|abort-deconfigure|configure)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "postinst called with unknown argument \`$1'" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "Starting drone ..."
|
|
||||||
if [ -f /etc/init/drone.conf ]; then
|
|
||||||
if pidof /usr/local/bin/droned >/dev/null; then
|
|
||||||
service drone stop || exit $?
|
|
||||||
fi
|
|
||||||
service drone start && echo "Drone started."
|
|
||||||
fi
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
26
debian/drone/DEBIAN/prerm
vendored
26
debian/drone/DEBIAN/prerm
vendored
@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -u
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
remove|remove-in-favour|deconfigure|deconfigure-in-favour)
|
|
||||||
if [ -f /etc/init/drone.conf ]; then
|
|
||||||
echo "Stopping drone ..."
|
|
||||||
service drone stop || exit $?
|
|
||||||
echo "Drone Stopped."
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
upgrade|failed-upgrade)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "prerm called with unknown argument \`$1'" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
26
packaging/root/usr/share/drone/systemd/drone.service
Normal file
26
packaging/root/usr/share/drone/systemd/drone.service
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#
|
||||||
|
# systemd unit file for CentOS 7, Ubuntu bleeding edge
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Drone
|
||||||
|
# start us only once the network and logging subsystems are available
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
# See these pages for lots of options:
|
||||||
|
# http://0pointer.de/public/systemd-man/systemd.service.html
|
||||||
|
# http://0pointer.de/public/systemd-man/systemd.exec.html
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/local/bin/droned --config=/etc/drone/drone.toml
|
||||||
|
|
||||||
|
# if we crash, restart
|
||||||
|
RestartSec=1
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
# use syslog for logging
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog
|
||||||
|
SyslogIdentifier=droned
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
0
packaging/root/var/lib/drone/.keep
Normal file
0
packaging/root/var/lib/drone/.keep
Normal file
91
packaging/scripts/postinst.deb
Normal file
91
packaging/scripts/postinst.deb
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
abort-upgrade|abort-remove|abort-deconfigure|configure)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "postinst called with unknown argument \`$1'" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -f /etc/drone/drone.toml ]; then
|
||||||
|
chmod 600 /etc/drone/drone.toml
|
||||||
|
fi
|
||||||
|
|
||||||
|
dist() {
|
||||||
|
lsb_release -i | awk '{print tolower($3)}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
upstart() {
|
||||||
|
if [ -d /etc/init ]; then
|
||||||
|
if [ -f /usr/local/bin/droned ]; then
|
||||||
|
if pidof /usr/local/bin/droned >/dev/null; then
|
||||||
|
initctl stop drone || :
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "You have $(dist) $(version): using upstart to control Drone"
|
||||||
|
cp -r /usr/share/drone/init/drone.conf /etc/init/drone.conf
|
||||||
|
initctl start drone || :
|
||||||
|
else
|
||||||
|
echo "Couldn't find upstart to control Drone, cannot proceed."
|
||||||
|
echo "Open an issue and tell us about your system."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
systemd() {
|
||||||
|
if which systemctl > /dev/null; then
|
||||||
|
echo "Your system $(dist) $(version): using systemd to control Drone"
|
||||||
|
cp /usr/share/drone/systemd/drone.service /lib/systemd/system/drone.service
|
||||||
|
|
||||||
|
systemctl daemon-reload || :
|
||||||
|
if [ "$1" = 1 ] ; then
|
||||||
|
# first time install
|
||||||
|
systemctl enable drone || :
|
||||||
|
systemctl start drone || :
|
||||||
|
else
|
||||||
|
echo "Upgrading drone"
|
||||||
|
systemctl restart drone
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Couldn't find systemd to control Drone, cannot proceed."
|
||||||
|
echo "Open an issue and tell us about your system."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_ver() {
|
||||||
|
echo "$(version) < $1" | bc
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$(dist)" in
|
||||||
|
debian)
|
||||||
|
if [ $(validate_ver "8.0") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd $1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
ubuntu)
|
||||||
|
if [ $(validate_ver "14.10") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd $1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "\033[33m Your system $(dist) $(version) \033[0m"
|
||||||
|
echo "\033[33m This system is not supported, you can install service manually \033[0m"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
27
packaging/scripts/postinst.rpm
Normal file
27
packaging/scripts/postinst.rpm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -f /etc/drone/drone.toml ]; then
|
||||||
|
chmod 600 /etc/drone/drone.toml
|
||||||
|
fi
|
||||||
|
|
||||||
|
if which systemctl > /dev/null; then
|
||||||
|
echo "Using systemd to control Drone"
|
||||||
|
cp /usr/share/drone/systemd/drone.service /lib/systemd/system/drone.service
|
||||||
|
|
||||||
|
systemctl daemon-reload || :
|
||||||
|
if [ "$1" = 1 ] ; then
|
||||||
|
# first time install
|
||||||
|
systemctl enable drone || :
|
||||||
|
systemctl start drone || :
|
||||||
|
else
|
||||||
|
echo "Upgrading drone"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Couldn't find systemd to control Drone, cannot proceed."
|
||||||
|
echo "Open an issue and tell us about your system."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
50
packaging/scripts/postrm.deb
Normal file
50
packaging/scripts/postrm.deb
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
dist() {
|
||||||
|
lsb_release -i | awk '{print tolower($3)}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
upstart() {
|
||||||
|
rm -f /etc/init/drone.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
systemd() {
|
||||||
|
rm -f /lib/systemd/system/drone.service
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_ver() {
|
||||||
|
echo "$(version) < $1" | bc
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$(dist)" in
|
||||||
|
debian)
|
||||||
|
if [ $(validate_ver "8.0") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
ubuntu)
|
||||||
|
if [ $(validate_ver "14.10") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "\033[33m Please remove service manually \033[0m"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
|
||||||
|
|
||||||
|
if [ "$1" = "purge" ] ; then
|
||||||
|
echo "Purging drone configuration"
|
||||||
|
rm -rf /etc/drone
|
||||||
|
fi
|
11
packaging/scripts/postrm.rpm
Normal file
11
packaging/scripts/postrm.rpm
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04s05.html
|
||||||
|
|
||||||
|
systemctl daemon-reload || :
|
||||||
|
if [ "$1" -ge 1 ] ; then
|
||||||
|
# Package upgrade, not uninstall
|
||||||
|
systemctl try-restart drone || :
|
||||||
|
fi
|
51
packaging/scripts/prerm.deb
Normal file
51
packaging/scripts/prerm.deb
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
dist() {
|
||||||
|
lsb_release -i | awk '{print tolower($3)}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Stopping drone
|
||||||
|
|
||||||
|
upstart() {
|
||||||
|
initctl stop drone || :
|
||||||
|
}
|
||||||
|
|
||||||
|
systemd() {
|
||||||
|
if [ "$1" -eq 0 ] ; then
|
||||||
|
systemctl --no-reload disable drone || :
|
||||||
|
systemctl stop drone || :
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_ver() {
|
||||||
|
echo "$(version) < $1" | bc
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$(dist)" in
|
||||||
|
debian)
|
||||||
|
if [ $(validate_ver "8.0") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd $1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
ubuntu)
|
||||||
|
if [ $(validate_ver "14.10") -eq 1 ]; then
|
||||||
|
upstart
|
||||||
|
else
|
||||||
|
systemd $1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -f /usr/local/bin/droned ]; then
|
||||||
|
if pidof /usr/local/bin/droned >/dev/null; then
|
||||||
|
kill -9 `pidof /usr/local/bin/droned`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
8
packaging/scripts/prerm.rpm
Normal file
8
packaging/scripts/prerm.rpm
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" -eq 0 ] ; then
|
||||||
|
echo Stopping Drone
|
||||||
|
systemctl --no-reload disable drone || :
|
||||||
|
systemctl stop drone || :
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user