mirror of
https://github.com/helm/chart-testing.git
synced 2026-02-05 09:45:14 +01:00
Factor out testing code from charts (#1)
* [WIP] Factor out testing code from charts * Minor various fixes Please enter the commit message for your changes. Lines starting * Start readme * Update readme and add GKE example * Add CircleCI job for ShellCheck * Install Helm and kubectl after other tools Also: Hard-code version for kubectl. * Fix readme * Update maintainer validation 'chartlib::validate_maintainers' should not log an error if there's no maintainers section. This is already covered by the schema validation. * Add random suffix to namespaces * Improve container logs output * Improve logging * Add --cleanup flag to 'helm test' * Improve namespace cleanup * Improve logging * Add random suffixes to releases * Update logging and Docker image version * Update GKE example * Fix Bash array declarations * Remove user from Docker image * Add summary * Use kubectl rollout status for deployments * Add some more fixes * Build dependencies before linting * Fix array initialization * Increase sleep time for namespace polling * Add missing colon * Create v1.0.0 * Update Helm to v2.9.1 * Add missing local keywords * Bump image version * Update copyright headers
This commit is contained in:
committed by
Matt Farina
parent
d472a4a8f0
commit
96d2ce7c0e
30
examples/gke/Dockerfile
Normal file
30
examples/gke/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2018 The Helm 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.
|
||||
|
||||
FROM gcr.io/kubernetes-charts-ci/chart-testing:v1.0.2
|
||||
|
||||
ENV PATH /google-cloud-sdk/bin:$PATH
|
||||
ARG CLOUD_SDK_VERSION=200.0.0
|
||||
RUN curl -LO "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz" && \
|
||||
tar xzf "google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz" && \
|
||||
rm "google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz" && \
|
||||
ln -s /lib /lib64 && \
|
||||
rm -rf /google-cloud-sdk/.install/.backup && \
|
||||
gcloud version
|
||||
|
||||
RUN gcloud config set core/disable_usage_reporting true && \
|
||||
gcloud config set component_manager/disable_update_check true && \
|
||||
gcloud config set metrics/environment github_docker_image
|
||||
|
||||
WORKDIR /workdir
|
||||
43
examples/gke/my_test.sh
Executable file
43
examples/gke/my_test.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Helm 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
|
||||
|
||||
readonly IMAGE_REPOSITORY="myrepo/chart-testing"
|
||||
readonly REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
|
||||
|
||||
main() {
|
||||
local config_container_id
|
||||
config_container_id=$(docker run -ti -d \
|
||||
-v "$GOOGLE_APPLICATION_CREDENTIALS:/service-account.json" \
|
||||
-v "$REPO_ROOT:/workdir" \
|
||||
-e "BUILD_ID=$PULL_NUMBER" \
|
||||
"$IMAGE_REPOSITORY:$IMAGE_TAG" cat)
|
||||
|
||||
# shellcheck disable=SC2064
|
||||
trap "docker rm -f $config_container_id" EXIT
|
||||
|
||||
docker exec "$config_container_id" gcloud auth activate-service-account --key-file /service-account.json
|
||||
docker exec "$config_container_id" gcloud container clusters get-credentials my-cluster --project my-project --zone us-west1-a
|
||||
docker exec "$config_container_id" kubectl cluster-info
|
||||
docker exec "$config_container_id" chart_test.sh --config /workdir/.testenv
|
||||
|
||||
echo "Done Testing!"
|
||||
}
|
||||
|
||||
main
|
||||
Reference in New Issue
Block a user