mirror of
https://github.com/josmo/drone-rancher.git
synced 2026-06-14 05:13:01 +08:00
adding more generic build for forks
This commit is contained in:
+40
-49
@@ -10,91 +10,82 @@ pipeline:
|
||||
- dep ensure
|
||||
|
||||
test:
|
||||
image: golang:1.9
|
||||
image: golang:1.10
|
||||
commands:
|
||||
- go vet
|
||||
- go test -cover -coverprofile=coverage.out
|
||||
- go vet
|
||||
- go test -cover -coverprofile=coverage.out
|
||||
|
||||
build_linux_amd64:
|
||||
image: golang:1.9
|
||||
image: golang:1.10
|
||||
group: build
|
||||
environment:
|
||||
- GOOS=linux
|
||||
- GOARCH=amd64
|
||||
- CGO_ENABLED=0
|
||||
- GOOS=linux
|
||||
- GOARCH=amd64
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-rancher
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/${DRONE_REPO_NAME}
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/${DRONE_REPO_NAME}
|
||||
fi
|
||||
|
||||
build_linux_arm64:
|
||||
image: golang:1.9
|
||||
image: golang:1.10
|
||||
group: build
|
||||
environment:
|
||||
- GOOS=linux
|
||||
- GOARCH=arm64
|
||||
- CGO_ENABLED=0
|
||||
- GOOS=linux
|
||||
- GOARCH=arm64
|
||||
- CGO_ENABLED=0
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-rancher
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/${DRONE_REPO_NAME}
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/${DRONE_REPO_NAME}
|
||||
fi
|
||||
|
||||
build_linux_arm:
|
||||
image: golang:1.9
|
||||
image: golang:1.10
|
||||
group: build
|
||||
environment:
|
||||
- GOOS=linux
|
||||
- GOARCH=arm
|
||||
- CGO_ENABLED=0
|
||||
- GOARM=7
|
||||
- GOOS=linux
|
||||
- GOARCH=arm
|
||||
- CGO_ENABLED=0
|
||||
- GOARM=7
|
||||
commands:
|
||||
- go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-rancher
|
||||
|
||||
# build_windows_amd64:
|
||||
# image: golang:1.9-nanoserver
|
||||
# group: build
|
||||
# environment:
|
||||
# - GOOS=windows
|
||||
# - GOARCH=amd64
|
||||
# - CGO_ENABLED=0
|
||||
# commands:
|
||||
# - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-webhook
|
||||
- |
|
||||
if test "${DRONE_TAG}" = ""; then
|
||||
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/${DRONE_REPO_NAME}
|
||||
else
|
||||
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/${DRONE_REPO_NAME}
|
||||
fi
|
||||
|
||||
publish_linux_amd64:
|
||||
image: plugins/docker
|
||||
username: josmo
|
||||
repo: peloton/drone-rancher
|
||||
group: publish
|
||||
auto_tag: true
|
||||
secrets: [ docker_password ]
|
||||
secrets: [ docker_password, docker_username, plugin_repo ]
|
||||
dockerfile: Dockerfile
|
||||
when:
|
||||
event: [ tag, push ]
|
||||
|
||||
publish_linux_arm64:
|
||||
image: plugins/docker
|
||||
username: josmo
|
||||
repo: peloton/drone-rancher
|
||||
group: publish
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
secrets: [ docker_password ]
|
||||
secrets: [ docker_password, docker_username, plugin_repo ]
|
||||
dockerfile: Dockerfile.arm64
|
||||
when:
|
||||
event: [ tag, push ]
|
||||
|
||||
publish_linux_arm:
|
||||
image: plugins/docker
|
||||
username: josmo
|
||||
repo: peloton/drone-rancher
|
||||
group: publish
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
secrets: [ docker_password ]
|
||||
secrets: [ docker_password, docker_username, plugin_repo ]
|
||||
dockerfile: Dockerfile.arm
|
||||
when:
|
||||
event: [ tag, push ]
|
||||
|
||||
# publish_windows_amd64:
|
||||
# image: plugins/docker
|
||||
# username: josmo
|
||||
# repo: peloton/drone-rancher
|
||||
# tags: [ windows-amd64 ]
|
||||
# secrets: [ docker_password ]
|
||||
# dockerfile: Dockerfile.windows
|
||||
# when:
|
||||
# branch: master
|
||||
# event: push
|
||||
|
||||
@@ -28,3 +28,4 @@ drone-rancher
|
||||
|
||||
*.idea
|
||||
vendor
|
||||
release
|
||||
|
||||
@@ -33,3 +33,12 @@ docker run --rm \
|
||||
-w $(pwd) \
|
||||
peloton/drone-rancher
|
||||
```
|
||||
|
||||
### Contribution
|
||||
|
||||
This repo is setup in a way that if you enable a personal drone server to build your fork it will
|
||||
build and publish your image (makes it easier to test PRs and use the image till the contributions get merged)
|
||||
|
||||
* Build local ```DRONE_REPO_OWNER=josmo DRONE_REPO_NAME=drone-rancher drone exec```
|
||||
* on your server just make sure you have DOCKER_USERNAME, DOCKER_PASSWORD, and PLUGIN_REPO set as secrets
|
||||
|
||||
@@ -8,14 +8,17 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var build string // build number set at compile-time
|
||||
var (
|
||||
version = "0.0.0"
|
||||
build = "0"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "rancher publish"
|
||||
app.Usage = "rancher publish"
|
||||
app.Action = run
|
||||
app.Version = fmt.Sprintf("1.0.0+%s", build)
|
||||
app.Version = fmt.Sprintf("%s+%s", version, build)
|
||||
|
||||
app.Flags = []cli.Flag{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user