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 .gitvalidation
|
||||||
- make verify
|
- make verify
|
||||||
- make binaries
|
- make binaries
|
||||||
- make release
|
|
||||||
go: 1.8.x
|
go: 1.8.x
|
||||||
- script:
|
- script:
|
||||||
- make install.tools
|
- make install.tools
|
||||||
- make .gitvalidation
|
- make .gitvalidation
|
||||||
- make verify
|
- make verify
|
||||||
- make binaries
|
- make binaries
|
||||||
- make release
|
|
||||||
go: tip
|
go: tip
|
||||||
- stage: Test
|
- stage: Test
|
||||||
script:
|
script:
|
||||||
@ -76,3 +74,8 @@ jobs:
|
|||||||
- make install.deps
|
- make install.deps
|
||||||
- UPLOAD_LOG=true make test-e2e-node
|
- UPLOAD_LOG=true make test-e2e-node
|
||||||
go: 1.8.x
|
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 " * 'binaries' - Build cri-containerd"
|
||||||
@echo " * 'static-binaries - Build static cri-containerd"
|
@echo " * 'static-binaries - Build static cri-containerd"
|
||||||
@echo " * 'release' - Build release tarball"
|
@echo " * 'release' - Build release tarball"
|
||||||
|
@echo " * 'push' - Push release tarball to GCS"
|
||||||
@echo " * 'test' - Test cri-containerd"
|
@echo " * 'test' - Test cri-containerd"
|
||||||
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
||||||
@echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e 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)
|
release: $(BUILD_DIR)/$(TARBALL)
|
||||||
|
|
||||||
|
push: $(BUILD_DIR)/$(TARBALL)
|
||||||
|
@@BUILD_DIR=$(BUILD_DIR) TARBALL=$(TARBALL) ./hack/push.sh
|
||||||
|
|
||||||
.PHONY: install.deps
|
.PHONY: install.deps
|
||||||
|
|
||||||
install.deps:
|
install.deps:
|
||||||
@ -129,6 +133,7 @@ install.tools: .install.gitvalidation .install.gometalinter
|
|||||||
binaries \
|
binaries \
|
||||||
static-binaries \
|
static-binaries \
|
||||||
release \
|
release \
|
||||||
|
push \
|
||||||
boiler \
|
boiler \
|
||||||
clean \
|
clean \
|
||||||
default \
|
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}"
|
@ -62,17 +62,27 @@ upload_logs_to_gcs() {
|
|||||||
local -r dir=$2
|
local -r dir=$2
|
||||||
local -r result=$3
|
local -r result=$3
|
||||||
if ! gsutil ls "gs://${bucket}" > /dev/null; then
|
if ! gsutil ls "gs://${bucket}" > /dev/null; then
|
||||||
gsutil mb "gs://${bucket}"
|
create_ttl_bucket ${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}"
|
|
||||||
fi
|
fi
|
||||||
local -r upload_log_path=${bucket}/${dir}
|
local -r upload_log_path=${bucket}/${dir}
|
||||||
gsutil cp -r "${REPORT_DIR}" "gs://${upload_log_path}"
|
gsutil cp -r "${REPORT_DIR}" "gs://${upload_log_path}"
|
||||||
echo "Test logs are uploaed to:
|
echo "Test logs are uploaed to:
|
||||||
http://gcsweb.k8s.io/gcs/${upload_log_path}/"
|
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