mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-11 10:05:27 +00:00
commit
dce155fa69
17 changed files with 80 additions and 69 deletions
18
.drone.sh
18
.drone.sh
|
@ -1,9 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
go build -ldflags '-extldflags "-static" -X github.com/laszlocph/woodpecker/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/laszlocph/woodpecker/cmd/drone-server
|
VERSION=$DRONE_TAG
|
||||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/woodpecker/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
|
||||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/woodpecker/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm64/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
if [ -z "$VERSION" ]; then
|
||||||
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/laszlocph/woodpecker/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
VERSION=${DRONE_COMMIT_SHA:0:8}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building $VERSION"
|
||||||
|
|
||||||
|
go build -ldflags '-extldflags "-static" -X github.com/laszlocph/woodpecker/version.Version='${DRONE_TAG} -o release/drone-server github.com/laszlocph/woodpecker/cmd/drone-server
|
||||||
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/woodpecker/version.Version='${DRONE_TAG} -o release/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||||
|
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/woodpecker/version.Version='${DRONE_TAG} -o release/linux/arm64/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||||
|
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/laszlocph/woodpecker/version.Version='${DRONE_TAG} -o release/linux/arm/drone-agent github.com/laszlocph/woodpecker/cmd/drone-agent
|
||||||
|
|
|
@ -46,7 +46,7 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- go get github.com/laszlocph/togo
|
- go get github.com/laszlocph/togo
|
||||||
- (cd web/; go generate ./...)
|
- (cd web/; go generate ./...)
|
||||||
- sh .drone.sh
|
- ./.drone.sh
|
||||||
when:
|
when:
|
||||||
event: [ push, tag ]
|
event: [ push, tag ]
|
||||||
|
|
||||||
|
|
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Woodpecker",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "debug",
|
||||||
|
"program": "${workspaceFolder}/cmd/drone-server/main.go",
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
||||||
GO_VERSION=1.12.4
|
GO_VERSION=1.12.4
|
||||||
export GO111MODULE=off
|
export GO111MODULE=on
|
||||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
||||||
|
|
||||||
DOCKER_RUN?=
|
DOCKER_RUN?=
|
||||||
|
|
|
@ -49,7 +49,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Add("Content-Type", "text/json")
|
w.Header().Add("Content-Type", "text/json")
|
||||||
json.NewEncoder(w).Encode(versionResp{
|
json.NewEncoder(w).Encode(versionResp{
|
||||||
Source: "https://github.com/laszlocph/woodpecker",
|
Source: "https://github.com/laszlocph/woodpecker",
|
||||||
Version: version.Version.String(),
|
Version: version.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "drone-agent"
|
app.Name = "drone-agent"
|
||||||
app.Version = version.Version.String()
|
app.Version = version.String()
|
||||||
app.Usage = "drone agent"
|
app.Usage = "drone agent"
|
||||||
app.Action = loop
|
app.Action = loop
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
|
|
|
@ -20,14 +20,16 @@ import (
|
||||||
|
|
||||||
"github.com/laszlocph/woodpecker/version"
|
"github.com/laszlocph/woodpecker/version"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
_ "github.com/joho/godotenv/autoload"
|
_ "github.com/joho/godotenv/autoload"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
godotenv.Load(".env")
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "drone-server"
|
app.Name = "drone-server"
|
||||||
app.Version = version.Version.String()
|
app.Version = version.String()
|
||||||
app.Usage = "drone server"
|
app.Usage = "drone server"
|
||||||
app.Action = server
|
app.Action = server
|
||||||
app.Flags = flags
|
app.Flags = flags
|
||||||
|
|
1
go.mod
1
go.mod
|
@ -8,7 +8,6 @@ require (
|
||||||
github.com/Microsoft/go-winio v0.4.14 // indirect
|
github.com/Microsoft/go-winio v0.4.14 // indirect
|
||||||
github.com/Sirupsen/logrus v0.10.0
|
github.com/Sirupsen/logrus v0.10.0
|
||||||
github.com/beorn7/perks v1.0.0 // indirect
|
github.com/beorn7/perks v1.0.0 // indirect
|
||||||
github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c
|
|
||||||
github.com/dgrijalva/jwt-go v0.0.0-20150904212456-c1da56349675
|
github.com/dgrijalva/jwt-go v0.0.0-20150904212456-c1da56349675
|
||||||
github.com/dimfeld/httptreemux v0.0.0-20170728181113-4faa6bbd32f9
|
github.com/dimfeld/httptreemux v0.0.0-20170728181113-4faa6bbd32f9
|
||||||
github.com/docker/distribution v2.6.0-rc.1.0.20170112224556-c965e24c8cd2+incompatible // indirect
|
github.com/docker/distribution v2.6.0-rc.1.0.20170112224556-c965e24c8cd2+incompatible // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -11,8 +11,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c h1:+wuUamXDDSjSegI1+8PkeQ0oY7azHxu0jlLJ9Cc/oLE=
|
|
||||||
github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|
|
@ -19,7 +19,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/laszlocph/woodpecker/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NoCache is a middleware function that appends headers
|
// NoCache is a middleware function that appends headers
|
||||||
|
@ -61,11 +60,3 @@ func Secure(c *gin.Context) {
|
||||||
// Also consider adding Content-Security-Policy headers
|
// Also consider adding Content-Security-Policy headers
|
||||||
// c.Header("Content-Security-Policy", "script-src 'self' https://cdnjs.cloudflare.com")
|
// c.Header("Content-Security-Policy", "script-src 'self' https://cdnjs.cloudflare.com")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version is a middleware function that appends the Drone
|
|
||||||
// version information to the HTTP response. This is intended
|
|
||||||
// for debugging and troubleshooting.
|
|
||||||
func Version(c *gin.Context) {
|
|
||||||
c.Header("X-DRONE-VERSION", version.Version.String())
|
|
||||||
c.Next()
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,5 +22,5 @@ import (
|
||||||
// Version is a middleware function that appends the Drone version information
|
// Version is a middleware function that appends the Drone version information
|
||||||
// to the HTTP response. This is intended for debugging and troubleshooting.
|
// to the HTTP response. This is intended for debugging and troubleshooting.
|
||||||
func Version(c *gin.Context) {
|
func Version(c *gin.Context) {
|
||||||
c.Header("X-DRONE-VERSION", version.Version.String())
|
c.Header("X-DRONE-VERSION", version.String())
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ const partials = `
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "version"}}
|
{{define "version"}}
|
||||||
|
<script>
|
||||||
|
window.DRONE_VERSION = {{ .version }};
|
||||||
|
</script>
|
||||||
<meta name="version" content="{{ .version }}">
|
<meta name="version" content="{{ .version }}">
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/laszlocph/woodpecker/web/dist"
|
|
||||||
"github.com/laszlocph/woodpecker/model"
|
"github.com/laszlocph/woodpecker/model"
|
||||||
"github.com/laszlocph/woodpecker/shared/token"
|
"github.com/laszlocph/woodpecker/shared/token"
|
||||||
"github.com/laszlocph/woodpecker/version"
|
"github.com/laszlocph/woodpecker/version"
|
||||||
|
"github.com/laszlocph/woodpecker/web/dist"
|
||||||
|
|
||||||
"github.com/dimfeld/httptreemux"
|
"github.com/dimfeld/httptreemux"
|
||||||
)
|
)
|
||||||
|
@ -104,7 +104,7 @@ func (w *website) handleIndex(rw http.ResponseWriter, r *http.Request) {
|
||||||
"user": user,
|
"user": user,
|
||||||
"csrf": csrf,
|
"csrf": csrf,
|
||||||
"syncing": syncing,
|
"syncing": syncing,
|
||||||
"version": version.Version.String(),
|
"version": version.String(),
|
||||||
}
|
}
|
||||||
rw.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
rw.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,6 @@ func Health(c *gin.Context) {
|
||||||
func Version(c *gin.Context) {
|
func Version(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"source": "https://github.com/laszlocph/woodpecker",
|
"source": "https://github.com/laszlocph/woodpecker",
|
||||||
"version": version.Version.String(),
|
"version": version.String(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2018 Drone.IO Inc.
|
// Copyright 2019 Laszlo Fogas
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -14,26 +14,16 @@
|
||||||
|
|
||||||
package version
|
package version
|
||||||
|
|
||||||
import "github.com/coreos/go-semver/semver"
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// VersionMajor is for an API incompatible changes.
|
// Version of Woodpecker, set with ldflags, from Git tag
|
||||||
VersionMajor int64
|
Version string
|
||||||
// VersionMinor is for functionality in a backwards-compatible manner.
|
|
||||||
VersionMinor int64 = 8
|
|
||||||
// VersionPatch is for backwards-compatible bug fixes.
|
|
||||||
VersionPatch int64 = 9
|
|
||||||
// VersionPre indicates prerelease.
|
|
||||||
VersionPre string
|
|
||||||
// VersionDev indicates development branch. Releases will be empty string.
|
|
||||||
VersionDev string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the specification version that the package types support.
|
// String returns the Version set at build time or "dev"
|
||||||
var Version = semver.Version{
|
func String() string {
|
||||||
Major: VersionMajor,
|
if Version == "" {
|
||||||
Minor: VersionMinor,
|
return "dev"
|
||||||
Patch: VersionPatch,
|
}
|
||||||
PreRelease: semver.PreRelease(VersionPre),
|
|
||||||
Metadata: VersionDev,
|
return Version
|
||||||
}
|
}
|
||||||
|
|
42
web/dist/dist_gen.go
vendored
42
web/dist/dist_gen.go
vendored
File diff suppressed because one or more lines are too long
|
@ -168,15 +168,15 @@ const LOGO = (
|
||||||
<div className={style.brand}>
|
<div className={style.brand}>
|
||||||
<DroneIcon />
|
<DroneIcon />
|
||||||
<p>
|
<p>
|
||||||
Woodpecker<br />
|
Woodpecker<span style="margin-left: 4px;">{window.DRONE_VERSION}</span>
|
||||||
|
<br />
|
||||||
<span>
|
<span>
|
||||||
yes,
|
|
||||||
<a
|
<a
|
||||||
href="https://github.com/laszlocph/drone-oss-08/"
|
href="https://github.com/laszlocph/woodpecker/blob/master/docs/usage/pipeline.md"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
it's a fork
|
Docs
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue