mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 02:40:30 +00:00
fixed some build issues
This commit is contained in:
parent
07b910644b
commit
64663e9742
7 changed files with 19 additions and 24 deletions
1
Makefile
1
Makefile
|
@ -13,6 +13,7 @@ test:
|
|||
go test -cover -short ./...
|
||||
|
||||
build:
|
||||
mkdir -p bin
|
||||
go build -o bin/drone -ldflags "-X main.revision $(SHA) -X main.version $(VERSION).$(SHA)"
|
||||
|
||||
clean:
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
# Docker image for Drone's git-clone plugin
|
||||
# Docker image for Drone's slack notification plugin
|
||||
#
|
||||
# CGO_ENABLED=0 go build -a -tags netgo
|
||||
# docker build --rm=true -t drone/drone-build .
|
||||
|
||||
FROM library/golang:1.4
|
||||
FROM gliderlabs/alpine:3.1
|
||||
RUN apk-install ca-certificates
|
||||
ADD drone-build /bin/
|
||||
ENTRYPOINT ["/bin/drone-build"]
|
||||
|
||||
# copy the local package files to the container's workspace.
|
||||
#ADD . /go/src/github.com/drone/drone-build/
|
||||
|
||||
# build the program inside the container.
|
||||
#RUN go get github.com/drone/drone-build/... && \
|
||||
# go install github.com/drone/drone-build
|
||||
|
||||
|
||||
ADD drone-build /go/bin/
|
||||
|
||||
# run the git-clone plugin when the container starts
|
||||
ENTRYPOINT ["/go/bin/drone-build"]
|
||||
|
|
|
@ -32,12 +32,12 @@ func setup(c *Context) error {
|
|||
// if repository is trusted the build may specify
|
||||
// custom volumes, networking and run in trusted mode.
|
||||
if c.Repo.Trusted {
|
||||
opts = &parser.Opts{true, true, true}
|
||||
opts = &parser.Opts{Network: true, Privileged: true, Volumes: true}
|
||||
}
|
||||
|
||||
// inject the matrix parameters into the yaml
|
||||
injected := inject.Inject(string(c.Yaml), c.Build.Environment)
|
||||
c.Conf, err = parser.ParseSingle(injected, parser.DefaultOpts)
|
||||
c.Conf, err = parser.ParseSingle(injected, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -21,19 +21,19 @@ func GeneratePrivateKey() (*rsa.PrivateKey, error) {
|
|||
|
||||
// helper function that marshalls an RSA Public Key to an SSH
|
||||
// .authorized_keys format
|
||||
func MarshalPublicKey(pubkey *rsa.PublicKey) string {
|
||||
func MarshalPublicKey(pubkey *rsa.PublicKey) []byte {
|
||||
pk, err := ssh.NewPublicKey(pubkey)
|
||||
if err != nil {
|
||||
return ""
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
return string(ssh.MarshalAuthorizedKey(pk))
|
||||
return ssh.MarshalAuthorizedKey(pk)
|
||||
}
|
||||
|
||||
// helper function that marshalls an RSA Private Key to
|
||||
// a PEM encoded file.
|
||||
func MarshalPrivateKey(privkey *rsa.PrivateKey) string {
|
||||
func MarshalPrivateKey(privkey *rsa.PrivateKey) []byte {
|
||||
privateKeyMarshaled := x509.MarshalPKCS1PrivateKey(privkey)
|
||||
privateKeyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Headers: nil, Bytes: privateKeyMarshaled})
|
||||
return string(privateKeyPEM)
|
||||
return privateKeyPEM
|
||||
}
|
||||
|
|
|
@ -60,12 +60,14 @@ func (r *Runner) Run(w *queue.Work) error {
|
|||
b.State = common.StateError
|
||||
b.Finished = time.Now().UTC().Unix()
|
||||
b.Duration = b.Finished - b.Started
|
||||
b.ExitCode = 255
|
||||
}
|
||||
if b.State == common.StatePending {
|
||||
b.State = common.StateError
|
||||
b.Started = time.Now().UTC().Unix()
|
||||
b.Finished = time.Now().UTC().Unix()
|
||||
b.Duration = 0
|
||||
b.ExitCode = 255
|
||||
}
|
||||
r.SetBuild(w.Repo, w.Commit, b)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ var (
|
|||
DefaultAgent = "drone/drone-build:latest"
|
||||
|
||||
// default name of the build agent executable
|
||||
DefaultEntrypoint = []string{"/go/bin/drone-build"}
|
||||
DefaultEntrypoint = []string{"/bin/drone-build"}
|
||||
|
||||
// default argument to invoke build steps
|
||||
DefaultBuildArgs = []string{"--build", "--clone", "--publish", "--deploy"}
|
||||
|
|
|
@ -223,8 +223,8 @@ func PostRepo(c *gin.Context) {
|
|||
c.Fail(400, err)
|
||||
return
|
||||
}
|
||||
r.PublicKey = sshutil.MarshalPublicKey(&key.PublicKey)
|
||||
r.PrivateKey = sshutil.MarshalPrivateKey(key)
|
||||
r.PublicKey = string(sshutil.MarshalPublicKey(&key.PublicKey))
|
||||
r.PrivateKey = string(sshutil.MarshalPrivateKey(key))
|
||||
keypair := &common.Keypair{
|
||||
Public: r.PublicKey,
|
||||
Private: r.PrivateKey,
|
||||
|
|
Loading…
Reference in a new issue