Skip to content

Commit 4357aee

Browse files
committed
feat(deploy.sh): push deisci/builder:v2-alpha images from master
1 parent 657e137 commit 4357aee

4 files changed

Lines changed: 53 additions & 15 deletions

File tree

.travis.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
language: go
2+
go:
3+
- 1.5.1
4+
env:
5+
- GO15VENDOREXPERIMENT=1
6+
branches:
7+
only:
8+
- master
9+
cache:
10+
directories:
11+
- $GOPATH/src/github.com/deis/builder/vendor
12+
services:
13+
- docker
14+
sudo: required
15+
before_install:
16+
- wget "https://github.com/Masterminds/glide/releases/download/0.7.2/glide-0.7.2-linux-amd64.tar.gz"
17+
- sudo tar -vxz -C /usr/local/bin --strip=1 -f glide-0.7.2-linux-amd64.tar.gz
18+
install:
19+
- GLIDE_HOME=/home/travis/.glide make bootstrap
20+
script:
21+
- make test
22+
deploy:
23+
provider: script
24+
script: _scripts/deploy.sh
25+
on:
26+
branch: master

Makefile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@
22
# Some uses for short name:
33
# - Docker image name
44
# - Kubernetes service, rc, pod, secret, volume names
5-
SHORT_NAME := builder
5+
SHORT_NAME ?= builder
66

77
# Enable vendor/ directory support.
88
export GO15VENDOREXPERIMENT=1
99

1010
# SemVer with build information is defined in the SemVer 2 spec, but Docker
1111
# doesn't allow +, so we use -.
12-
# VERSION := 0.0.1-$(shell date "+%Y%m%d%H%M%S")
13-
14-
VERSION := 2.0.0
12+
VERSION ?= 0.0.1-$(shell date "+%Y%m%d%H%M%S")
1513
BINARY_DEST_DIR := rootfs/usr/bin
1614
# Common flags passed into Go's linker.
1715
LDFLAGS := "-s -X main.version=${VERSION}"
16+
IMAGE_PREFIX ?= deis
1817
BINARIES := extract-domain extract-types extract-version generate-buildhook get-app-config get-app-values publish-release-controller yaml2json-procfile
1918
STANDALONE := extract-types generate-buildhook yaml2json-procfile
2019
# Docker Root FS
2120
BINDIR := ./rootfs
2221

2322
# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY.
2423
DEV_REGISTRY ?= $$DEV_REGISTRY
25-
DEIS_REGISTY ?= ${DEV_REGISTRY}
24+
DEIS_REGISTRY ?= ${DEV_REGISTRY}/
2625

2726
# Kubernetes-specific information for RC, Service, and Image.
2827
RC := manifests/deis-${SHORT_NAME}-rc.yaml
2928
SVC := manifests/deis-${SHORT_NAME}-service.yaml
30-
# IMAGEBP := ${DEV_REGISTRY}/deis/bp${SHORT_NAME}:${VERSION}
31-
IMAGE := smothiki/${SHORT_NAME}:${VERSION}
29+
IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${VERSION}
3230

3331

3432
all:
3533
@echo "Use a Makefile to control top-level building of the project."
3634

35+
bootstrap:
36+
glide up
37+
3738
# This illustrates a two-stage Docker build. docker-compile runs inside of
3839
# the Docker environment. Other alternatives are cross-compiling, doing
3940
# the build as a `docker build`.
40-
4141
build:
4242
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/builder boot.go || exit 1
4343
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/fetcher fetcher/fetcher.go || exit 1
@@ -46,19 +46,16 @@ build:
4646
for i in $(BINARIES); do \
4747
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/$$i pkg/src/$$i.go || exit 1; \
4848
done
49-
@echo "Past go compiling"
5049
@for i in $(BINARIES); do \
5150
$(call check-static-binary,$(BINARY_DEST_DIR)/$$i); \
5251
done
5352

54-
docker-build:
55-
docker build -t $(IMAGE) rootfs
53+
docker-build: build
54+
docker build --rm -t $(IMAGE) rootfs
5655
perl -pi -e "s|image: [a-z0-9.:]+\/deis\/bp${SHORT_NAME}:[0-9a-z-.]+|image: ${IMAGE}|g" ${RC}
57-
# For cases where build is run inside of a container.
58-
5956

6057
# Push to a registry that Kubernetes can access.
61-
docker-push-bp:
58+
docker-push:
6259
docker push ${IMAGE}
6360

6461
# Deploy is a Kubernetes-oriented target
@@ -76,6 +73,9 @@ kube-rc:
7673
kube-clean:
7774
kubectl delete rc deis-builder
7875

76+
test:
77+
@echo "Implement functional tests in _tests directory"
78+
7979
.PHONY: all build docker-compile kube-up kube-down deploy
8080

8181
define check-static-binary

_scripts/deploy.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build and push Docker images to Docker Hub and quay.io.
4+
#
5+
6+
cd "$(dirname "$0")" || exit 1
7+
8+
export IMAGE_PREFIX=deisci BUILD_TAG=v2-alpha
9+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
10+
DEIS_REGISTRY='' make -C .. docker-build docker-push
11+
docker login -e="$QUAY_EMAIL" -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io
12+
DEIS_REGISTRY=quay.io/ make -C .. docker-build docker-push

manifests/deis-builder-rc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
spec:
2020
containers:
2121
- name: deis-builder
22-
image: smothiki/builder:2.5.2
22+
image: quay.io/deisci/builder:v2-alpha
2323
ports:
2424
- containerPort: 2223
2525
- containerPort: 3000

0 commit comments

Comments
 (0)