feat(ci): define image for circle ci tests

pull/3694/head
Adam Reese 8 years ago
parent 08a92b23d1
commit 8758e9b774
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -0,0 +1,20 @@
VERSION := 0.1
DOCKER_REGISTRY := helmpack
SHORT_NAME := ci
IMAGE := ${DOCKER_REGISTRY}/${SHORT_NAME}:${VERSION}
.PHONY: image
image:
docker build -t "${IMAGE}" ./image
.PHONY: push
push:
docker push "${IMAGE}"
.PHONY: run
run:
docker run --rm -it \
-v ${GOPATH}:${GOPATH} \
-w ${PWD} \
--entrypoint /bin/bash \
"${IMAGE}"

@ -15,5 +15,4 @@
# limitations under the License. # limitations under the License.
set -euo pipefail set -euo pipefail
apt-get update -y && apt-get install -yq zip
make bootstrap make bootstrap

@ -4,7 +4,7 @@ jobs:
working_directory: /go/src/k8s.io/helm working_directory: /go/src/k8s.io/helm
parallelism: 3 parallelism: 3
docker: docker:
- image: golang:1.10 - image: helmpack/ci:0.1
environment: environment:
PROJECT_NAME: "kubernetes-helm" PROJECT_NAME: "kubernetes-helm"
steps: steps:

