Deploy release for each branch update.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
159fa903cf
commit
c3d71e32c8
@ -50,14 +50,12 @@ jobs:
|
||||
- make .gitvalidation
|
||||
- make verify
|
||||
- make binaries
|
||||
- make release
|
||||
go: 1.8.x
|
||||
- script:
|
||||
- make install.tools
|
||||
- make .gitvalidation
|
||||
- make verify
|
||||
- make binaries
|
||||
- make release
|
||||
go: tip
|
||||
- stage: Test
|
||||
script:
|
||||
@ -76,3 +74,8 @@ jobs:
|
||||
- make install.deps
|
||||
- UPLOAD_LOG=true make test-e2e-node
|
||||
go: 1.8.x
|
||||
- stage: Deploy
|
||||
script:
|
||||
- test "${TRAVIS_PULL_REQUEST}" != "false" && exit 0 || true
|
||||
- make push
|
||||
go: 1.8.x
|
||||
|
5
Makefile
5
Makefile
@ -38,6 +38,7 @@ help:
|
||||
@echo " * 'binaries' - Build cri-containerd"
|
||||
@echo " * 'static-binaries - Build static cri-containerd"
|
||||
@echo " * 'release' - Build release tarball"
|
||||
@echo " * 'push' - Push release tarball to GCS"
|
||||
@echo " * 'test' - Test cri-containerd"
|
||||
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
||||
@echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e test"
|
||||
@ -99,6 +100,9 @@ $(BUILD_DIR)/$(TARBALL): $(BUILD_DIR)/cri-containerd hack/versions
|
||||
|
||||
release: $(BUILD_DIR)/$(TARBALL)
|
||||
|
||||
push: $(BUILD_DIR)/$(TARBALL)
|
||||
@@BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) ./hack/push.sh
|
||||
|
||||
.PHONY: install.deps
|
||||
|
||||
install.deps:
|
||||
@ -129,6 +133,7 @@ install.tools: .install.gitvalidation .install.gometalinter
|
||||
binaries \
|
||||
static-binaries \
|
||||
release \
|
||||
push \
|
||||
boiler \
|
||||
clean \
|
||||
default \
|
||||
|
40
hack/push.sh
Executable file
40
hack/push.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 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
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/test-utils.sh
|
||||
|
||||
DEPLOY_BUCKET=${DEPLOY_BUCKET:-"cri-containerd-staging"}
|
||||
BUILD_DIR=${BUILD_DIR:-"_output"}
|
||||
TARBALL=${TARBALL:-"cri-containerd.tar.gz"}
|
||||
|
||||
release_tar=${ROOT}/${BUILD_DIR}/${TARBALL}
|
||||
if [ ! -e ${release_tar} ]; then
|
||||
echo "Release tarball is not built"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! gsutil ls "gs://${DEPLOY_BUCKET}" > /dev/null; then
|
||||
create_ttl_bucket ${DEPLOY_BUCKET}
|
||||
fi
|
||||
|
||||
# TODO(random-liu): Add checksum for the tarball.
|
||||
gsutil cp ${release_tar} "gs://${DEPLOY_BUCKET}/"
|
||||
echo "Release tarball is uploaded to:
|
||||
https://storage.googleapis.com/${DEPLOY_BUCKET}/${TARBALL}"
|
@ -41,14 +41,14 @@ sudo iptables-save > ${ORIGINAL_RULES}
|
||||
# Update ip firewall
|
||||
# We need to add rules to accept all TCP/UDP/ICMP packets.
|
||||
if sudo iptables -L INPUT | grep "Chain INPUT (policy DROP)" > /dev/null; then
|
||||
sudo iptables -A INPUT -w -p TCP -j ACCEPT
|
||||
sudo iptables -A INPUT -w -p UDP -j ACCEPT
|
||||
sudo iptables -A INPUT -w -p ICMP -j ACCEPT
|
||||
sudo iptables -A INPUT -w -p TCP -j ACCEPT
|
||||
sudo iptables -A INPUT -w -p UDP -j ACCEPT
|
||||
sudo iptables -A INPUT -w -p ICMP -j ACCEPT
|
||||
fi
|
||||
if sudo iptables -L FORWARD | grep "Chain FORWARD (policy DROP)" > /dev/null; then
|
||||
sudo iptables -A FORWARD -w -p TCP -j ACCEPT
|
||||
sudo iptables -A FORWARD -w -p UDP -j ACCEPT
|
||||
sudo iptables -A FORWARD -w -p ICMP -j ACCEPT
|
||||
sudo iptables -A FORWARD -w -p TCP -j ACCEPT
|
||||
sudo iptables -A FORWARD -w -p UDP -j ACCEPT
|
||||
sudo iptables -A FORWARD -w -p ICMP -j ACCEPT
|
||||
fi
|
||||
|
||||
# For multiple GOPATHs, keep the first one only
|
||||
@ -85,8 +85,8 @@ rm ${ORIGINAL_RULES}
|
||||
UPLOAD_LOG_PATH=cri-containerd_test-e2e-node
|
||||
if ${UPLOAD_LOG}; then
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "VERSION is not set"
|
||||
exit 1
|
||||
echo "VERSION is not set"
|
||||
exit 1
|
||||
fi
|
||||
upload_logs_to_gcs "${UPLOAD_LOG_PATH}" "${VERSION}-$(date +%Y%m%d-%H%M%S)" "${REPORT_DIR}"
|
||||
fi
|
||||
|
@ -62,17 +62,27 @@ upload_logs_to_gcs() {
|
||||
local -r dir=$2
|
||||
local -r result=$3
|
||||
if ! gsutil ls "gs://${bucket}" > /dev/null; then
|
||||
gsutil mb "gs://${bucket}"
|
||||
gsutil -m acl ch -g all:R "gs://${bucket}"
|
||||
gsutil defacl set public-read "gs://${bucket}"
|
||||
local -r bucket_rule=$(mktemp)
|
||||
# Set 30 day TTL for logs inside the bucket.
|
||||
echo '{"rule": [{"action": {"type": "Delete"},"condition": {"age": 30}}]}' > ${bucket_rule}
|
||||
gsutil lifecycle set "${bucket_rule}" "gs://${bucket}"
|
||||
rm "${bucket_rule}"
|
||||
create_ttl_bucket ${bucket}
|
||||
fi
|
||||
local -r upload_log_path=${bucket}/${dir}
|
||||
gsutil cp -r "${REPORT_DIR}" "gs://${upload_log_path}"
|
||||
echo "Test logs are uploaed to:
|
||||
http://gcsweb.k8s.io/gcs/${upload_log_path}/"
|
||||
}
|
||||
|
||||
# create_ttl_bucket create a public bucket in which all objects
|
||||
# have a default TTL (30 days).
|
||||
# Var set:
|
||||
# 1. Bucket: gcs bucket name.
|
||||
create_ttl_bucket() {
|
||||
local -r bucket=$1
|
||||
gsutil mb "gs://${bucket}"
|
||||
local -r bucket_rule=$(mktemp)
|
||||
# Set 30 day TTL for logs inside the bucket.
|
||||
echo '{"rule": [{"action": {"type": "Delete"},"condition": {"age": 30}}]}' > ${bucket_rule}
|
||||
gsutil lifecycle set "${bucket_rule}" "gs://${bucket}"
|
||||
rm "${bucket_rule}"
|
||||
|
||||
gsutil -m acl ch -g all:R "gs://${bucket}"
|
||||
gsutil defacl set public-read "gs://${bucket}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user