Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build #15

Merged
merged 4 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ Session.vim
# coverage artifacts
.coverprofile
/gover.coverprofile
bin/

# build artifacts
.go/
.*-container
.*-dockerfile
.*-push
bin/
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ go:
go_import_path: k8s.io/ingress
jobs:
include:
- stage: Linters
script:
- go get github.com/golang/lint/golint
- make fmt lint vet
- stage: Build
- stage: Coverage
script:
- go get github.com/mattn/goveralls
- go get github.com/modocache/gover
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- make cover
- make
- stage: Test
script:
- make test
4 changes: 2 additions & 2 deletions Dockerfile → Dockerfile.glbc
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ FROM alpine:3.6

RUN apk add --no-cache ca-certificates

COPY glbc glbc
ENTRYPOINT ["/glbc"]
ADD bin/ARG_ARCH/ARG_BIN /ARG_BIN
ENTRYPOINT ["/ARG_BIN"]
52 changes: 39 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
all: push
# Copyright 2016 The Kubernetes Authors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update to 2017?

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# 0.0 shouldn't clobber any released builds
TAG=0.9.7
PREFIX=gcr.io/google_containers/glbc
PKG=k8s.io/ingress-gce
#
# `make help` will show commonly used targets.
#

server:
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -o glbc ${PKG}/cmd/glbc
# Golang package.
PKG := k8s.io/ingress-gce

container: server
docker build --pull -t $(PREFIX):$(TAG) .
# List of binaries to build. You must have a matching Dockerfile.BINARY
# for each BINARY.
CONTAINER_BINARIES := glbc

push: container
gcloud docker -- push $(PREFIX):$(TAG)
# Registry to push to.
REGISTRY ?= gcr.io/google_containers

clean:
rm -f glbc
ARCH ?= amd64
ALL_ARCH := amd64

# Image to use for building.
BUILD_IMAGE ?= golang:1.9-alpine
# Containers will be named: $(CONTAINER_PREFIX)-$(BINARY)-$(ARCH):$(VERSION).
CONTAINER_PREFIX ?= ingress-gce

# This version-strategy uses git tags to set the version string
VERSION ?= $(shell git describe --tags --always --dirty)

# Set to 1 to print more verbose output from the build.
VERBOSE ?= 0

# Include standard build rules.
include build/rules.mk
43 changes: 43 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
#
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

if [ -z "${PKG}" ]; then
echo "PKG must be set"
exit 1
fi
if [ -z "${ARCH}" ]; then
echo "ARCH must be set"
exit 1
fi
if [ -z "${VERSION}" ]; then
echo "VERSION must be set"
exit 1
fi

export CGO_ENABLED=0
export GOARCH="${ARCH}"
if [ $GOARCH == "amd64" ]; then
export GOBIN="$GOPATH/bin/linux_amd64"
fi

go install \
-installsuffix "static" \
-ldflags "-X ${PKG}/pkg/version.VERSION=${VERSION}" \
./...
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading