update build process
This commit is contained in:
parent
d5dc9a8894
commit
4a40647ca0
6 changed files with 115 additions and 11 deletions
18
.drone.yml
18
.drone.yml
|
@ -9,11 +9,11 @@ pipeline:
|
|||
- make deps gen
|
||||
- make test test_postgres test_mysql
|
||||
|
||||
compile:
|
||||
dist:
|
||||
image: golang:1.8
|
||||
commands:
|
||||
- export PATH=$PATH:/go/bin
|
||||
- make build
|
||||
- ./ci.sh
|
||||
- ./dist.sh
|
||||
when:
|
||||
event: push
|
||||
|
||||
|
@ -28,19 +28,17 @@ pipeline:
|
|||
event: push
|
||||
branch: master
|
||||
|
||||
trigger:
|
||||
image: plugins/downstream
|
||||
server: https://beta.drone.io
|
||||
fork: true
|
||||
secrets: [ downstream_token ]
|
||||
repositories: drone/drone-enterprise
|
||||
publish:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest, 0.6, 0.6.0, 0.6.0-rc.2 ]
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
notify:
|
||||
image: plugins/gitter
|
||||
dummy: true # todo remove this
|
||||
secrets: [ gitter_webhook ]
|
||||
when:
|
||||
status: [ success, failure ]
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,7 +1,6 @@
|
|||
drone/drone
|
||||
*.sqlite
|
||||
*_gen.go
|
||||
*_ee.go
|
||||
!store/datastore/sql/sqlite/sql_gen.go
|
||||
!store/datastore/sql/mysql/sql_gen.go
|
||||
!store/datastore/sql/postgres/sql_gen.go
|
||||
|
@ -14,6 +13,7 @@ drone/drone
|
|||
*.deb
|
||||
.env
|
||||
temp/
|
||||
extras/
|
||||
release/
|
||||
|
||||
server/frontend/bower_components
|
||||
|
|
20
ci.sh
Executable file
20
ci.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# only execute this script as part of the pipeline.
|
||||
[ -z $CI ] && exit 1
|
||||
|
||||
# only execute the script when github token exists.
|
||||
[ -z $SSH_KEY ] && exit 1
|
||||
|
||||
# write a netrc file for authorization.
|
||||
mkdir -p $HOME/.ssh
|
||||
echo -n "$SSH_KEY" > $HOME/.ssh/id_rsa
|
||||
chmod 600 $HOME/.netrc
|
||||
|
||||
# clone the extras project.
|
||||
set +x
|
||||
git clone git@github.com:drone/drone-enterprise.git extras
|
||||
|
||||
# build a static binary with the build number and extra features.
|
||||
go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}' -tags extras -o release/drone github.com/drone/drone/drone
|
21
dist.sh
Executable file
21
dist.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
set -v
|
||||
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}" -o release/linux/amd64/drone github.com/drone/drone/drone
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}" -o release/linux/arm64/drone github.com/drone/drone/drone
|
||||
GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -ldflags "-X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}" -o release/linux/arm/drone github.com/drone/drone/drone
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}" -o release/windows/amd64/drone github.com/drone/drone/drone
|
||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/drone/drone/version.VersionDev=build.${DRONE_BUILD_NUMBER}" -o release/darwin/amd64/drone github.com/drone/drone/drone
|
||||
|
||||
tar -cvzf release/linux/amd64/drone.tar.gz -C release/linux/amd64 drone
|
||||
tar -cvzf release/linux/arm64/drone.tar.gz -C release/linux/arm64 drone
|
||||
tar -cvzf release/linux/arm/drone.tar.gz -C release/linux/arm drone
|
||||
tar -cvzf release/windows/amd64/drone.tar.gz -C release/windows/amd64 drone
|
||||
tar -cvzf release/darwin/amd64/drone.tar.gz -C release/darwin/amd64 drone
|
||||
|
||||
sha256sum release/linux/amd64/drone.tar.gz > release/linux/amd64/drone.sha256
|
||||
sha256sum release/linux/arm64/drone.tar.gz > release/linux/arm64/drone.sha256
|
||||
sha256sum release/linux/arm/drone.tar.gz > release/linux/arm/drone.sha256
|
||||
sha256sum release/windows/amd64/drone.tar.gz > release/windows/amd64/drone.sha256
|
||||
sha256sum release/darwin/amd64/drone.tar.gz > release/darwin/amd64/drone.sha256
|
|
@ -1,3 +1,5 @@
|
|||
// +build !extras
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
63
drone/main_extras.go
Normal file
63
drone/main_extras.go
Normal file
|
@ -0,0 +1,63 @@
|
|||
// +build extras
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/drone/drone/drone/agent"
|
||||
"github.com/drone/drone/drone/build"
|
||||
"github.com/drone/drone/drone/deploy"
|
||||
"github.com/drone/drone/drone/exec"
|
||||
"github.com/drone/drone/drone/info"
|
||||
"github.com/drone/drone/drone/registry"
|
||||
"github.com/drone/drone/drone/repo"
|
||||
"github.com/drone/drone/drone/secret"
|
||||
"github.com/drone/drone/drone/user"
|
||||
"github.com/drone/drone/version"
|
||||
|
||||
"github.com/drone/drone/extras/cmd/drone/server"
|
||||
|
||||
"github.com/ianschenck/envflag"
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
envflag.Parse()
|
||||
|
||||
app := cli.NewApp()
|
||||
app.Name = "drone"
|
||||
app.Version = version.Version.String()
|
||||
app.Usage = "command line utility"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "t, token",
|
||||
Usage: "server auth token",
|
||||
EnvVar: "DRONE_TOKEN",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "s, server",
|
||||
Usage: "server location",
|
||||
EnvVar: "DRONE_SERVER",
|
||||
},
|
||||
}
|
||||
app.Commands = []cli.Command{
|
||||
agent.Command,
|
||||
build.Command,
|
||||
deploy.Command,
|
||||
exec.Command,
|
||||
info.Command,
|
||||
registry.Command,
|
||||
secret.Command,
|
||||
server.Command,
|
||||
repo.Command,
|
||||
user.Command,
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue