Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Add dynamic version string
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Mar 20, 2015
1 parent 127ca3e commit 796580d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion config/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

const (
VERSION = "0.2.0"
CONSOLE_CONTAINER = "console"
DOCKER_BIN = "/usr/bin/docker"
DOCKER_SYSTEM_HOME = "/var/lib/system-docker"
Expand All @@ -16,6 +15,7 @@ const (
)

var (
VERSION string
CloudConfigFile = "/var/lib/rancher/conf/cloud-config-rancher.yml"
ConfigFile = "/var/lib/rancher/conf/rancher.yml"
PrivateConfigFile = "/var/lib/rancher/conf/rancher-private.yml"
Expand Down Expand Up @@ -103,3 +103,9 @@ type StateConfig struct {
type CloudInit struct {
Datasources []string `yaml:"datasources,omitempty"`
}

func init() {
if VERSION == "" {
VERSION = "v0.0.0-dev"
}
}
4 changes: 3 additions & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -x

cd $(dirname $0)/..

source scripts/version

if [ "$IN_DOCKER" != "true" ]; then
cat > .dockerfile << "EOF"
FROM rancher/dind:v0.1.0
Expand Down Expand Up @@ -39,5 +41,5 @@ fi
echo export GOPATH=$GOPATH

mkdir -p bin
go build -tags netgo -ldflags "-linkmode external -extldflags -static" -o bin/rancheros
go build -tags netgo -ldflags "-X github.com/rancherio/os/config.VERSION ${VERSION:-v0.0.0-dev} -linkmode external -extldflags -static" -o bin/rancheros
strip --strip-all bin/rancheros
2 changes: 1 addition & 1 deletion scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ for i in $(ls -d * .* | sort -u | grep -Ev '(\.|\.\.|\.dockerfile|build|dist|.gi
ARGS="${ARGS} $i"
fi
done
run --assets "${ARGS}" ./scripts/build
run --assets ./scripts/version --assets "${ARGS}" ./scripts/build
run --assets ./scripts/install ./scripts/package "$@"
finish
1 change: 1 addition & 0 deletions scripts/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION=v0.2.0

0 comments on commit 796580d

Please sign in to comment.