Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action to connect GKE and do helm upgrade #794

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/long_running_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#

name: Chart Tests On Long-running Cluster
on:
pull_request:
# TODO change the branch to release branch
branches:
- '*'
paths:
- 'charts/pulsar-operator/**'
- 'charts/sn-platform/**'
- '.github/workflows/long_running_tests.yml'

workflow_call:
inputs:
namespace:
description: 'A namespace passed from the caller workflow'
default: 'default'
required: false
type: string
release_name:
description: 'A release name passed from the caller workflow'
default: 'sn-test-hello'
required: false
type: string
chart_name:
description: 'A chart name passed from the caller workflow'
default: 'hello/hello'
required: false
type: string
value_filename:
description: 'A value file path passed from the caller workflow'
default: ''
required: false
type: string
chart_version:
description: 'A chart version passed from the caller workflow'
default: '0.4.0-rc2'
required: false
type: string


jobs:
setup-gke:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'

steps:
- name: Checkout
uses: actions/checkout@v3

- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Get the GKE credentials so we can connect to the cluster
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v0'
with:
cluster_name: chart-tests-long-running
location: us-east4-a

# The KUBECONFIG env var is automatically exported and picked up by kubectl.
- id: 'get-pods'
run: 'kubectl get pods'

- name: 'Setup Helm'
run: |
export HELM_VERSION=v3.9.0
wget https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
helm repo add hello https://www.kleinloog.ch/hello-helm/
helm repo add streamnative https://charts.streamnative.io

- name: 'Upgrade Chart'
if: ${{ inputs.namespace != '' }}
run: |
helm -n ${{ inputs.namespace }} upgrade --install ${{ inputs.release_name }} ${{ inputs.chart_name }} -f ${{ inputs.value_filename }} --version ${{ inputs.chart_version }}

# Install a hello chart to test the workflow
- name: 'Upgrade test'
if: ${{ inputs.namespace == '' }}
run: |
helm -n default upgrade --install my-hello hello/hello --version 0.4.0-rc2 -f ''