Initial set of builds for Cadmium
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/cadmium
|
||||
/source
|
23
.gitlab-ci.yml
Normal file
23
.gitlab-ci.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
image: golang:1.10
|
||||
|
||||
build:
|
||||
stage: build
|
||||
variables:
|
||||
CADDY_TAG: $CI_COMMIT_TAG
|
||||
script:
|
||||
- scripts/download "$(dirname $CI_PROJECT_URL)/caddy/-/archive/${CADDY_TAG}/caddy-${CADDY_TAG}.tar.gz"
|
||||
- mkdir -p "$GOPATH/src/github.com/mholt"
|
||||
- ln -s "$(pwd)/source" "$GOPATH/src/github.com/mholt/caddy"
|
||||
- scripts/build ${CADDY_TAG}
|
||||
artifacts:
|
||||
paths:
|
||||
- cadmium
|
||||
- source
|
||||
only:
|
||||
- tags
|
||||
- api
|
||||
- pipelines
|
||||
- triggers
|
||||
- web
|
||||
|
||||
|
56
patches/collection.go
Normal file
56
patches/collection.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// package telemetry implements a stub of the Caddy telemetry client package API
|
||||
// found at https://github.com/mholt/caddy/tree/master/telemetry
|
||||
//
|
||||
// It doesn't do anything. Replacing the telemetry code with a stub is the best
|
||||
// way to ensure compatibility with plugins is maintained. The
|
||||
// `-disabled-metrics` runtime flag doesn't work. The compile-time
|
||||
// `enableTelemetry` flag is OK, but this is better.
|
||||
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func Init(instanceID uuid.UUID, disabledMetricsKeys []string) {
|
||||
|
||||
}
|
||||
|
||||
func StartEmitting() {
|
||||
|
||||
}
|
||||
|
||||
func StopEmitting() {
|
||||
|
||||
}
|
||||
|
||||
func Reset() {
|
||||
}
|
||||
|
||||
func Set(key string, val interface{}) {
|
||||
|
||||
}
|
||||
|
||||
func SetNested(key, subkey string, val interface{}) {
|
||||
|
||||
}
|
||||
|
||||
func Append(key string, value interface{}) {
|
||||
|
||||
}
|
||||
|
||||
func AppendUnique(key string, value interface{}) {
|
||||
|
||||
}
|
||||
|
||||
func Add(key string, amount int) {
|
||||
|
||||
}
|
||||
|
||||
func Increment(key string) {
|
||||
|
||||
}
|
||||
|
||||
func FastHash(input []byte) string {
|
||||
return ""
|
||||
}
|
27
patches/run.go.diff
Normal file
27
patches/run.go.diff
Normal file
@@ -0,0 +1,27 @@
|
||||
--- a/caddy/caddymain/run.go 2018-07-12 01:02:24.244606006 +0100
|
||||
+++ b/caddy/caddymain/run.go 2018-07-12 01:02:48.584895759 +0100
|
||||
@@ -117,7 +117,7 @@
|
||||
os.Exit(0)
|
||||
}
|
||||
if version {
|
||||
- fmt.Printf("%s %s (unofficial)\n", appName, appVersion)
|
||||
+ fmt.Printf("%s %s\n", appName, appVersion)
|
||||
if devBuild && gitShortStat != "" {
|
||||
fmt.Printf("%s\n%s\n", gitShortStat, gitFilesModified)
|
||||
}
|
||||
@@ -490,7 +490,7 @@
|
||||
return envMap, nil
|
||||
}
|
||||
|
||||
-const appName = "Caddy"
|
||||
+const appName = "Cadmium"
|
||||
|
||||
// Flags that control program flow or startup
|
||||
var (
|
||||
@@ -519,4 +519,4 @@
|
||||
gitFilesModified string // git diff-index --name-only HEAD
|
||||
)
|
||||
|
||||
-const enableTelemetry = true
|
||||
+const enableTelemetry = false
|
||||
lupine@gitlab-t470p:~/Desktop/caddy
|
15
scripts/build
Executable file
15
scripts/build
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $0 <Tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building Cadmium $1..."
|
||||
|
||||
cm="github.com/mholt/caddy/caddy/caddymain"
|
||||
go build \
|
||||
-o cadmium \
|
||||
-ldflags "-X \"$cm.gitTag=$1\" -X \"$cm.gitNearestTag=$1\"" \
|
||||
github.com/mholt/caddy/caddy
|
||||
|
24
scripts/download
Executable file
24
scripts/download
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $0 <Tarball URL>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "source" ]; then
|
||||
echo "source/ directory already exists, remove it first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -L "$1" | tar -xzf -
|
||||
mv caddy* source
|
||||
|
||||
# Disable telemetry in run.go and rename to Cadmium
|
||||
patch -d source -p1 <"$(pwd)/patches/run.go.diff"
|
||||
|
||||
# Replace telemetry with a stub
|
||||
rm -r source/telemetry
|
||||
mkdir source/telemetry
|
||||
cp patches/collection.go source/telemetry/collection.go
|
||||
|
||||
|
Reference in New Issue
Block a user