forked from teracyhq/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:teracyhq/helm-charts into task/te…
…racyhq#2-create-test-helm-chart
- Loading branch information
Showing
4 changed files
with
146 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
language: python | ||
sudo: false | ||
env: | ||
global: | ||
- HELM_URL=https://storage.googleapis.com/kubernetes-helm | ||
- HELM_TARBALL=helm-v2.9.1-linux-amd64.tar.gz | ||
- STABLE_REPO_URL=https://teracyhq.storage.googleapis.com/ | ||
- INCUBATOR_REPO_URL=https://teracyhq-incubator.storage.googleapis.com/ | ||
- GCS_BUCKET_STABLE=gs://teracyhq | ||
- GCS_BUCKET_INCUBATOR=gs://teracyhq-incubator | ||
- ALLOW_OVERWRITE_INDEX_FILE=true | ||
before_install: | ||
- git submodule update --init --recursive | ||
#Please replace the following line with your credential command | ||
- openssl aes-256-cbc -K $encrypted_cbce4ac2ef86_key -iv $encrypted_cbce4ac2ef86_iv | ||
-in credential.json.enc -out credential.json -d | ||
install: | ||
- wget -q ${HELM_URL}/${HELM_TARBALL} | ||
- tar xzfv ${HELM_TARBALL} | ||
- PATH=`pwd`/linux-amd64/:$PATH | ||
- helm init --client-only | ||
- if [ ! -d ${HOME}/google-cloud-sdk ]; then export CLOUDSDK_CORE_DISABLE_PROMPTS=1; | ||
curl https://sdk.cloud.google.com | bash; fi | ||
- source /home/travis/google-cloud-sdk/path.bash.inc | ||
before_script: | ||
- git config --global user.name "<Replace your name here>" | ||
- git config --global user.email "<Replace your email here>" | ||
- chmod ugo+x ./.travis/sync-repo.sh | ||
script: | ||
- | | ||
# Check format helm stable | ||
for dir in `find stable/ -mindepth 1 -maxdepth 1 -type d`; do | ||
helm lint $dir | ||
if [ $? != 0 ]; then | ||
travis_terminate 1 | ||
fi | ||
done | ||
# Check format helm incubator | ||
for dir in `find incubator/ -mindepth 1 -maxdepth 1 -type d`; do | ||
helm lint $dir | ||
if [ $? != 0 ]; then | ||
travis_terminate 1 | ||
fi | ||
done | ||
after_success: | ||
- | | ||
if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST == 'false' ]; then | ||
./.travis/sync-repo.sh | ||
fi | ||
notifications: | ||
slack: | ||
rooms: | ||
secure: "<replace your slack channel's secure key here>" | ||
on_success: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2018 The Kubernetes Authors. All rights reserved. | ||
# | ||
# 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 | ||
|
||
main() { | ||
authenticate | ||
|
||
if ! sync_repo stable "$GCS_BUCKET_STABLE" "$STABLE_REPO_URL"; then | ||
log_error "Not all stable charts could be packaged and synced!" | ||
fi | ||
if ! sync_repo incubator "$GCS_BUCKET_INCUBATOR" "$INCUBATOR_REPO_URL"; then | ||
log_error "Not all incubator charts could be packaged and synced!" | ||
fi | ||
} | ||
|
||
authenticate() { | ||
echo "Authenticating with Google Cloud..." | ||
#gcloud auth activate-service-account --key-file <(base64 --decode <<< "$SYNC_CREDS") | ||
gcloud auth activate-service-account --key-file credential.json | ||
} | ||
|
||
sync_repo() { | ||
local repo_dir="${1?Specify repo dir}" | ||
local bucket="${2?Specify repo bucket}" | ||
local repo_url="${3?Specify repo url}" | ||
local sync_dir="${repo_dir}-sync" | ||
local index_dir="${repo_dir}-index" | ||
|
||
echo "Syncing repo '$repo_dir'..." | ||
|
||
mkdir -p "$sync_dir" | ||
mkdir -p "$index_dir" | ||
# echo "$ALLOW_OVERWRITE_INDEX_FILE" | ||
if ([ ! `gsutil cp "$bucket/index.yaml" "$index_dir/index.yaml"` ]) && ([ ! $ALLOW_OVERWRITE_INDEX_FILE ]); then | ||
log_error "Exiting because unable to copy index locally. Not safe to proceed." | ||
exit 1 | ||
fi | ||
|
||
local exit_code=0 | ||
|
||
for dir in `find ${repo_dir}/ -mindepth 1 -maxdepth 1 -type d`; do | ||
if helm dependency build "$dir"; then | ||
helm package --destination "$sync_dir" "$dir" | ||
else | ||
log_error "Problem building dependencies. Skipping packaging of '$dir'." | ||
exit_code=1 | ||
fi | ||
done | ||
|
||
if helm repo index --url "$repo_url" --merge "$index_dir/index.yaml" "$sync_dir"; then | ||
# Move updated index.yaml to sync folder so we don't push the old one again | ||
mv -f "$sync_dir/index.yaml" "$index_dir/index.yaml" | ||
|
||
gsutil -m rsync "$sync_dir" "$bucket" | ||
|
||
# Make sure index.yaml is synced last | ||
gsutil cp "$index_dir/index.yaml" "$bucket" | ||
else | ||
log_error "Exiting because unable to update index. Not safe to push update." | ||
exit 1 | ||
fi | ||
|
||
ls -l "$sync_dir" | ||
|
||
return "$exit_code" | ||
} | ||
|
||
log_error() { | ||
printf '\e[31mERROR: %s\n\e[39m' "$1" >&2 | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.