mirror of https://github.com/istio/proxy.git
Add circleci automation for proxy (#702)
* Experimental cicd - to validate the image * Add makefile with deb and envoy targets * No permission to cusomize, fix drone * Reduce paralel tasks - bazel was crashing with obscure message * Fix artifact layout * fix artifact layout * Update the image, use dockerhub and other review comments * Remove working dir * Proxy still doesn't work with Bazel 0.8, and apt-get only installs latest * Attempt to use Shriram's image * Revert, not working * Remove cloudbuild, can't get it to work...
This commit is contained in:
parent
531a85679a
commit
b92dd30297
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Use the JDK image to avoid installing it again.
|
||||||
|
FROM circleci/openjdk:latest
|
||||||
|
|
||||||
|
# this will install the latest version of bazel - unfortunately it won't
|
||||||
|
# work, since they break backward compat on every single release.
|
||||||
|
# Proxy is currently requiring 0.7.
|
||||||
|
#RUN \
|
||||||
|
# sudo sh -c 'echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" > /etc/apt/sources.list.d/bazel.list ' && \
|
||||||
|
# curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
|
||||||
|
|
||||||
|
|
||||||
|
RUN sudo apt-get update && \
|
||||||
|
sudo apt-get -y install \
|
||||||
|
wget software-properties-common make cmake python python-pip \
|
||||||
|
zlib1g-dev bash-completion bc libtool automake zip time g++-6 gcc-6 \
|
||||||
|
rsync
|
||||||
|
|
||||||
|
# ~100M, depends on g++, zlib1g-dev, bash-completions
|
||||||
|
RUN curl -Lo /tmp/bazel.deb https://github.com/bazelbuild/bazel/releases/download/0.7.0/bazel_0.7.0-linux-x86_64.deb && \
|
||||||
|
sudo dpkg -i /tmp/bazel.deb && rm /tmp/bazel.deb
|
||||||
|
|
||||||
|
|
||||||
|
# Instead of "apt-get -y install golang"
|
||||||
|
RUN cd /tmp && \
|
||||||
|
wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz && \
|
||||||
|
sudo rm -rf /usr/local/go && \
|
||||||
|
sudo tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz && \
|
||||||
|
sudo chown -R circleci /usr/local/go && \
|
||||||
|
sudo ln -s /usr/local/go/bin/go /usr/local/bin
|
||||||
|
|
||||||
|
RUN bazel version
|
||||||
|
|
||||||
|
# For circleci unit test integration, "go test -v 2>&1 | go-junit-report > report.xml"
|
||||||
|
RUN go get -u github.com/jstemmer/go-junit-report
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
HUB ?=
|
||||||
|
PROJECT ?= istio
|
||||||
|
|
||||||
|
# Using same naming convention as istio/istio
|
||||||
|
VERSION ?= go1.9-bazel0.7
|
||||||
|
IMG ?= ci
|
||||||
|
|
||||||
|
# Build a local image, can be used for testing with circleci command line.
|
||||||
|
image:
|
||||||
|
docker build -t ${HUB}$(PROJECT)/${IMG}:$(VERSION) -f Dockerfile .
|
||||||
|
|
||||||
|
# Push the image to docker
|
||||||
|
push:
|
||||||
|
docker push "${HUB}$(PROJECT)/${IMG}:$(VERSION)"
|
||||||
|
|
||||||
|
# Run the image locally, as current user, for debug.
|
||||||
|
run:
|
||||||
|
cd $TOP && docker run -it --rm -u $(id -u) -it \
|
||||||
|
-v $PWD:$TOP -w $TOP -e USER=$USER ${HUB}$(PROJECT)/${IMG}:$(VERSION) /bin/bash
|
||||||
|
|
||||||
|
.PHONY: image push latest
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
environment:
|
||||||
|
docker:
|
||||||
|
- image: istio/ci:go1.9-bazel0.7
|
||||||
|
resource_class: xlarge
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- bazel-cache-{{ checksum "WORKSPACE" }}
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- repo-cache-{{ checksum "WORKSPACE" }}
|
||||||
|
# To build docker containers or run tests in a docker
|
||||||
|
- setup_remote_docker
|
||||||
|
- run: make deb BAZEL_BUILD_ARGS="-j 4"
|
||||||
|
- run: make test_envoy
|
||||||
|
- save_cache:
|
||||||
|
key: repo-cache-{{ checksum "WORKSPACE" }}
|
||||||
|
paths:
|
||||||
|
- /home/circleci/.repo
|
||||||
|
- save_cache:
|
||||||
|
key: bazel-cache-{{ checksum "WORKSPACE" }}
|
||||||
|
paths:
|
||||||
|
- /home/circleci/.cache/bazel
|
||||||
|
- store_artifacts:
|
||||||
|
path: /home/circleci/project/bazel-bin/tools/deb/istio-proxy.deb
|
||||||
|
destination: /proxy/deb
|
||||||
|
- store_artifacts:
|
||||||
|
path: /home/circleci/project/bazel-bin/src/envoy/mixer/envoy
|
||||||
|
destination: /proxy/bin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
all:
|
||||||
|
jobs:
|
||||||
|
- build
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: plugins/git
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: costinm/proxy-builder:0.4.4
|
||||||
|
commands:
|
||||||
|
- id
|
||||||
|
- env
|
||||||
|
- sudo chown -R circleci /drone/src
|
||||||
|
- HOME=/drone/src make build_envoy
|
||||||
|
test:
|
||||||
|
image: costinm/proxy-builder:0.4.4
|
||||||
|
commands:
|
||||||
|
- id
|
||||||
|
- env
|
||||||
|
- sudo chown -R circleci /drone/src
|
||||||
|
- HOME=/drone/src make test_envoy
|
||||||
|
|
||||||
|
|
||||||
13
Makefile
13
Makefile
|
|
@ -12,6 +12,8 @@
|
||||||
## See the License for the specific language governing permissions and
|
## See the License for the specific language governing permissions and
|
||||||
## limitations under the License.
|
## limitations under the License.
|
||||||
|
|
||||||
|
TOP := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
LOCAL_ARTIFACTS_DIR ?= $(abspath artifacts)
|
LOCAL_ARTIFACTS_DIR ?= $(abspath artifacts)
|
||||||
ARTIFACTS_DIR ?= $(LOCAL_ARTIFACTS_DIR)
|
ARTIFACTS_DIR ?= $(LOCAL_ARTIFACTS_DIR)
|
||||||
|
|
@ -24,12 +26,19 @@ TAG ?=
|
||||||
build:
|
build:
|
||||||
@bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...
|
@bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...
|
||||||
|
|
||||||
|
# Build only envoy - fast
|
||||||
|
build_envoy:
|
||||||
|
bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //src/envoy/mixer:envoy
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@bazel clean
|
@bazel clean
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //...
|
@bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //...
|
||||||
|
|
||||||
|
test_envoy:
|
||||||
|
@bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //src/envoy/mixer/...
|
||||||
|
|
||||||
check:
|
check:
|
||||||
@script/check-license-headers
|
@script/check-license-headers
|
||||||
@script/check-style
|
@script/check-style
|
||||||
|
|
@ -37,4 +46,8 @@ check:
|
||||||
artifacts: build
|
artifacts: build
|
||||||
@script/push-debian.sh -c opt -p $(ARTIFACTS_DIR)
|
@script/push-debian.sh -c opt -p $(ARTIFACTS_DIR)
|
||||||
|
|
||||||
|
deb:
|
||||||
|
bazel build tools/deb:istio-proxy ${BAZEL_BUILD_ARGS}
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build clean test check artifacts
|
.PHONY: build clean test check artifacts
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue