From d37f226092f934c97f419d343088def66b856bc3 Mon Sep 17 00:00:00 2001 From: Sam Yuan Date: Sun, 3 Mar 2024 19:47:00 +0800 Subject: [PATCH] add TEKTON support Signed-off-by: Sam Yuan --- .github/workflows/test.yml | 75 +++++++++++++++++++++++--------------- lib/utils.sh | 8 ++++ main.sh | 10 +++++ 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05021f1..9eac807 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,46 +23,63 @@ jobs: SHELLCHECK_OPTS: -x # test local cluster without prometheus grafana - test_local_cluster_without_prometheus_grafana: + test_local_cluster: needs: - shellcheck runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - # I suppose we'd better update version pre kepler release. - # keep from current default version and latest version. - cluster_provider: [kind, microshift] - # So far we just have a single version for microshift - # in the future, we should considering have a local test for each cluster providers + include: + - cluster_provider: kind + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: false + GRAFANA_ENABLE: false + TEKTON_ENABLE: false + - cluster_provider: kind + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: true + GRAFANA_ENABLE: true + TEKTON_ENABLE: false + - cluster_provider: kind + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: false + GRAFANA_ENABLE: false + TEKTON_ENABLE: true + - cluster_provider: kind + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: true + GRAFANA_ENABLE: true + TEKTON_ENABLE: true + - cluster_provider: microshift + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: false + GRAFANA_ENABLE: false + TEKTON_ENABLE: false + - cluster_provider: microshift + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: true + GRAFANA_ENABLE: true + TEKTON_ENABLE: false + - cluster_provider: microshift + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: false + GRAFANA_ENABLE: false + TEKTON_ENABLE: true + - cluster_provider: microshift + prometheus_operator_version: v0.12.0 + PROMETHEUS_ENABLE: true + GRAFANA_ENABLE: true + TEKTON_ENABLE: true steps: - uses: actions/checkout@v3 - name: start from local run: | - export CLUSTER_PROVIDER=${{matrix.cluster_provider}} - ./main.sh up - - name: verify - run: | - export CLUSTER_PROVIDER=${{matrix.cluster_provider}} - ./verify.sh - -# test local cluster with prometheus grafana - test_local_cluster_with_prometheus_grafana: - runs-on: ubuntu-latest - needs: test_local_cluster_without_prometheus_grafana - strategy: - matrix: - # I suppose we'd better update version pre kepler release. - # keep from current default version and latest version. - cluster_provider: [kind, microshift] - prometheus_operator_version: [v0.12.0] - steps: - - uses: actions/checkout@v3 - - name: start from local - run: | - export PROMETHEUS_ENABLE=true + export PROMETHEUS_ENABLE=${{matrix.PROMETHEUS_ENABLE}} export PROMETHEUS_OPERATOR_VERSION=${{matrix.prometheus_operator_version}} - export GRAFANA_ENABLE=true + export GRAFANA_ENABLE=${{matrix.GRAFANA_ENABLE}} export CLUSTER_PROVIDER=${{matrix.cluster_provider}} + export TEKTON_ENABLE=${{matrix.TEKTON_ENABLE}} ./main.sh up - name: verify run: | diff --git a/lib/utils.sh b/lib/utils.sh index 300388a..606d08c 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -143,3 +143,11 @@ run_container() { "$@" \ "$img" } + +rollout_ns_status() { + local resources + resources=$(kubectl get deployments,statefulsets,daemonsets -n=$1 -o name) + for res in $resources; do + kubectl rollout status $res --namespace $1 --timeout=10m || die "failed to check status of ${res} inside namespace ${1}" + done +} \ No newline at end of file diff --git a/main.sh b/main.sh index 0771cb7..bd0119b 100755 --- a/main.sh +++ b/main.sh @@ -50,6 +50,7 @@ declare -r REGISTRY_PORT=${REGISTRY_PORT:-5001} declare -r PROMETHEUS_ENABLE=${PROMETHEUS_ENABLE:-false} declare -r GRAFANA_ENABLE=${GRAFANA_ENABLE:-false} +declare -r TEKTON_ENABLE=${TEKTON_ENABLE:-false} source "$PROJECT_ROOT/lib/utils.sh" @@ -68,6 +69,12 @@ cluster_up() { source "$PROJECT_ROOT/lib/prometheus.sh" deploy_prometheus_operator fi + + if is_set "$TEKTON_ENABLE"; then + kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yamls + rollout_ns_status tekton-pipelines + rollout_ns_status tekton-pipelines-resolvers + fi } cluster_down() { @@ -97,6 +104,9 @@ print_config() { * Install Prometheus : $prom_install_msg * Install Grafana : $GRAFANA_ENABLE + Tekton + * Install Tekton : $TEKTON_ENABLE + $cluster_config ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━