@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -euo pipefail set -exuo pipefail
# Skip on pull request builds # Skip on pull request builds
if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then if [[ -n "${CIRCLE_PR_NUMBER:-}" ]]; then
@ -33,21 +33,10 @@ else
exit exit
fi fi
echo "Install docker client"
VER="17.09.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
echo "Install gcloud components"
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
curl https://sdk.cloud.google.com | bash
${HOME}/google-cloud-sdk/bin/gcloud --quiet components update
echo "Configuring gcloud authentication" echo "Configuring gcloud authentication"
echo "${GCLOUD_SERVICE_KEY}" | base64 --decode > "${HOME}/gcloud-service-key.json" echo "${GCLOUD_SERVICE_KEY}" | base64 --decode >"${HOME}/gcloud-service-key.json"
${HOME}/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json" gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json"
${HOME}/google-cloud-sdk/bin/gcloud config set project "${PROJECT_NAME}" gcloud config set project "${PROJECT_NAME}"
docker login -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io docker login -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io
echo "Building the tiller image" echo "Building the tiller image"
@ -61,4 +50,4 @@ make build-cross
make dist checksum VERSION="${VERSION}" make dist checksum VERSION="${VERSION}"
echo "Pushing binaries to gs bucket" echo "Pushing binaries to gs bucket"
${HOME}/google-cloud-sdk/bin/gsutil cp ./_dist/* "gs://${PROJECT_NAME}" gsutil cp ./_dist/* "gs://${PROJECT_NAME}"

@ -0,0 +1,32 @@
# 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.
FROM circleci/golang:1.10
USER root
RUN apt-get update -y && \
apt-get install -yq zip && \
apt-get clean
# install gcloud
ARG GCLOUD_VERSION=193.0.0
RUN curl -Lo gcloud.tgz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz && \
tar xf gcloud.tgz && \
google-cloud-sdk/install.sh && \
rm -rf gcloud.tgz
ENV PATH "/go/google-cloud-sdk/bin:${PATH}"
# install go depenencies
RUN go get -u github.com/Masterminds/glide github.com/mitchellh/gox

@ -16,7 +16,7 @@
# Bash 'Strict Mode' # Bash 'Strict Mode'
# http://redsymbol.net/articles/unofficial-bash-strict-mode # http://redsymbol.net/articles/unofficial-bash-strict-mode
set -euo pipefail set -exuo pipefail
IFS=$'\n\t' IFS=$'\n\t'
HELM_ROOT="${BASH_SOURCE[0]%/*}/.." HELM_ROOT="${BASH_SOURCE[0]%/*}/.."

@ -13,33 +13,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -exuo pipefail
set -euo pipefail
covermode=${COVERMODE:-atomic} covermode=${COVERMODE:-atomic}
coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX) profile=$(mktemp /tmp/coverage.XXXX)
profile="${coverdir}/cover.out"
hash goveralls 2>/dev/null || go get github.com/mattn/goveralls hash goveralls 2>/dev/null || go get github.com/mattn/goveralls
hash godir 2>/dev/null || go get github.com/Masterminds/godir
generate_cover_data() {
for d in $(godir) ; do
(
local output="${coverdir}/${d//\//-}.cover"
go test -coverprofile="${output}" -covermode="$covermode" "$d"
)
done
echo "mode: $covermode" >"$profile"
grep -h -v "^mode:" "$coverdir"/*.cover >>"$profile"
}
push_to_coveralls() { go test -coverprofile "${profile}" -covermode "$covermode" ./...
goveralls -coverprofile="${profile}" -service=circle-ci
}
generate_cover_data
go tool cover -func "${profile}" go tool cover -func "${profile}"
case "${1-}" in case "${1-}" in
@ -47,7 +28,6 @@ case "${1-}" in
go tool cover -html "${profile}" go tool cover -html "${profile}"
;; ;;
--coveralls) --coveralls)
push_to_coveralls goveralls -coverprofile "${profile}" -service circle-ci
;; ;;
esac esac

@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -euo pipefail set -euo pipefail
source scripts/util.sh source scripts/util.sh
@ -46,7 +45,7 @@ ${SED} -i -e "s:${HOME}:~:" ${FILES}
for i in ${FILES}; do for i in ${FILES}; do
ret=0 ret=0
truepath=$(echo ${i} | ${SED} "s:${KUBE_TEMP}/::") truepath=$(echo ${i} | ${SED} "s:${KUBE_TEMP}/::")
diff -NauprB -I 'Auto generated' "${i}" "${truepath}" > /dev/null || ret=$? diff -NauprB -I 'Auto generated' "${i}" "${truepath}" >/dev/null || ret=$?
if [[ $ret -ne 0 ]]; then if [[ $ret -ne 0 ]]; then
echo "${truepath} changed. Updating.." echo "${truepath} changed. Updating.."
cp "${i}" "${truepath}" cp "${i}" "${truepath}"

@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -euo pipefail set -euo pipefail
# Example: kube::util::trap_add 'echo "in trap DEBUG"' DEBUG # Example: kube::util::trap_add 'echo "in trap DEBUG"' DEBUG
@ -28,7 +27,7 @@ kube::util::trap_add() {
local new_cmd local new_cmd
# Grab the currently defined trap commands for this trap # Grab the currently defined trap commands for this trap
existing_cmd=`trap -p "${trap_add_name}" | awk -F"'" '{print $2}'` existing_cmd=$(trap -p "${trap_add_name}" | awk -F"'" '{print $2}')
if [[ -z "${existing_cmd}" ]]; then if [[ -z "${existing_cmd}" ]]; then
new_cmd="${trap_add_cmd}" new_cmd="${trap_add_cmd}"

@ -13,11 +13,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -euo pipefail set -exuo pipefail
exit_code=0 exit_code=0
if ! hash gometalinter.v1 2>/dev/null ; then if ! hash gometalinter.v1 2>/dev/null; then
go get -u gopkg.in/alecthomas/gometalinter.v1 go get -u gopkg.in/alecthomas/gometalinter.v1
gometalinter.v1 --install gometalinter.v1 --install
fi fi

@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -euo pipefail set -exuo pipefail
IFS=$'\n\t' IFS=$'\n\t'
find_files() { find_files() {
@ -28,7 +28,7 @@ find_files() {
} }
failed=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");')) failed=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");'))
if (( ${#failed[@]} > 0 )); then if ((${#failed[@]} > 0)); then
echo "Some source files are missing license headers." echo "Some source files are missing license headers."
for f in "${failed[@]}"; do for f in "${failed[@]}"; do
echo " $f" echo " $f"

@ -13,8 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
set -exuo pipefail
set -euo pipefail
source scripts/util.sh source scripts/util.sh
@ -39,7 +38,6 @@ mkdir -p ${KUBE_TEMP}/docs/helm
bin/helm docs --dir ${KUBE_TEMP}/docs/helm bin/helm docs --dir ${KUBE_TEMP}/docs/helm
HELM_HOME=$OLD_HELM_HOME HELM_HOME=$OLD_HELM_HOME
FILES=$(find ${KUBE_TEMP} -type f) FILES=$(find ${KUBE_TEMP} -type f)
${SED} -i -e "s:${HOME}:~:" ${FILES} ${SED} -i -e "s:${HOME}:~:" ${FILES}

Loading…
Cancel
Save